aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqml.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-04-17 14:12:05 +0200
committerUlf Hermann <ulf.hermann@qt.io>2023-04-25 16:53:00 +0200
commit365b781599993aef933228599eaeb6eb909d9a93 (patch)
tree5c8ef6bd3a8908d629e0939516a3c56efb7d1c18 /src/qml/qml/qqml.cpp
parentd664cb4845f8b5c79ce34bb963312b18cce7452f (diff)
QmlCompiler: Implement ConvertThisToObject and basic DTZ
We know that 'this' is a QObject* since the metatypes stack frame mandates it. Whenever you pass 'this' to anything it's loaded from the special 'This' stack slot which then triggers a DTZ check. A DTZ check is a noop if we can prove that the type is statically known, though. In QmlCompiler, if we have a valid register content, then the register has been set in all code paths that lead to the instruction in question. Fixes: QTBUG-111439 Change-Id: I81d1cd140eea63f85628c3bef3a8f6db0a12096d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqml.cpp')
-rw-r--r--src/qml/qml/qqml.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp
index d258ace774..7bbfe39ae9 100644
--- a/src/qml/qml/qqml.cpp
+++ b/src/qml/qml/qqml.cpp
@@ -804,6 +804,12 @@ void qmlRegisterTypeAndRevisions<QQmlTypeNotAvailable, void>(
qmlregister(TypeAndRevisionsRegistration, &type);
}
+QObject *AOTCompiledContext::thisObject() const
+{
+ return static_cast<QV4::MetaTypesStackFrame *>(engine->handle()->currentStackFrame)
+ ->thisObject();
+}
+
QQmlEngine *AOTCompiledContext::qmlEngine() const
{
return qmlContext ? qmlContext->engine() : nullptr;