diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-03-11 12:37:37 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-03-13 12:56:47 +0100 |
commit | 490257d44706862500c11d9a05b476c234c260e7 (patch) | |
tree | 55d6d636ee346491894e3da11fc48c81b747dddf /src/qml/jsruntime/qv4vme_moth.cpp | |
parent | eb2386a04260966c5d1f13941f7a10154e11625a (diff) |
Optimize QML context retrieval for AOT functions
We can cache the QQmlContextWrapper rather than retrieving it twice.
Inline some things, and do not unnecessarily create and destroy ref
pointers.
Change-Id: Ife0980f83b7efe1ea9dc56aacbfbccd029ce77c8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4vme_moth.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4vme_moth.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index f606f8152d..739dc4b7ba 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -490,11 +490,12 @@ ReturnedValue VME::exec(CppStackFrame *frame, ExecutionEngine *engine) if (const qsizetype returnSize = returnType.sizeOf()) Q_ALLOCA_ASSIGN(void, returnValue, returnSize); - Scope scope(engine); - Scoped<QmlContext> qmlContext(scope, engine->qmlContext()); QQmlPrivate::AOTCompiledContext aotContext; - aotContext.qmlContext = qmlContext ? qmlContext->qmlContext()->asQQmlContext() : nullptr; - aotContext.qmlScopeObject = qmlContext ? qmlContext->qmlScope() : nullptr; + if (QV4::Heap::QmlContext *qmlContext = engine->qmlContext()) { + QV4::Heap::QQmlContextWrapper *wrapper = qmlContext->qml(); + aotContext.qmlScopeObject = wrapper->scopeObject; + aotContext.qmlContext = wrapper->context->asQQmlContext(); + } aotContext.engine = engine->jsEngine(); aotContext.compilationUnit = function->executableCompilationUnit(); function->aotFunction->functionPtr(&aotContext, returnValue, argumentPtrs); |