aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqml.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-04-19 14:26:59 +0200
committerUlf Hermann <ulf.hermann@qt.io>2021-04-19 20:24:20 +0200
commit092cf238916ae371dee31e5cc660a492fb58d0c4 (patch)
tree9dfcbeb9ea7cedff1cb056fbed72b3861618a84a /src/qml/qml/qqml.cpp
parent48b1c59b65332b773eb51d25c422b53dbd3d6762 (diff)
Optimize property capture for known property caches
If we already know the property cache and data we don't have to look them up again in captureProperty(). Such lookups can be expensive. Change-Id: I94553260311912c5acee3105295f124721203e01 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqml.cpp')
-rw-r--r--src/qml/qml/qqml.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp
index 88fad02d1d..a0fbe507fd 100644
--- a/src/qml/qml/qqml.cpp
+++ b/src/qml/qml/qqml.cpp
@@ -726,10 +726,8 @@ bool QQmlPrivate::AOTCompiledContext::captureQmlContextPropertyLookup(uint index
if (QQmlEngine *engine = qmlContext->engine()) {
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
- if (!ep->propertyCapture)
- return true;
- ep->propertyCapture->captureProperty(qmlScopeObject, property->coreIndex(),
- property->notifyIndex());
+ if (QQmlPropertyCapture *capture = ep->propertyCapture)
+ capture->captureProperty(qmlScopeObject, l->qobjectLookup.propertyCache, property);
}
return true;
@@ -746,8 +744,8 @@ QObject *QQmlPrivate::AOTCompiledContext::loadQmlContextPropertyIdLookup(uint in
QQmlEnginePrivate *qmlEngine = QQmlEnginePrivate::get(qmlContext->engine());
const int objectId = l->qmlContextIdObjectLookup.objectId;
- if (qmlEngine->propertyCapture)
- qmlEngine->propertyCapture->captureProperty(qmlContext->idValueBindings(objectId));
+ if (QQmlPropertyCapture *capture = qmlEngine->propertyCapture)
+ capture->captureProperty(qmlContext->idValueBindings(objectId));
return qmlContext->idValue(objectId);
}
@@ -765,19 +763,18 @@ bool QQmlPrivate::AOTCompiledContext::getObjectLookup(
if (!object)
return false;
+ const QQmlPropertyCache *propertyCache = l->qobjectLookup.propertyCache;
if (l->getter == QV4::QObjectWrapper::lookupGetter
&& !QQmlData::wasDeleted(object)
- && QQmlData::get(object)->propertyCache == l->qobjectLookup.propertyCache) {
- QQmlPropertyData *property = l->qobjectLookup.propertyData;
+ && QQmlData::get(object)->propertyCache == propertyCache) {
+ const QQmlPropertyData *property = l->qobjectLookup.propertyData;
if (property->propType() == type) {
// We can directly read the property into the target, without conversion.
if (!property->isConstant()) {
if (QQmlEngine *engine = qmlContext->engine()) {
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
- if (ep->propertyCapture) {
- ep->propertyCapture->captureProperty(object, property->coreIndex(),
- property->notifyIndex());
- }
+ if (QQmlPropertyCapture *capture = ep->propertyCapture)
+ capture->captureProperty(object, propertyCache, property);
}
}
property->readProperty(object, target);
@@ -832,17 +829,15 @@ bool QQmlPrivate::AOTCompiledContext::captureLookup(uint index, QObject *object)
return false;
}
- const auto *property = l->qobjectLookup.propertyData;
+ const QQmlPropertyData *property = l->qobjectLookup.propertyData;
Q_ASSERT(property);
if (property->isConstant())
return true;
if (QQmlEngine *engine = qmlContext->engine()) {
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
- if (!ep->propertyCapture)
- return true;
- ep->propertyCapture->captureProperty(object, property->coreIndex(),
- property->notifyIndex());
+ if (QQmlPropertyCapture *capture = ep->propertyCapture)
+ capture->captureProperty(object, l->qobjectLookup.propertyCache, property);
return true;
}