From e20650e0702259b4be79be85a3d27e45db42efc1 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 17 May 2021 16:38:25 +0200 Subject: Eliminate JS call frame from metatypes calls If we call an AOT-compiled function we never need the JavaScript call frame. We can just skip its setup and save some overhead. Change-Id: I39dc2ca6eea5b5a66f3b87b642a310534cecf6cd Reviewed-by: Fabian Kosmale --- src/qml/jsruntime/qv4function.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/qml/jsruntime/qv4function.cpp') diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp index db767085da..7b5685a2a0 100644 --- a/src/qml/jsruntime/qv4function.cpp +++ b/src/qml/jsruntime/qv4function.cpp @@ -57,8 +57,8 @@ QT_BEGIN_NAMESPACE using namespace QV4; -bool Function::call(const Value *thisObject, void **a, const QMetaType *types, int argc, - const ExecutionContext *context) +bool Function::call(QObject *thisObject, void **a, const QMetaType *types, int argc, + ExecutionContext *context) { if (!aotFunction) { return QV4::convertAndCall( @@ -70,21 +70,19 @@ bool Function::call(const Value *thisObject, void **a, const QMetaType *types, i ExecutionEngine *engine = context->engine(); MetaTypesStackFrame frame; - frame.init(this, a, types, argc); - frame.setupJSFrame(engine->jsStackTop, Value::undefinedValue(), context->d(), - thisObject ? *thisObject : Value::undefinedValue()); + frame.init(this, thisObject, context, a, types, argc); frame.push(engine); - engine->jsStackTop += frame.requiredJSStackFrameSize(); Moth::VME::exec(&frame, engine); frame.pop(engine); return true; } -ReturnedValue Function::call(const Value *thisObject, const Value *argv, int argc, const ExecutionContext *context) { +ReturnedValue Function::call( + const Value *thisObject, const Value *argv, int argc, ExecutionContext *context) { if (aotFunction) { return QV4::convertAndCall( context->engine(), aotFunction, thisObject, argv, argc, - [this, context](const Value *thisObject, + [this, context](QObject *thisObject, void **a, const QMetaType *types, int argc) { call(thisObject, a, types, argc, context); }); -- cgit v1.2.3