aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4engine.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-03-24 17:33:43 +0100
committerUlf Hermann <ulf.hermann@qt.io>2021-03-25 11:31:09 +0100
commit8fe127129b4f31e7e13dbf727687d98b95984763 (patch)
treee43d2f018d4feee2381d63e12714fd858cad0d97 /src/qml/jsruntime/qv4engine.cpp
parentfc636af3a723ee8b4ee42cf71864ae0df5ca4621 (diff)
Inline retrieval of QML contexts
In the good case this is just reading a few members of the relevant classes. No need to call functions for this. Change-Id: I9908cd6437cf9a1ca840f9aa0e524d3976272d67 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r--src/qml/jsruntime/qv4engine.cpp21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 556409b2fc..4fde6a4d77 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -1206,24 +1206,9 @@ Heap::Object *ExecutionEngine::newArrayIteratorObject(Object *o)
Heap::QmlContext *ExecutionEngine::qmlContext() const
{
- if (!currentStackFrame)
- return nullptr;
- Heap::ExecutionContext *ctx = currentContext()->d();
- Heap::ExecutionContext *outer = ctx->outer;
-
- if (ctx->type != Heap::ExecutionContext::Type_QmlContext && !outer)
- return nullptr;
-
- while (outer && outer->type != Heap::ExecutionContext::Type_GlobalContext) {
- ctx = outer;
- outer = ctx->outer;
- }
-
- Q_ASSERT(ctx);
- if (ctx->type != Heap::ExecutionContext::Type_QmlContext)
- return nullptr;
-
- return static_cast<Heap::QmlContext *>(ctx);
+ return currentStackFrame
+ ? static_cast<Heap::QmlContext *>(qmlContext(currentContext()->d()))
+ : nullptr;
}
QObject *ExecutionEngine::qmlScopeObject() const