From 365b781599993aef933228599eaeb6eb909d9a93 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 17 Apr 2023 14:12:05 +0200 Subject: 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 --- src/qml/qml/qqml.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/qml/qml/qqml.cpp') 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( qmlregister(TypeAndRevisionsRegistration, &type); } +QObject *AOTCompiledContext::thisObject() const +{ + return static_cast(engine->handle()->currentStackFrame) + ->thisObject(); +} + QQmlEngine *AOTCompiledContext::qmlEngine() const { return qmlContext ? qmlContext->engine() : nullptr; -- cgit v1.2.3