diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-05-29 19:21:54 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-05-31 14:28:29 +0000 |
commit | 2bb309af8b2e32bd34644bed363f5880c50221af (patch) | |
tree | fe0ddd6d65840d733315c5e97c0e61a8949843c4 /src | |
parent | 7e84a8631cca6f81428ae4b2621e6858a8de9357 (diff) |
Moved resolved type references over to QV4::CompiledData::CompilationUnit
Change-Id: I99bb37bf4d4aa4aedd8e02a0fb4afb4a908573a6
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/compiler/qqmltypecompiler.cpp | 42 | ||||
-rw-r--r-- | src/qml/compiler/qqmltypecompiler_p.h | 15 | ||||
-rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 64 | ||||
-rw-r--r-- | src/qml/compiler/qv4compileddata_p.h | 30 | ||||
-rw-r--r-- | src/qml/qml/qqmlcompileddata.cpp | 59 | ||||
-rw-r--r-- | src/qml/qml/qqmlcompiler_p.h | 27 | ||||
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 8 | ||||
-rw-r--r-- | src/qml/qml/qqmlobjectcreator_p.h | 2 |
8 files changed, 128 insertions, 119 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp index 19beb13e45..4a621f6d19 100644 --- a/src/qml/compiler/qqmltypecompiler.cpp +++ b/src/qml/compiler/qqmltypecompiler.cpp @@ -79,7 +79,7 @@ bool QQmlTypeCompiler::compile() const QHash<int, QQmlTypeData::TypeReference> &resolvedTypes = typeData->resolvedTypeRefs(); for (QHash<int, QQmlTypeData::TypeReference>::ConstIterator resolvedType = resolvedTypes.constBegin(), end = resolvedTypes.constEnd(); resolvedType != end; ++resolvedType) { - QScopedPointer<QQmlCompiledData::TypeReference> ref(new QQmlCompiledData::TypeReference); + QScopedPointer<QV4::CompiledData::CompilationUnit::ResolvedTypeReference> ref(new QV4::CompiledData::CompilationUnit::ResolvedTypeReference); QQmlType *qmlType = resolvedType->type; if (resolvedType->typeData) { if (resolvedType->needsCreation && qmlType->isCompositeSingleton()) { @@ -125,12 +125,12 @@ bool QQmlTypeCompiler::compile() ref->majorVersion = resolvedType->majorVersion; ref->minorVersion = resolvedType->minorVersion; ref->doDynamicTypeCheck(); - compiledData->resolvedTypes.insert(resolvedType.key(), ref.take()); + m_resolvedTypes.insert(resolvedType.key(), ref.take()); } // Build property caches and VME meta object data - for (QHash<int, QQmlCompiledData::TypeReference*>::ConstIterator it = compiledData->resolvedTypes.constBegin(), end = compiledData->resolvedTypes.constEnd(); + for (auto it = m_resolvedTypes.constBegin(), end = m_resolvedTypes.constEnd(); it != end; ++it) { QQmlCustomParser *customParser = (*it)->type ? (*it)->type->customParser() : 0; if (customParser) @@ -244,13 +244,14 @@ bool QQmlTypeCompiler::compile() compiledData->compilationUnit->propertyCaches = m_propertyCaches; compiledData->compilationUnit->importCache = importCache; compiledData->compilationUnit->dependentScripts = dependentScripts; + compiledData->compilationUnit->resolvedTypes = m_resolvedTypes; // Add to type registry of composites if (compiledData->compilationUnit->isCompositeType()) engine->registerInternalCompositeType(compiledData); else { const QV4::CompiledData::Object *obj = qmlUnit->objectAt(qmlUnit->indexOfRootObject); - QQmlCompiledData::TypeReference *typeRef = compiledData->resolvedTypes.value(obj->inheritedTypeNameIndex); + auto *typeRef = m_resolvedTypes.value(obj->inheritedTypeNameIndex); Q_ASSERT(typeRef); if (typeRef->component) { compiledData->metaTypeId = typeRef->component->metaTypeId; @@ -273,7 +274,7 @@ bool QQmlTypeCompiler::compile() for (quint32 i = 0; i < qmlUnit->nObjects; ++i) { const QV4::CompiledData::Object *obj = qmlUnit->objectAt(i); bindingCount += obj->nBindings; - if (QQmlCompiledData::TypeReference *typeRef = compiledData->resolvedTypes.value(obj->inheritedTypeNameIndex)) { + if (auto *typeRef = m_resolvedTypes.value(obj->inheritedTypeNameIndex)) { if (QQmlType *qmlType = typeRef->type) { if (qmlType->parserStatusCast() != -1) ++parserStatusCount; @@ -328,9 +329,9 @@ const QQmlImports *QQmlTypeCompiler::imports() const return &typeData->imports(); } -QHash<int, QQmlCompiledData::TypeReference*> *QQmlTypeCompiler::resolvedTypes() +QHash<int, QV4::CompiledData::CompilationUnit::ResolvedTypeReference*> *QQmlTypeCompiler::resolvedTypes() { - return &compiledData->resolvedTypes; + return &m_resolvedTypes; } QList<QmlIR::Object *> *QQmlTypeCompiler::qmlObjects() @@ -473,7 +474,7 @@ bool QQmlPropertyCacheCreator::buildMetaObjectRecursively(int objectIndex, int r } if (obj->inheritedTypeNameIndex != 0) { - QQmlCompiledData::TypeReference *typeRef = resolvedTypes->value(obj->inheritedTypeNameIndex); + auto *typeRef = resolvedTypes->value(obj->inheritedTypeNameIndex); Q_ASSERT(typeRef); if (typeRef->isFullyDynamicType) { @@ -494,7 +495,7 @@ bool QQmlPropertyCacheCreator::buildMetaObjectRecursively(int objectIndex, int r baseTypeCache = typeRef->createPropertyCache(QQmlEnginePrivate::get(enginePrivate)); Q_ASSERT(baseTypeCache); } else if (instantiatingBinding && instantiatingBinding->isAttachedProperty()) { - QQmlCompiledData::TypeReference *typeRef = resolvedTypes->value(instantiatingBinding->propertyNameIndex); + auto *typeRef = resolvedTypes->value(instantiatingBinding->propertyNameIndex); Q_ASSERT(typeRef); QQmlType *qmltype = typeRef->type; if (!qmltype) { @@ -551,7 +552,7 @@ bool QQmlPropertyCacheCreator::ensureVMEMetaObject(int objectIndex) if (willCreateVMEMetaObject) return true; const QmlIR::Object *obj = qmlObjects.at(objectIndex); - QQmlCompiledData::TypeReference *typeRef = resolvedTypes->value(obj->inheritedTypeNameIndex); + auto *typeRef = resolvedTypes->value(obj->inheritedTypeNameIndex); Q_ASSERT(typeRef); QQmlPropertyCache *baseTypeCache = typeRef->createPropertyCache(QQmlEnginePrivate::get(enginePrivate)); return createMetaObject(objectIndex, obj, baseTypeCache); @@ -876,7 +877,7 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio // Attached property? if (binding->type == QV4::CompiledData::Binding::Type_AttachedProperty) { const QmlIR::Object *attachedObj = qmlObjects.at(binding->value.objectIndex); - QQmlCompiledData::TypeReference *typeRef = resolvedTypes.value(binding->propertyNameIndex); + auto *typeRef = resolvedTypes.value(binding->propertyNameIndex); QQmlType *type = typeRef ? typeRef->type : 0; if (!type) { if (imports->resolveType(propertyName, &type, 0, 0, 0)) { @@ -949,7 +950,7 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio const QString &originalPropertyName = stringAt(binding->propertyNameIndex); - QQmlCompiledData::TypeReference *typeRef = resolvedTypes.value(obj->inheritedTypeNameIndex); + auto *typeRef = resolvedTypes.value(obj->inheritedTypeNameIndex); const QQmlType *type = typeRef ? typeRef->type : 0; if (type) { COMPILE_EXCEPTION(binding, tr("\"%1.%2\" is not available in %3 %4.%5.").arg(typeName).arg(originalPropertyName).arg(type->module()).arg(type->majorVersion()).arg(type->minorVersion())); @@ -1153,7 +1154,7 @@ bool QQmlEnumTypeResolver::tryQualifiedEnumAssignment(const QmlIR::Object *obj, int value = 0; bool ok = false; - QQmlCompiledData::TypeReference *tr = resolvedTypes->value(obj->inheritedTypeNameIndex); + auto *tr = resolvedTypes->value(obj->inheritedTypeNameIndex); if (type && tr && tr->type == type) { QMetaProperty mprop = propertyCache->firstCppMetaObject()->property(prop->coreIndex); @@ -1330,7 +1331,7 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QmlI continue; const QmlIR::Object *targetObject = qmlObjects->at(binding->value.objectIndex); - QQmlCompiledData::TypeReference *tr = resolvedTypes->value(targetObject->inheritedTypeNameIndex); + auto *tr = resolvedTypes->value(targetObject->inheritedTypeNameIndex); Q_ASSERT(tr); if (QQmlType *targetType = tr->type) { if (targetType->metaObject() == &QQmlComponent::staticMetaObject) @@ -1370,7 +1371,7 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QmlI syntheticComponent->flags |= QV4::CompiledData::Object::IsComponent; if (!resolvedTypes->contains(syntheticComponent->inheritedTypeNameIndex)) { - QQmlCompiledData::TypeReference *typeRef = new QQmlCompiledData::TypeReference; + auto typeRef = new QV4::CompiledData::CompilationUnit::ResolvedTypeReference; typeRef->type = componentType; typeRef->majorVersion = componentType->majorVersion(); typeRef->minorVersion = componentType->minorVersion(); @@ -1413,7 +1414,7 @@ bool QQmlComponentAndAliasResolver::resolve() bool isExplicitComponent = false; if (obj->inheritedTypeNameIndex) { - QQmlCompiledData::TypeReference *tref = resolvedTypes->value(obj->inheritedTypeNameIndex); + auto *tref = resolvedTypes->value(obj->inheritedTypeNameIndex); Q_ASSERT(tref); if (tref->type && tref->type->metaObject() == &QQmlComponent::staticMetaObject) isExplicitComponent = true; @@ -1570,7 +1571,7 @@ bool QQmlComponentAndAliasResolver::resolveAliases() if (property.isEmpty()) { const QmlIR::Object *targetObject = qmlObjects->at(targetObjectIndex); - QQmlCompiledData::TypeReference *typeRef = resolvedTypes->value(targetObject->inheritedTypeNameIndex); + auto *typeRef = resolvedTypes->value(targetObject->inheritedTypeNameIndex); Q_ASSERT(typeRef); if (typeRef->type) @@ -1915,7 +1916,7 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD if (notInRevision) { QString typeName = stringAt(obj->inheritedTypeNameIndex); - QQmlCompiledData::TypeReference *objectType = resolvedTypes.value(obj->inheritedTypeNameIndex); + auto *objectType = resolvedTypes.value(obj->inheritedTypeNameIndex); if (objectType && objectType->type) { COMPILE_EXCEPTION(binding, tr("\"%1.%2\" is not available in %3 %4.%5.").arg(typeName).arg(name).arg(objectType->type->module()).arg(objectType->majorVersion).arg(objectType->minorVersion)); } else { @@ -2368,8 +2369,7 @@ bool QQmlPropertyValidator::validateObjectBinding(QQmlPropertyData *property, co QQmlType *qmlType = 0; const QV4::CompiledData::Object *targetObject = qmlUnit->objectAt(binding->value.objectIndex); - QQmlCompiledData::TypeReference *typeRef = resolvedTypes.value(targetObject->inheritedTypeNameIndex); - if (typeRef) { + if (auto *typeRef = resolvedTypes.value(targetObject->inheritedTypeNameIndex)) { QQmlPropertyCache *cache = typeRef->createPropertyCache(QQmlEnginePrivate::get(enginePrivate)); const QMetaObject *mo = cache->firstCppMetaObject(); while (mo && !qmlType) { @@ -2485,7 +2485,7 @@ bool QQmlJSCodeGenerator::compileComponent(int contextObject) m.idIndex = obj->id; m.type = propertyCaches.at(objectIndex).data(); - QQmlCompiledData::TypeReference *tref = resolvedTypes.value(obj->inheritedTypeNameIndex); + auto *tref = resolvedTypes.value(obj->inheritedTypeNameIndex); if (tref && tref->isFullyDynamicType) m.type = 0; diff --git a/src/qml/compiler/qqmltypecompiler_p.h b/src/qml/compiler/qqmltypecompiler_p.h index 5abfc7c18d..121be874fe 100644 --- a/src/qml/compiler/qqmltypecompiler_p.h +++ b/src/qml/compiler/qqmltypecompiler_p.h @@ -96,7 +96,7 @@ public: QUrl url() const { return typeData->finalUrl(); } QQmlEnginePrivate *enginePrivate() const { return engine; } const QQmlImports *imports() const; - QHash<int, QQmlCompiledData::TypeReference *> *resolvedTypes(); + QHash<int, QV4::CompiledData::CompilationUnit::ResolvedTypeReference *> *resolvedTypes(); QList<QmlIR::Object*> *qmlObjects(); int rootObjectIndex() const; void setPropertyCaches(const QQmlPropertyCacheVector &caches); @@ -121,6 +121,7 @@ private: QmlIR::Document *document; // index is string index of type name (use obj->inheritedTypeNameIndex) QHash<int, QQmlCustomParser*> customParsers; + QHash<int, QV4::CompiledData::CompilationUnit::ResolvedTypeReference*> m_resolvedTypes; // index in first hash is component index, vector inside contains object indices of objects with id property QVector<quint32> m_componentRoots; @@ -156,7 +157,7 @@ protected: QQmlEnginePrivate *enginePrivate; const QList<QmlIR::Object*> &qmlObjects; const QQmlImports *imports; - QHash<int, QQmlCompiledData::TypeReference*> *resolvedTypes; + QHash<int, QV4::CompiledData::CompilationUnit::ResolvedTypeReference*> *resolvedTypes; QQmlPropertyCacheVector propertyCaches; }; @@ -179,7 +180,7 @@ private: const QList<QmlIR::Object*> &qmlObjects; const QQmlImports *imports; const QHash<int, QQmlCustomParser*> &customParsers; - const QHash<int, QQmlCompiledData::TypeReference*> &resolvedTypes; + const QHash<int, QV4::CompiledData::CompilationUnit::ResolvedTypeReference*> &resolvedTypes; const QSet<QString> &illegalNames; const QQmlPropertyCacheVector &propertyCaches; }; @@ -210,7 +211,7 @@ private: const QList<QmlIR::Object*> &qmlObjects; const QQmlPropertyCacheVector propertyCaches; const QQmlImports *imports; - QHash<int, QQmlCompiledData::TypeReference *> *resolvedTypes; + QHash<int, QV4::CompiledData::CompilationUnit::ResolvedTypeReference *> *resolvedTypes; }; class QQmlCustomParserScriptIndexer: public QQmlCompilePass @@ -277,7 +278,7 @@ protected: QHash<int, int> _idToObjectIndex; QList<int> _objectsWithAliases; - QHash<int, QQmlCompiledData::TypeReference*> *resolvedTypes; + QHash<int, QV4::CompiledData::CompilationUnit::ResolvedTypeReference*> *resolvedTypes; QQmlPropertyCacheVector propertyCaches; }; @@ -318,7 +319,7 @@ private: QQmlEnginePrivate *enginePrivate; const QV4::CompiledData::Unit *qmlUnit; - const QHash<int, QQmlCompiledData::TypeReference*> &resolvedTypes; + const QHash<int, QV4::CompiledData::CompilationUnit::ResolvedTypeReference*> &resolvedTypes; const QHash<int, QQmlCustomParser*> &customParsers; const QQmlPropertyCacheVector &propertyCaches; @@ -338,7 +339,7 @@ private: bool compileComponent(int componentRoot); bool compileJavaScriptCodeInObjectsRecursively(int objectIndex, int scopeObjectIndex); - const QHash<int, QQmlCompiledData::TypeReference*> &resolvedTypes; + const QHash<int, QV4::CompiledData::CompilationUnit::ResolvedTypeReference*> &resolvedTypes; const QHash<int, QQmlCustomParser*> &customParsers; const QList<QmlIR::Object*> &qmlObjects; const QQmlPropertyCacheVector &propertyCaches; diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index dc29d1b941..2b437254c0 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -48,6 +48,9 @@ #include <private/qv4regexpobject_p.h> #include <private/qqmlpropertycache_p.h> #include <private/qqmltypeloader_p.h> +#include <private/qqmlengine_p.h> +#include <private/qqmlcompiler_p.h> +#include <QQmlPropertyMap> #endif #include <private/qqmlirbuilder_p.h> #include <QCoreApplication> @@ -181,6 +184,16 @@ void CompilationUnit::unlink() importCache = nullptr; + for (auto resolvedType = resolvedTypes.begin(), end = resolvedTypes.end(); + resolvedType != end; ++resolvedType) { + if ((*resolvedType)->component) + (*resolvedType)->component->release(); + if ((*resolvedType)->typePropertyCache) + (*resolvedType)->typePropertyCache->release(); + } + qDeleteAll(resolvedTypes); + resolvedTypes.clear(); + engine = 0; free(runtimeStrings); runtimeStrings = 0; @@ -319,6 +332,57 @@ QString Binding::valueAsScriptString(const Unit *unit) const return valueAsString(unit); } +#ifndef V4_BOOTSTRAP +/*! +Returns the property cache, if one alread exists. The cache is not referenced. +*/ +QQmlPropertyCache *CompilationUnit::ResolvedTypeReference::propertyCache() const +{ + if (type) + return typePropertyCache; + else + return component->compilationUnit->rootPropertyCache(); +} + +/*! +Returns the property cache, creating one if it doesn't already exist. The cache is not referenced. +*/ +QQmlPropertyCache *CompilationUnit::ResolvedTypeReference::createPropertyCache(QQmlEngine *engine) +{ + if (typePropertyCache) { + return typePropertyCache; + } else if (type) { + typePropertyCache = QQmlEnginePrivate::get(engine)->cache(type->metaObject()); + typePropertyCache->addref(); + return typePropertyCache; + } else { + return component->compilationUnit->rootPropertyCache(); + } +} + +template <typename T> +bool qtTypeInherits(const QMetaObject *mo) { + while (mo) { + if (mo == &T::staticMetaObject) + return true; + mo = mo->superClass(); + } + return false; +} + +void CompilationUnit::ResolvedTypeReference::doDynamicTypeCheck() +{ + const QMetaObject *mo = 0; + if (typePropertyCache) + mo = typePropertyCache->firstCppMetaObject(); + else if (type) + mo = type->metaObject(); + else if (component) + mo = component->compilationUnit->rootPropertyCache()->firstCppMetaObject(); + isFullyDynamicType = qtTypeInherits<QQmlPropertyMap>(mo); +} +#endif + } } diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h index 8beb932fc8..0e2e2306d8 100644 --- a/src/qml/compiler/qv4compileddata_p.h +++ b/src/qml/compiler/qv4compileddata_p.h @@ -72,6 +72,9 @@ class QQmlPropertyCache; class QQmlPropertyData; class QQmlTypeNameCache; class QQmlScriptData; +class QQmlType; +class QQmlCompiledData; +class QQmlEngine; // The vector is indexed by QV4::CompiledData::Object index and the flag // indicates whether instantiation of the object requires a VME meta-object. @@ -694,6 +697,33 @@ struct Q_QML_PRIVATE_EXPORT CompilationUnit : public QQmlRefCount QVector<QQmlScriptData *> dependentScripts; + struct ResolvedTypeReference + { + ResolvedTypeReference() + : type(0), typePropertyCache(0), component(0) + , majorVersion(0) + , minorVersion(0) + , isFullyDynamicType(false) + {} + + QQmlType *type; + QQmlPropertyCache *typePropertyCache; + QQmlCompiledData *component; + + int majorVersion; + int minorVersion; + // Types such as QQmlPropertyMap can add properties dynamically at run-time and + // therefore cannot have a property cache installed when instantiated. + bool isFullyDynamicType; + + QQmlPropertyCache *propertyCache() const; + QQmlPropertyCache *createPropertyCache(QQmlEngine *); + + void doDynamicTypeCheck(); + }; + // map from name index + QHash<int, ResolvedTypeReference*> resolvedTypes; + QV4::Function *linkToEngine(QV4::ExecutionEngine *engine); void unlink(); diff --git a/src/qml/qml/qqmlcompileddata.cpp b/src/qml/qml/qqmlcompileddata.cpp index b25792054c..fad13bb1e3 100644 --- a/src/qml/qml/qqmlcompileddata.cpp +++ b/src/qml/qml/qqmlcompileddata.cpp @@ -74,71 +74,12 @@ QQmlCompiledData::~QQmlCompiledData() QQmlEnginePrivate::get(engine)->unregisterInternalCompositeType(this); clear(); - - for (QHash<int, TypeReference*>::Iterator resolvedType = resolvedTypes.begin(), end = resolvedTypes.end(); - resolvedType != end; ++resolvedType) { - if ((*resolvedType)->component) - (*resolvedType)->component->release(); - if ((*resolvedType)->typePropertyCache) - (*resolvedType)->typePropertyCache->release(); - } - qDeleteAll(resolvedTypes); - resolvedTypes.clear(); } void QQmlCompiledData::clear() { } -/*! -Returns the property cache, if one alread exists. The cache is not referenced. -*/ -QQmlPropertyCache *QQmlCompiledData::TypeReference::propertyCache() const -{ - if (type) - return typePropertyCache; - else - return component->compilationUnit->rootPropertyCache(); -} - -/*! -Returns the property cache, creating one if it doesn't already exist. The cache is not referenced. -*/ -QQmlPropertyCache *QQmlCompiledData::TypeReference::createPropertyCache(QQmlEngine *engine) -{ - if (typePropertyCache) { - return typePropertyCache; - } else if (type) { - typePropertyCache = QQmlEnginePrivate::get(engine)->cache(type->metaObject()); - typePropertyCache->addref(); - return typePropertyCache; - } else { - return component->compilationUnit->rootPropertyCache(); - } -} - -template <typename T> -bool qtTypeInherits(const QMetaObject *mo) { - while (mo) { - if (mo == &T::staticMetaObject) - return true; - mo = mo->superClass(); - } - return false; -} - -void QQmlCompiledData::TypeReference::doDynamicTypeCheck() -{ - const QMetaObject *mo = 0; - if (typePropertyCache) - mo = typePropertyCache->firstCppMetaObject(); - else if (type) - mo = type->metaObject(); - else if (component) - mo = component->compilationUnit->rootPropertyCache()->firstCppMetaObject(); - isFullyDynamicType = qtTypeInherits<QQmlPropertyMap>(mo); -} - void QQmlCompiledData::initialize(QQmlEngine *engine) { Q_ASSERT(!hasEngine()); diff --git a/src/qml/qml/qqmlcompiler_p.h b/src/qml/qml/qqmlcompiler_p.h index 2c9e04d5e0..39fa84df3d 100644 --- a/src/qml/qml/qqmlcompiler_p.h +++ b/src/qml/qml/qqmlcompiler_p.h @@ -93,33 +93,6 @@ public: int listMetaTypeId; bool isRegisteredWithEngine; - struct TypeReference - { - TypeReference() - : type(0), typePropertyCache(0), component(0) - , majorVersion(0) - , minorVersion(0) - , isFullyDynamicType(false) - {} - - QQmlType *type; - QQmlPropertyCache *typePropertyCache; - QQmlCompiledData *component; - - int majorVersion; - int minorVersion; - // Types such as QQmlPropertyMap can add properties dynamically at run-time and - // therefore cannot have a property cache installed when instantiated. - bool isFullyDynamicType; - - QQmlPropertyCache *propertyCache() const; - QQmlPropertyCache *createPropertyCache(QQmlEngine *); - - void doDynamicTypeCheck(); - }; - // map from name index - QHash<int, TypeReference*> resolvedTypes; - QQmlRefPointer<QV4::CompiledData::CompilationUnit> compilationUnit; bool isInitialized() const { return hasEngine(); } diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index dcd35bccad..e2e1c6878e 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -72,7 +72,7 @@ struct ActiveOCRestorer QQmlObjectCreator::QQmlObjectCreator(QQmlContextData *parentContext, QQmlCompiledData *compiledData, QQmlContextData *creationContext, void *activeVMEDataForRootContext) : phase(Startup) , compiledData(compiledData) - , resolvedTypes(compiledData->resolvedTypes) + , resolvedTypes(compiledData->compilationUnit->resolvedTypes) , propertyCaches(compiledData->compilationUnit->propertyCaches) , activeVMEDataForRootContext(activeVMEDataForRootContext) { @@ -96,7 +96,7 @@ QQmlObjectCreator::QQmlObjectCreator(QQmlContextData *parentContext, QQmlCompile QQmlObjectCreator::QQmlObjectCreator(QQmlContextData *parentContext, QQmlCompiledData *compiledData, QQmlObjectCreatorSharedState *inheritedSharedState) : phase(Startup) , compiledData(compiledData) - , resolvedTypes(compiledData->resolvedTypes) + , resolvedTypes(compiledData->compilationUnit->resolvedTypes) , propertyCaches(compiledData->compilationUnit->propertyCaches) , activeVMEDataForRootContext(0) { @@ -708,7 +708,7 @@ bool QQmlObjectCreator::setPropertyBinding(const QQmlPropertyData *property, con { if (binding->type == QV4::CompiledData::Binding::Type_AttachedProperty) { Q_ASSERT(stringAt(qmlUnit->objectAt(binding->value.objectIndex)->inheritedTypeNameIndex).isEmpty()); - QQmlCompiledData::TypeReference *tr = resolvedTypes.value(binding->propertyNameIndex); + QV4::CompiledData::CompilationUnit::ResolvedTypeReference *tr = resolvedTypes.value(binding->propertyNameIndex); Q_ASSERT(tr); QQmlType *attachedType = tr->type; if (!attachedType) { @@ -1042,7 +1042,7 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo instance = component; ddata = QQmlData::get(instance, /*create*/true); } else { - QQmlCompiledData::TypeReference *typeRef = resolvedTypes.value(obj->inheritedTypeNameIndex); + QV4::CompiledData::CompilationUnit::ResolvedTypeReference *typeRef = resolvedTypes.value(obj->inheritedTypeNameIndex); Q_ASSERT(typeRef); installPropertyCache = !typeRef->isFullyDynamicType; QQmlType *type = typeRef->type; diff --git a/src/qml/qml/qqmlobjectcreator_p.h b/src/qml/qml/qqmlobjectcreator_p.h index f51cf3a2ca..d18e6696e4 100644 --- a/src/qml/qml/qqmlobjectcreator_p.h +++ b/src/qml/qml/qqmlobjectcreator_p.h @@ -140,7 +140,7 @@ private: const QV4::CompiledData::Unit *qmlUnit; QQmlGuardedContextData parentContext; QQmlContextData *context; - const QHash<int, QQmlCompiledData::TypeReference*> &resolvedTypes; + const QHash<int, QV4::CompiledData::CompilationUnit::ResolvedTypeReference*> &resolvedTypes; const QQmlPropertyCacheVector &propertyCaches; QExplicitlySharedDataPointer<QQmlObjectCreatorSharedState> sharedState; bool topLevelCreator; |