aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp9
-rw-r--r--src/qml/qml/qqml.cpp7
-rw-r--r--src/qml/qml/qqmlprivate.h12
-rw-r--r--src/qml/qml/qqmlpropertybinding.cpp11
4 files changed, 31 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index 9fefa2a38c..bea301c6e3 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -489,9 +489,12 @@ ReturnedValue VME::exec(CppStackFrame *frame, ExecutionEngine *engine)
Scope scope(engine);
Scoped<QmlContext> qmlContext(scope, engine->qmlContext());
- function->aotFunction->functionPtr(
- qmlContext->qmlContext()->asQQmlContext(), qmlContext->qmlScope(),
- returnValue, argumentPtrs);
+ QQmlPrivate::AOTCompiledContext aotContext;
+ aotContext.qmlContext = qmlContext ? qmlContext->qmlContext()->asQQmlContext() : nullptr;
+ aotContext.qmlScopeObject = qmlContext ? qmlContext->qmlScope() : nullptr;
+ aotContext.engine = engine->jsEngine();
+ aotContext.compilationUnit = function->executableCompilationUnit();
+ function->aotFunction->functionPtr(&aotContext, returnValue, argumentPtrs);
if (returnValue) {
result = engine->metaTypeToJS(returnType.id(), returnValue);
diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp
index 40e629284b..9e71c968b8 100644
--- a/src/qml/qml/qqml.cpp
+++ b/src/qml/qml/qqml.cpp
@@ -41,6 +41,7 @@
#include <QtQml/qqmlprivate.h>
+#include <private/qjsvalue_p.h>
#include <private/qqmlengine_p.h>
#include <private/qqmlmetatype_p.h>
#include <private/qqmlmetatypedata_p.h>
@@ -561,4 +562,10 @@ namespace QQmlPrivate {
}
}
+QJSValue QQmlPrivate::AOTCompiledContext::jsMetaType(int index) const
+{
+ return QJSValuePrivate::fromReturnedValue(
+ compilationUnit->runtimeClasses[index]->asReturnedValue());
+}
+
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h
index a2cd9452ac..ce83b33eaa 100644
--- a/src/qml/qml/qqmlprivate.h
+++ b/src/qml/qml/qqmlprivate.h
@@ -589,12 +589,20 @@ namespace QQmlPrivate
QVector<int> *qmlTypeIds;
};
+ struct AOTCompiledContext {
+ QQmlContext *qmlContext;
+ QObject *qmlScopeObject;
+ QJSEngine *engine;
+ QV4::CompiledData::CompilationUnit *compilationUnit;
+
+ QJSValue Q_QML_EXPORT jsMetaType(int index) const;
+ };
+
struct AOTCompiledFunction {
int index;
QMetaType returnType;
QList<QMetaType> argumentTypes;
- void (*functionPtr)(QQmlContext *context, QObject *scopeObject, void *resultPtr,
- void **arguments);
+ void (*functionPtr)(const AOTCompiledContext *context, void *resultPtr, void **arguments);
};
struct CachedQmlUnit {
diff --git a/src/qml/qml/qqmlpropertybinding.cpp b/src/qml/qml/qqmlpropertybinding.cpp
index 235d9f578f..eaf3524487 100644
--- a/src/qml/qml/qqmlpropertybinding.cpp
+++ b/src/qml/qml/qqmlpropertybinding.cpp
@@ -52,10 +52,15 @@ QUntypedPropertyBinding QQmlPropertyBinding::create(const QQmlPropertyData *pd,
aotFunction,
unit = QQmlRefPointer<QV4::ExecutableCompilationUnit>(function->executableCompilationUnit()),
scopeObject = QPointer<QObject>(obj),
- context = ctxt
+ context = ctxt,
+ engine = scope->engine()
](const QMetaType &, void *dataPtr) -> bool {
- Q_UNUSED(unit); // to keep refcount
- aotFunction->functionPtr(context->asQQmlContext(), scopeObject.data(), dataPtr, nullptr);
+ QQmlPrivate::AOTCompiledContext aotContext;
+ aotContext.qmlContext = context->asQQmlContext();
+ aotContext.qmlScopeObject = scopeObject.data();
+ aotContext.engine = engine->jsEngine();
+ aotContext.compilationUnit = unit.data();
+ aotFunction->functionPtr(&aotContext, dataPtr, nullptr);
// ### Fixme: The aotFunction should do the check whether old and new value are the same and
// return false in that case
return true;