aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqml.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-09-16 12:08:06 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-09-20 10:03:56 +0200
commit17bd07cbc5b6cf54716e991765ab3088a710d7b3 (patch)
tree64f0840f9a4da790c37f9a78992a39cfba19c1ae /src/qml/qml/qqml.cpp
parenta2db40e6c070017960b9f815c66cab354e3466dc (diff)
QML: Optimize QObject method calls
So far, for each method call we had to allocate a new QObjectMethod as we didn't have any lookup to cache the methods. Introduce a new lookup for that and use it for all QObject methods. Since QObjectMethod contains a pointer to the concrete QObject the method was retrieved from, some more care has to be taken: If we are going to call the method right away, we don't need the object since we always have a thisObject and any further retrieval of the same method will result in a call again. This enables us to cache the method for any instance of the same class. When storing the method elsewhere, though, we need to hold on to the object since you can defer the call or connect a handler to a signal or similar. For such operations we do need the object. We can still optimize a bit by re-using the method cache we build the first time around. Fixes: QTBUG-95628 Change-Id: I5991180c5e0234cdc179c2b78a43dafc9083e525 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqml.cpp')
-rw-r--r--src/qml/qml/qqml.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp
index 7cd61e3f8d..81416b6a0d 100644
--- a/src/qml/qml/qqml.cpp
+++ b/src/qml/qml/qqml.cpp
@@ -1168,6 +1168,7 @@ void AOTCompiledContext::storeNameSloppy(uint nameIndex, void *value, QMetaType
QV4::Lookup l;
l.clear();
l.nameIndex = nameIndex;
+ l.forCall = false;
ObjectPropertyResult storeResult = ObjectPropertyResult::NeedsInit;
switch (initObjectLookup(this, &l, qmlScopeObject, QMetaType())) {
case ObjectLookupResult::Object: {
@@ -1242,7 +1243,7 @@ bool AOTCompiledContext::callQmlContextPropertyLookup(
return false;
}
- function->call(nullptr, args, types, argc);
+ function->call(qmlScopeObject, args, types, argc);
return !scope.hasException();
}