aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-10-21 16:18:07 +0200
committerLars Knoll <lars.knoll@qt.io>2017-11-07 21:07:49 +0000
commitb853a1e1b003d4dc01884201c09c2fcbf75f2cf6 (patch)
tree8b6e613e03bff33932ea1e3e4e0f5643989e03a2
parent6e3317bb171c718250bbb736567fc0e4812a6241 (diff)
Remove one indirection when doing JS calls
Change-Id: Idcc313903b1ac39f6ab8914751fa8bf3f6269115 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp23
1 files 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<const ObjectVTable *>(vtable())->call;
+ jsConstruct = reinterpret_cast<const ObjectVTable *>(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<const ObjectVTable *>(vtable())->call;
+ jsConstruct = reinterpret_cast<const ObjectVTable *>(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<const ObjectVTable *>(vtable())->call;
+ jsConstruct = reinterpret_cast<const ObjectVTable *>(vtable())->callAsConstructor;
Object::init();
function = nullptr;