diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2021-05-17 16:38:25 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-06-10 11:53:19 +0200 |
| commit | e20650e0702259b4be79be85a3d27e45db42efc1 (patch) | |
| tree | 7536cee98f4cc502774f807d1a609940cd20d4f5 /src/qml/jsruntime/qv4functionobject.cpp | |
| parent | 7fa28f98824a94396106eadfc028b329985a0cfc (diff) | |
| download | qtdeclarative-e20650e0702259b4be79be85a3d27e45db42efc1.tar.gz | |
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 <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index d3bafbe055..779d975cba 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -161,7 +161,7 @@ void FunctionObject::createDefaultPrototypeProperty(uint protoConstructorSlot) defineDefaultProperty(s.engine->id_prototype(), proto, Attr_NotEnumerable|Attr_NotConfigurable); } -void FunctionObject::call(const Value *thisObject, void **a, const QMetaType *types, int argc) +void FunctionObject::call(QObject *thisObject, void **a, const QMetaType *types, int argc) { if (const auto callWithMetaTypes = d()->jsCallWithMetaTypes) { callWithMetaTypes(this, thisObject, a, types, argc); @@ -185,7 +185,7 @@ ReturnedValue FunctionObject::virtualCall(const FunctionObject *, const Value *, } void FunctionObject::virtualCallWithMetaTypes( - const FunctionObject *, const Value *, void **, const QMetaType *, int) + const FunctionObject *, QObject *, void **, const QMetaType *, int) { } @@ -532,7 +532,7 @@ ReturnedValue ScriptFunction::virtualCallAsConstructor(const FunctionObject *fo, DEFINE_OBJECT_VTABLE(ArrowFunction); -void ArrowFunction::virtualCallWithMetaTypes(const FunctionObject *fo, const Value *thisObject, +void ArrowFunction::virtualCallWithMetaTypes(const FunctionObject *fo, QObject *thisObject, void **a, const QMetaType *types, int argc) { if (!fo->function()->aotFunction) { @@ -543,16 +543,13 @@ void ArrowFunction::virtualCallWithMetaTypes(const FunctionObject *fo, const Val return; } - ExecutionEngine *engine = fo->engine(); + QV4::Scope scope(fo->engine()); + QV4::Scoped<ExecutionContext> context(scope, fo->scope()); MetaTypesStackFrame frame; - frame.init(fo->function(), a, types, argc); - frame.setupJSFrame(engine->jsStackTop, *fo, fo->scope(), - thisObject ? *thisObject : Value::undefinedValue()); - - frame.push(engine); - engine->jsStackTop += frame.requiredJSStackFrameSize(); - Moth::VME::exec(&frame, engine); - frame.pop(engine); + frame.init(fo->function(), thisObject, context, a, types, argc); + frame.push(scope.engine); + Moth::VME::exec(&frame, scope.engine); + frame.pop(scope.engine); } ReturnedValue ArrowFunction::virtualCall(const FunctionObject *fo, const Value *thisObject, const Value *argv, int argc) @@ -560,7 +557,7 @@ ReturnedValue ArrowFunction::virtualCall(const FunctionObject *fo, const Value * if (const auto *aotFunction = fo->function()->aotFunction) { return QV4::convertAndCall( fo->engine(), aotFunction, thisObject, argv, argc, - [fo](const Value *thisObject, void **a, const QMetaType *types, int argc) { + [fo](QObject *thisObject, void **a, const QMetaType *types, int argc) { ArrowFunction::virtualCallWithMetaTypes(fo, thisObject, a, types, argc); }); } |
