aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4runtime.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-08-21 17:31:22 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-02 17:27:36 +0200
commit6f472680ebecb3a4d700eedcf62cb423b05c4fd1 (patch)
treebc732911a9c353dbac232ebda5a94468e3e261fe /src/qml/jsruntime/qv4runtime.cpp
parentda2f24d8e5c32fe4ed45dcb89aa357465f85fc1e (diff)
change calling convention for JS function calls
This allows faster pass through of the data if we have nested calls. Also make sure we always reserve at least QV4::Global::ReservedArgumentCount Values on the stack to avoid stack corruption. Change-Id: I42976460f1ef11a333d4adda70fba8daac66acf3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp66
1 files changed, 52 insertions, 14 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 8d28979b60..f145050f17 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -446,14 +446,18 @@ Value __qmljs_object_default_value(Object *object, int typeHint)
Value conv = object->get(meth1);
if (FunctionObject *o = conv.asFunctionObject()) {
- Value r = o->call(Value::fromObject(object), 0, 0);
+ CALLDATA(0);
+ d.thisObject = Value::fromObject(object);
+ Value r = o->call(d);
if (r.isPrimitive())
return r;
}
conv = object->get(meth2);
if (FunctionObject *o = conv.asFunctionObject()) {
- Value r = o->call(Value::fromObject(object), 0, 0);
+ CALLDATA(0);
+ d.thisObject = Value::fromObject(object);
+ Value r = o->call(d);
if (r.isPrimitive())
return r;
}
@@ -600,9 +604,10 @@ void __qmljs_set_element(ExecutionContext *ctx, const Value &object, const Value
return;
}
- Value args[1];
- args[0] = value;
- setter->call(Value::fromObject(o), args, 1);
+ CALLDATA(1);
+ d.args[0] = value;
+ d.thisObject = Value::fromObject(o);
+ setter->call(d);
return;
}
}
@@ -730,7 +735,11 @@ void __qmljs_call_global_lookup(ExecutionContext *context, Value *result, uint i
return;
}
- Value res = o->call(thisObject, args, argc);
+ CallData d;
+ d.thisObject = thisObject;
+ d.args = args;
+ d.argc = argc;
+ Value res = o->call(d);
if (result)
*result = res;
}
@@ -758,7 +767,11 @@ void __qmljs_call_activation_property(ExecutionContext *context, Value *result,
return;
}
- Value res = o->call(thisObject, args, argc);
+ CallData d;
+ d.thisObject = thisObject;
+ d.args = args;
+ d.argc = argc;
+ Value res = o->call(d);
if (result)
*result = res;
}
@@ -784,7 +797,11 @@ void __qmljs_call_property(ExecutionContext *context, Value *result, const Value
context->throwTypeError(error);
}
- Value res = o->call(thisObject, args, argc);
+ CallData d;
+ d.thisObject = thisObject;
+ d.args = args;
+ d.argc = argc;
+ Value res = o->call(d);
if (result)
*result = res;
}
@@ -807,7 +824,11 @@ void __qmljs_call_property_lookup(ExecutionContext *context, Value *result, cons
if (!o)
context->throwTypeError();
- Value res = o->call(thisObject, args, argc);
+ CallData d;
+ d.thisObject = thisObject;
+ d.args = args;
+ d.argc = argc;
+ Value res = o->call(d);
if (result)
*result = res;
}
@@ -822,7 +843,11 @@ void __qmljs_call_element(ExecutionContext *context, Value *result, const Value
if (!o)
context->throwTypeError();
- Value res = o->call(thisObject, args, argc);
+ CallData d;
+ d.thisObject = thisObject;
+ d.args = args;
+ d.argc = argc;
+ Value res = o->call(d);
if (result)
*result = res;
}
@@ -832,7 +857,11 @@ void __qmljs_call_value(ExecutionContext *context, Value *result, const Value *t
Object *o = func.asObject();
if (!o)
context->throwTypeError();
- Value res = o->call(thisObject ? *thisObject : Value::undefinedValue(), args, argc);
+ CallData d;
+ d.thisObject = thisObject ? *thisObject : Value::undefinedValue();
+ d.args = args;
+ d.argc = argc;
+ Value res = o->call(d);
if (result)
*result = res;
}
@@ -845,7 +874,10 @@ void __qmljs_construct_global_lookup(ExecutionContext *context, Value *result, u
l->globalGetter(l, context, &func);
if (Object *f = func.asObject()) {
- Value res = f->construct(args, argc);
+ CallData d;
+ d.args = args;
+ d.argc = argc;
+ Value res = f->construct(d);
if (result)
*result = res;
return;
@@ -864,7 +896,10 @@ void __qmljs_construct_activation_property(ExecutionContext *context, Value *res
void __qmljs_construct_value(ExecutionContext *context, Value *result, const Value &func, Value *args, int argc)
{
if (Object *f = func.asObject()) {
- Value res = f->construct(args, argc);
+ CallData d;
+ d.args = args;
+ d.argc = argc;
+ Value res = f->construct(d);
if (result)
*result = res;
return;
@@ -879,7 +914,10 @@ void __qmljs_construct_property(ExecutionContext *context, Value *result, const
Value func = thisObject->get(name);
if (Object *f = func.asObject()) {
- Value res = f->construct(args, argc);
+ CallData d;
+ d.args = args;
+ d.argc = argc;
+ Value res = f->construct(d);
if (result)
*result = res;
return;