From b3d8a4d47db63a06d354b6002ec764fd1442ec6e Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 21 Mar 2014 01:10:37 +0100 Subject: Cleanups * Get rid of members in QQmlCompiledData that were used by the VME and are now unused * Get rid of QQmlVME friend declarations that are not needed anymore Change-Id: I11b4b6f0b4b0b60edf92a1256be3d0d44d76bbc9 Reviewed-by: Lars Knoll --- src/qml/compiler/qqmltypecompiler.cpp | 8 ++++---- src/qml/qml/qqmlabstractbinding_p.h | 1 - src/qml/qml/qqmlbinding.cpp | 26 +++++++++++--------------- src/qml/qml/qqmlcompileddata.cpp | 2 -- src/qml/qml/qqmlcompiler_p.h | 9 ++------- src/qml/qml/qqmlcomponent.h | 1 - src/qml/qml/qqmlcomponentattached_p.h | 1 - src/qml/qml/qqmlcontext.h | 1 - src/qml/qml/qqmlcontext_p.h | 1 - src/qml/qml/qqmlexpression.cpp | 13 +++---------- src/qml/qml/qqmlexpression.h | 1 - src/qml/qml/qqmlobjectcreator.cpp | 4 ++-- src/qml/qml/qqmlparserstatus.h | 1 - src/qml/qml/qqmlscriptstring.h | 1 - src/qml/qml/qqmltypeloader_p.h | 1 - 15 files changed, 22 insertions(+), 49 deletions(-) diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp index 0b9f9faf09..9e2ab9e046 100644 --- a/src/qml/compiler/qqmltypecompiler.cpp +++ b/src/qml/compiler/qqmltypecompiler.cpp @@ -140,7 +140,7 @@ bool QQmlTypeCompiler::compile() customParsers.insert(it.key(), customParser); } - compiledData->datas.reserve(document->objects.count()); + compiledData->metaObjects.reserve(document->objects.count()); compiledData->propertyCaches.reserve(document->objects.count()); { @@ -349,13 +349,13 @@ const QVector &QQmlTypeCompiler::propertyCaches() const void QQmlTypeCompiler::setVMEMetaObjects(const QVector &metaObjects) { - Q_ASSERT(compiledData->datas.isEmpty()); - compiledData->datas = metaObjects; + Q_ASSERT(compiledData->metaObjects.isEmpty()); + compiledData->metaObjects = metaObjects; } QVector *QQmlTypeCompiler::vmeMetaObjects() const { - return &compiledData->datas; + return &compiledData->metaObjects; } QHash *QQmlTypeCompiler::objectIndexToIdForRoot() diff --git a/src/qml/qml/qqmlabstractbinding_p.h b/src/qml/qml/qqmlabstractbinding_p.h index 7354f9af1e..0bc0b6f199 100644 --- a/src/qml/qml/qqmlabstractbinding_p.h +++ b/src/qml/qml/qqmlabstractbinding_p.h @@ -149,7 +149,6 @@ private: friend class QQmlComponentPrivate; friend class QQmlValueTypeProxyBinding; friend class QQmlPropertyPrivate; - friend class QQmlVME; friend class QtSharedPointer::ExternalRefCount; friend class QV4Bindings; friend class QQmlObjectCreator; diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp index 306552d39c..bc5e4e36d3 100644 --- a/src/qml/qml/qqmlbinding.cpp +++ b/src/qml/qml/qqmlbinding.cpp @@ -130,23 +130,19 @@ QQmlBinding::QQmlBinding(const QQmlScriptString &script, QObject *obj, QQmlConte QString url; QString code; - int id = scriptPrivate->bindingId; - if (id >= 0) { - QQmlContextData *ctxtdata = QQmlContextData::get(scriptPrivate->context); - QQmlEnginePrivate *engine = QQmlEnginePrivate::get(scriptPrivate->context->engine()); - if (engine && ctxtdata && !ctxtdata->url.isEmpty()) { - QQmlTypeData *typeData = engine->typeLoader.getType(ctxtdata->url); - Q_ASSERT(typeData); - - if (QQmlCompiledData *cdata = typeData->compiledData()) { - code = cdata->primitives.at(id); - url = cdata->name; - } + QQmlContextData *ctxtdata = QQmlContextData::get(scriptPrivate->context); + QQmlEnginePrivate *engine = QQmlEnginePrivate::get(scriptPrivate->context->engine()); + if (engine && ctxtdata && !ctxtdata->url.isEmpty()) { + QQmlTypeData *typeData = engine->typeLoader.getType(ctxtdata->url); + Q_ASSERT(typeData); - typeData->release(); + if (QQmlCompiledData *cdata = typeData->compiledData()) { + url = cdata->name; } - } else - code = scriptPrivate->script; + + typeData->release(); + } + code = scriptPrivate->script; setNotifyOnValueChanged(true); QQmlAbstractExpression::setContext(QQmlContextData::get(ctxt ? ctxt : scriptPrivate->context)); diff --git a/src/qml/qml/qqmlcompileddata.cpp b/src/qml/qml/qqmlcompileddata.cpp index 59c56bf513..a352e5ad1d 100644 --- a/src/qml/qml/qqmlcompileddata.cpp +++ b/src/qml/qml/qqmlcompileddata.cpp @@ -61,8 +61,6 @@ QQmlCompiledData::QQmlCompiledData(QQmlEngine *engine) rootPropertyCache(0), compilationUnit(0), qmlUnit(0), totalBindingsCount(0), totalParserStatusCount(0) { Q_ASSERT(engine); - - bytecode.reserve(1024); } void QQmlCompiledData::destroy() diff --git a/src/qml/qml/qqmlcompiler_p.h b/src/qml/qml/qqmlcompiler_p.h index a56af15b5a..9432811f5b 100644 --- a/src/qml/qml/qqmlcompiler_p.h +++ b/src/qml/qml/qqmlcompiler_p.h @@ -127,15 +127,10 @@ public: QHash resolvedTypes; QQmlPropertyCache *rootPropertyCache; - QList primitives; - QVector datas; - QByteArray bytecode; + QVector metaObjects; QVector propertyCaches; - QList > contextCaches; QList scripts; - QList urls; - // --- new compiler QV4::CompiledData::CompilationUnit *compilationUnit; QV4::CompiledData::QmlUnit *qmlUnit; // index in first hash is component index, hash inside maps from object index in that scope to integer id @@ -154,7 +149,7 @@ public: int totalObjectCount; // Number of objects explicitly instantiated bool isComponent(int objectIndex) const { return objectIndexToIdPerComponent.contains(objectIndex); } - bool isCompositeType() const { return !datas.at(qmlUnit->indexOfRootObject).isEmpty(); } + bool isCompositeType() const { return !metaObjects.at(qmlUnit->indexOfRootObject).isEmpty(); } bool isInitialized() const { return hasEngine(); } void initialize(QQmlEngine *); diff --git a/src/qml/qml/qqmlcomponent.h b/src/qml/qml/qqmlcomponent.h index 4aa0daf47e..9be1990adc 100644 --- a/src/qml/qml/qqmlcomponent.h +++ b/src/qml/qml/qqmlcomponent.h @@ -127,7 +127,6 @@ private: QQmlComponent(QQmlEngine *, QQmlCompiledData *, int, QObject *parent); Q_DISABLE_COPY(QQmlComponent) - friend class QQmlVME; friend class QQmlTypeData; friend class QQmlObjectCreator; }; diff --git a/src/qml/qml/qqmlcomponentattached_p.h b/src/qml/qml/qqmlcomponentattached_p.h index ae416dcb1c..4fb77a1a4d 100644 --- a/src/qml/qml/qqmlcomponentattached_p.h +++ b/src/qml/qml/qqmlcomponentattached_p.h @@ -73,7 +73,6 @@ Q_SIGNALS: void destruction(); private: - friend class QQmlVME; friend class QQmlContextData; }; diff --git a/src/qml/qml/qqmlcontext.h b/src/qml/qml/qqmlcontext.h index e191807cf4..828ae8c523 100644 --- a/src/qml/qml/qqmlcontext.h +++ b/src/qml/qml/qqmlcontext.h @@ -88,7 +88,6 @@ public: QUrl baseUrl() const; private: - friend class QQmlVME; friend class QQmlEngine; friend class QQmlEnginePrivate; friend class QQmlExpression; diff --git a/src/qml/qml/qqmlcontext_p.h b/src/qml/qml/qqmlcontext_p.h index d3af3a2afa..2d544b1633 100644 --- a/src/qml/qml/qqmlcontext_p.h +++ b/src/qml/qml/qqmlcontext_p.h @@ -105,7 +105,6 @@ public: static QObject *context_at(QQmlListProperty *, int); }; -class QQmlVME; class QQmlComponentAttached; class QQmlGuardedContextData; class Q_QML_PRIVATE_EXPORT QQmlContextData diff --git a/src/qml/qml/qqmlexpression.cpp b/src/qml/qml/qqmlexpression.cpp index b64dd9bd39..6034d3fdea 100644 --- a/src/qml/qml/qqmlexpression.cpp +++ b/src/qml/qml/qqmlexpression.cpp @@ -168,16 +168,9 @@ QQmlExpression::QQmlExpression(const QQmlScriptString &script, QQmlContext *ctxt Q_ASSERT(typeData); if (QQmlCompiledData *cdata = typeData->compiledData()) { - int id = scriptPrivate->bindingId; - if (id >= 0) { - defaultConstruction = false; - d->init(evalCtxtData, cdata->primitives.at(id), scopeObject, - cdata->name, scriptPrivate->lineNumber, scriptPrivate->columnNumber); - } else { - d->url = cdata->name; - d->line = scriptPrivate->lineNumber; - d->column = scriptPrivate->columnNumber; - } + d->url = cdata->name; + d->line = scriptPrivate->lineNumber; + d->column = scriptPrivate->columnNumber; } typeData->release(); diff --git a/src/qml/qml/qqmlexpression.h b/src/qml/qml/qqmlexpression.h index b702a37ee0..185b9542c5 100644 --- a/src/qml/qml/qqmlexpression.h +++ b/src/qml/qml/qqmlexpression.h @@ -98,7 +98,6 @@ private: Q_DECLARE_PRIVATE(QQmlExpression) friend class QQmlDebugger; friend class QQmlContext; - friend class QQmlVME; }; QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 847d325763..e4e0d63b37 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -85,7 +85,7 @@ QQmlObjectCreator::QQmlObjectCreator(QQmlContextData *parentContext, QQmlCompile , compiledData(compiledData) , resolvedTypes(compiledData->resolvedTypes) , propertyCaches(compiledData->propertyCaches) - , vmeMetaObjectData(compiledData->datas) + , vmeMetaObjectData(compiledData->metaObjects) , activeVMEDataForRootContext(activeVMEDataForRootContext) { init(parentContext); @@ -106,7 +106,7 @@ QQmlObjectCreator::QQmlObjectCreator(QQmlContextData *parentContext, QQmlCompile , compiledData(compiledData) , resolvedTypes(compiledData->resolvedTypes) , propertyCaches(compiledData->propertyCaches) - , vmeMetaObjectData(compiledData->datas) + , vmeMetaObjectData(compiledData->metaObjects) , activeVMEDataForRootContext(0) { init(parentContext); diff --git a/src/qml/qml/qqmlparserstatus.h b/src/qml/qml/qqmlparserstatus.h index 4e611f82b1..92b320ec0c 100644 --- a/src/qml/qml/qqmlparserstatus.h +++ b/src/qml/qml/qqmlparserstatus.h @@ -58,7 +58,6 @@ public: virtual void componentComplete()=0; private: - friend class QQmlVME; friend class QQmlComponent; friend class QQmlComponentPrivate; friend class QQmlEnginePrivate; diff --git a/src/qml/qml/qqmlscriptstring.h b/src/qml/qml/qqmlscriptstring.h index 9817fdc92c..2c10df6efc 100644 --- a/src/qml/qml/qqmlscriptstring.h +++ b/src/qml/qml/qqmlscriptstring.h @@ -77,7 +77,6 @@ private: friend class QQmlObjectCreator; friend class QQmlScriptStringPrivate; - friend class QQmlVME; friend class QQmlExpression; friend class QQmlBinding; }; diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h index 1328ebc37c..8335ffa7db 100644 --- a/src/qml/qml/qqmltypeloader_p.h +++ b/src/qml/qml/qqmltypeloader_p.h @@ -506,7 +506,6 @@ protected: virtual void clear(); // From QQmlCleanup private: - friend class QQmlVME; friend class QQmlScriptBlob; void initialize(QQmlEngine *); -- cgit v1.2.3