aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4runtime.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2018-08-24 15:41:53 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2018-10-04 11:35:54 +0000
commit1c61e70a0c0f1718c538c04dcc80dd3039ccd384 (patch)
tree9be7d80be0bb8d00ee6b8f9500c7e4805ef3662e /src/qml/jsruntime/qv4runtime.cpp
parentb2610d9d04c2a65d60b36ebf43e3a8d469c0397a (diff)
ES7: Detect Tail Position Calls and pass that to the runtime
Doing the tail call in the runtime will come in a follow-up patch Change-Id: I8224aac0edbdc765ee9b97703948edd52fd33f3e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 7b1a38ff06..470629bd1f 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -1061,8 +1061,6 @@ ReturnedValue Runtime::method_loadSuperConstructor(ExecutionEngine *engine, cons
return c->asReturnedValue();
}
-
-
#endif // V4_BOOTSTRAP
uint RuntimeHelpers::equalHelper(const Value &x, const Value &y)
@@ -1538,6 +1536,15 @@ ReturnedValue Runtime::method_constructWithSpread(ExecutionEngine *engine, const
return static_cast<const FunctionObject &>(function).callAsConstructor(arguments.argv, arguments.argc, &newTarget);
}
+ReturnedValue Runtime::method_tailCall(ExecutionEngine *engine, const Value &function, const Value &thisObject, Value *argv, int argc)
+{
+ //### unwinding the stack, etc, is done in a subsequent patch
+ if (!function.isFunctionObject())
+ return engine->throwTypeError();
+
+ return static_cast<const FunctionObject &>(function).call(&thisObject, argv, argc);
+}
+
void Runtime::method_throwException(ExecutionEngine *engine, const Value &value)
{
if (!value.isEmpty())