aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4functionobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-10-24 14:57:53 +0200
committerLars Knoll <lars.knoll@qt.io>2017-11-13 08:56:11 +0000
commit831ddc54932d2681712ca9fa3e94484ae11d59f7 (patch)
tree0cf4ad8756d9cae65f3c57f1c77c946eaf1f5749 /src/qml/jsruntime/qv4functionobject.cpp
parentd9b0878595e7ee2698ddc8c724657574d5fe4d4c (diff)
Cut out one more C++ layer when doing JS function calls
Change-Id: I0e2ac30b7e6d77fe41deb84a97b0a7f220437c6a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index bd8bb9c8fb..1f86672a62 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -367,35 +367,21 @@ ReturnedValue ScriptFunction::callAsConstructor(const FunctionObject *fo, const
const ScriptFunction *f = static_cast<const ScriptFunction *>(fo);
Scope scope(v4);
- JSCallData callData(scope, argc, argv);
- CallData *cData = callData.callData(f);
InternalClass *ic = f->classForConstructor();
- cData->context = f->scope();
- cData->thisObject = v4->memoryManager->allocObject<Object>(ic);
+ ScopedValue thisObject(scope, v4->memoryManager->allocObject<Object>(ic));
- QV4::Function *v4Function = f->function();
- Q_ASSERT(v4Function);
-
- ReturnedValue result = v4Function->call(cData);
+ ReturnedValue result = Moth::VME::exec(fo, thisObject, argv, argc);
if (Q_UNLIKELY(v4->hasException))
return Encode::undefined();
else if (!Value::fromReturnedValue(result).isObject())
- return cData->thisObject.asReturnedValue();
+ return thisObject->asReturnedValue();
return result;
}
ReturnedValue ScriptFunction::call(const FunctionObject *fo, const Value *thisObject, const Value *argv, int argc)
{
- const ScriptFunction *f = static_cast<const ScriptFunction *>(fo);
- Scope scope(f->engine());
- JSCallData callData(scope, argc, argv, thisObject);
- CallData *cData = callData.callData(f);
- cData->context = f->scope();
-
- QV4::Function *v4Function = f->function();
- Q_ASSERT(v4Function);
- return v4Function->call(cData);
+ return Moth::VME::exec(fo, thisObject, argv, argc);
}
void Heap::ScriptFunction::init(QV4::ExecutionContext *scope, Function *function)