aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4vme_moth.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2020-04-15 09:17:02 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2020-04-22 09:54:02 +0200
commitca1098ec1ef83589a78178eee3d28faa7d067017 (patch)
treebb541620259b76e39f9d2c3fa5cfaacb86d8bb5c /src/qml/jsruntime/qv4vme_moth.cpp
parent28a31148ca02dbb530fd92dfafbcf71c64af4b70 (diff)
Add support for binding ahead-of-time compiled bindings to QProperties
When the ahead-of-time built binding returns the same type as the QProperty, then we can connect them directly with a small shim and pass through the context and scope objects. Change-Id: I9cb49d1fa35490a4ccb06965397674d5534c067d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4vme_moth.cpp')
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index fb103d492d..7772b34c82 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -58,6 +58,7 @@
#include <private/qv4generatorobject_p.h>
#include <private/qv4alloca_p.h>
#include <private/qqmljavascriptexpression_p.h>
+#include <private/qv4qmlcontext_p.h>
#include <iostream>
#if QT_CONFIG(qml_jit)
@@ -458,6 +459,13 @@ ReturnedValue VME::exec(CppStackFrame *frame, ExecutionEngine *engine)
ReturnedValue result;
if (function->jittedCode != nullptr && debugger == nullptr) {
result = function->jittedCode(frame, engine);
+ } else if (function->aotFunction) {
+ Scope scope(engine);
+ Scoped<QmlContext> qmlContext(scope, engine->qmlContext());
+
+ QVariant resultVariant(function->aotFunction->returnType.id(), nullptr);
+ function->aotFunction->functionPtr(qmlContext->qmlContext()->asQQmlContext(), qmlContext->qmlScope(), resultVariant.data());
+ result = engine->fromVariant(resultVariant);
} else {
// interpreter
result = interpret(frame, engine, function->codeData);