From b853a1e1b003d4dc01884201c09c2fcbf75f2cf6 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sat, 21 Oct 2017 16:18:07 +0200 Subject: Remove one indirection when doing JS calls Change-Id: Idcc313903b1ac39f6ab8914751fa8bf3f6269115 Reviewed-by: Erik Verbruggen --- src/qml/jsruntime/qv4functionobject.cpp | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 30ece800f6..bd8bb9c8fb 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -70,21 +70,10 @@ DEFINE_OBJECT_VTABLE(FunctionObject); Q_STATIC_ASSERT((Heap::FunctionObject::markTable & Heap::Object::markTable) == Heap::Object::markTable); -static ReturnedValue jsCallWrapper(const QV4::FunctionObject *f, const Value *thisObject, const Value *argv, int argc) -{ - return f->vtable()->call(f, thisObject, argv, argc); -} -ReturnedValue jsConstructWrapper(const QV4::FunctionObject *f, const Value *argv, int argc) -{ - return f->vtable()->callAsConstructor(f, argv, argc); -} - - - void Heap::FunctionObject::init(QV4::ExecutionContext *scope, QV4::String *name, bool createProto) { - jsCall = jsCallWrapper; - jsConstruct = jsConstructWrapper; + jsCall = reinterpret_cast(vtable())->call; + jsConstruct = reinterpret_cast(vtable())->callAsConstructor; Object::init(); function = nullptr; @@ -96,8 +85,8 @@ void Heap::FunctionObject::init(QV4::ExecutionContext *scope, QV4::String *name, void Heap::FunctionObject::init(QV4::ExecutionContext *scope, Function *function, bool createProto) { - jsCall = jsCallWrapper; - jsConstruct = jsConstructWrapper; + jsCall = reinterpret_cast(vtable())->call; + jsConstruct = reinterpret_cast(vtable())->callAsConstructor; Object::init(); this->function = function; @@ -118,8 +107,8 @@ void Heap::FunctionObject::init(QV4::ExecutionContext *scope, const QString &nam void Heap::FunctionObject::init() { - jsCall = jsCallWrapper; - jsConstruct = jsConstructWrapper; + jsCall = reinterpret_cast(vtable())->call; + jsConstruct = reinterpret_cast(vtable())->callAsConstructor; Object::init(); function = nullptr; -- cgit v1.2.3