aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4function.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-09 16:02:55 +0200
committerLars Knoll <lars.knoll@qt.io>2017-08-10 08:19:59 +0000
commit6a91dcba2e4fa85dc345c2d403c757ab7676e28c (patch)
tree502b483cd437f4a1a039717af0a59e493d40f7a2 /src/qml/jsruntime/qv4function.cpp
parent5571b666e6b9534a55347adcd249fa07b2e25c01 (diff)
Always create a valid CallData object for interpreter calls
This will allow removing a few more special cases and to simplify the code further. Change-Id: I3a958e9f68e3c103ea4f2ee6825f893e5931b11d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4function.cpp')
-rw-r--r--src/qml/jsruntime/qv4function.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp
index bcc776dc98..78fb46327a 100644
--- a/src/qml/jsruntime/qv4function.cpp
+++ b/src/qml/jsruntime/qv4function.cpp
@@ -38,12 +38,14 @@
****************************************************************************/
#include "qv4function_p.h"
+#include "qv4functionobject_p.h"
#include "qv4managed_p.h"
#include "qv4string_p.h"
#include "qv4value_p.h"
#include "qv4engine_p.h"
#include "qv4lookup_p.h"
#include <private/qv4mm_p.h>
+#include <private/qqmljavascriptexpression_p.h>
QT_BEGIN_NAMESPACE
@@ -117,4 +119,26 @@ void Function::updateInternalClass(ExecutionEngine *engine, const QList<QByteArr
canUseSimpleCall = false;
}
+
+// Do a call with this execution context as the outer scope
+ReturnedValue Function::call(const FunctionObject *f, CallData *callData, Heap::ExecutionContext *context, Function *function)
+{
+ ExecutionEngine *engine = context->internalClass->engine;
+
+ if (!function->canUseSimpleCall) {
+ context = ExecutionContext::newCallContext(context, function, callData);
+ if (f)
+ static_cast<Heap::CallContext *>(context)->function.set(engine, f->d());
+ }
+
+ ReturnedValue res = function->execute(context, callData, f);
+
+ if (function->hasQmlDependencies) {
+ Q_ASSERT(context->type == Heap::ExecutionContext::Type_QmlContext);
+ QQmlPropertyCapture::registerQmlDependencies(static_cast<Heap::QmlContext *>(context), engine, function->compiledFunction);
+ }
+
+ return res;
+}
+
QT_END_NAMESPACE