aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2016-05-23 15:35:52 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2016-05-24 14:08:26 +0000
commit0ba6dffd96a0dda8e3938b09395075c19e46644b (patch)
tree0e3dbefa18d82eec2122d109eb9e787103cbc43d /src
parenta6814650232825663f33fe4f11a362c397385350 (diff)
Get rid of QQmlCompiledData::rootPropertyCache member
This would not seem like a member variable that is hot enough to keep there and it is two loads away. Change-Id: Id7088771bd33545a2846cc3497e5904dd8ac4f5d Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp6
-rw-r--r--src/qml/qml/qqmlcompileddata.cpp17
-rw-r--r--src/qml/qml/qqmlcompiler_p.h2
-rw-r--r--src/qml/qml/qqmlengine.cpp10
-rw-r--r--src/qml/qml/qqmlmetatype.cpp2
5 files changed, 15 insertions, 22 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index 5f405cdcb8..0d98aa6e54 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -339,10 +339,6 @@ void QQmlTypeCompiler::setPropertyCaches(const QQmlPropertyCacheVector &caches)
{
compiledData->propertyCaches = caches;
Q_ASSERT(caches.count() >= document->indexOfRootObject);
- if (compiledData->rootPropertyCache)
- compiledData->rootPropertyCache->release();
- compiledData->rootPropertyCache = caches.at(document->indexOfRootObject).data();
- compiledData->rootPropertyCache->addref();
}
const QQmlPropertyCacheVector &QQmlTypeCompiler::propertyCaches() const
@@ -1355,7 +1351,7 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QmlI
if (targetType->metaObject() == &QQmlComponent::staticMetaObject)
continue;
} else if (tr->component) {
- if (tr->component->rootPropertyCache->firstCppMetaObject() == &QQmlComponent::staticMetaObject)
+ if (tr->component->rootPropertyCache()->firstCppMetaObject() == &QQmlComponent::staticMetaObject)
continue;
}
diff --git a/src/qml/qml/qqmlcompileddata.cpp b/src/qml/qml/qqmlcompileddata.cpp
index 0b44972491..1037b5da51 100644
--- a/src/qml/qml/qqmlcompileddata.cpp
+++ b/src/qml/qml/qqmlcompileddata.cpp
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
QQmlCompiledData::QQmlCompiledData(QQmlEngine *engine)
: engine(engine), importCache(0), metaTypeId(-1), listMetaTypeId(-1), isRegisteredWithEngine(false),
- rootPropertyCache(0), totalBindingsCount(0), totalParserStatusCount(0)
+ totalBindingsCount(0), totalParserStatusCount(0)
{
Q_ASSERT(engine);
}
@@ -86,18 +86,15 @@ QQmlCompiledData::~QQmlCompiledData()
qDeleteAll(resolvedTypes);
resolvedTypes.clear();
- for (int ii = 0; ii < propertyCaches.count(); ++ii)
- if (propertyCaches.at(ii).data())
- propertyCaches.at(ii)->release();
-
for (int ii = 0; ii < scripts.count(); ++ii)
scripts.at(ii)->release();
if (importCache)
importCache->release();
- if (rootPropertyCache)
- rootPropertyCache->release();
+ for (int ii = 0; ii < propertyCaches.count(); ++ii)
+ if (propertyCaches.at(ii).data())
+ propertyCaches.at(ii)->release();
}
void QQmlCompiledData::clear()
@@ -112,7 +109,7 @@ QQmlPropertyCache *QQmlCompiledData::TypeReference::propertyCache() const
if (type)
return typePropertyCache;
else
- return component->rootPropertyCache;
+ return component->rootPropertyCache();
}
/*!
@@ -127,7 +124,7 @@ QQmlPropertyCache *QQmlCompiledData::TypeReference::createPropertyCache(QQmlEngi
typePropertyCache->addref();
return typePropertyCache;
} else {
- return component->rootPropertyCache;
+ return component->rootPropertyCache();
}
}
@@ -149,7 +146,7 @@ void QQmlCompiledData::TypeReference::doDynamicTypeCheck()
else if (type)
mo = type->metaObject();
else if (component)
- mo = component->rootPropertyCache->firstCppMetaObject();
+ mo = component->rootPropertyCache()->firstCppMetaObject();
isFullyDynamicType = qtTypeInherits<QQmlPropertyMap>(mo);
}
diff --git a/src/qml/qml/qqmlcompiler_p.h b/src/qml/qml/qqmlcompiler_p.h
index 42b73fcaf5..c2b244f5e3 100644
--- a/src/qml/qml/qqmlcompiler_p.h
+++ b/src/qml/qml/qqmlcompiler_p.h
@@ -126,7 +126,7 @@ public:
// map from name index
QHash<int, TypeReference*> resolvedTypes;
- QQmlPropertyCache *rootPropertyCache;
+ QQmlPropertyCache *rootPropertyCache() const { return propertyCaches.at(compilationUnit->data->indexOfRootObject).data(); }
QQmlPropertyCacheVector propertyCaches;
QList<QQmlScriptData *> scripts;
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 99ae367773..2baca619cc 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -2227,7 +2227,7 @@ QQmlMetaObject QQmlEnginePrivate::rawMetaObjectForType(int t) const
Locker locker(this);
QHash<int, QQmlCompiledData *>::ConstIterator iter = m_compositeTypes.constFind(t);
if (iter != m_compositeTypes.cend()) {
- return QQmlMetaObject((*iter)->rootPropertyCache);
+ return QQmlMetaObject((*iter)->rootPropertyCache());
} else {
QQmlType *type = QQmlMetaType::qmlType(t);
return QQmlMetaObject(type?type->baseMetaObject():0);
@@ -2239,7 +2239,7 @@ QQmlMetaObject QQmlEnginePrivate::metaObjectForType(int t) const
Locker locker(this);
QHash<int, QQmlCompiledData *>::ConstIterator iter = m_compositeTypes.constFind(t);
if (iter != m_compositeTypes.cend()) {
- return QQmlMetaObject((*iter)->rootPropertyCache);
+ return QQmlMetaObject((*iter)->rootPropertyCache());
} else {
QQmlType *type = QQmlMetaType::qmlType(t);
return QQmlMetaObject(type?type->metaObject():0);
@@ -2251,7 +2251,7 @@ QQmlPropertyCache *QQmlEnginePrivate::propertyCacheForType(int t)
Locker locker(this);
QHash<int, QQmlCompiledData*>::ConstIterator iter = m_compositeTypes.constFind(t);
if (iter != m_compositeTypes.cend()) {
- return (*iter)->rootPropertyCache;
+ return (*iter)->rootPropertyCache();
} else {
QQmlType *type = QQmlMetaType::qmlType(t);
locker.unlock();
@@ -2264,7 +2264,7 @@ QQmlPropertyCache *QQmlEnginePrivate::rawPropertyCacheForType(int t)
Locker locker(this);
QHash<int, QQmlCompiledData*>::ConstIterator iter = m_compositeTypes.constFind(t);
if (iter != m_compositeTypes.cend()) {
- return (*iter)->rootPropertyCache;
+ return (*iter)->rootPropertyCache();
} else {
QQmlType *type = QQmlMetaType::qmlType(t);
locker.unlock();
@@ -2274,7 +2274,7 @@ QQmlPropertyCache *QQmlEnginePrivate::rawPropertyCacheForType(int t)
void QQmlEnginePrivate::registerInternalCompositeType(QQmlCompiledData *data)
{
- QByteArray name = data->rootPropertyCache->className();
+ QByteArray name = data->rootPropertyCache()->className();
QByteArray ptr = name + '*';
QByteArray lst = "QQmlListProperty<" + name + '>';
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index 1c5a7ad8c1..f3f4c41775 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -494,7 +494,7 @@ QQmlType *QQmlType::resolveCompositeBaseType(QQmlEnginePrivate *engine) const
if (!td || !td->isComplete())
return 0;
QQmlCompiledData *cd = td->compiledData();
- const QMetaObject *mo = cd->rootPropertyCache->firstCppMetaObject();
+ const QMetaObject *mo = cd->rootPropertyCache()->firstCppMetaObject();
return QQmlMetaType::qmlType(mo);
}