diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-05 13:22:23 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-11 13:01:50 +0200 |
commit | 6e8e5d16e16d6ee683a5c06a24f8f202ed5239ff (patch) | |
tree | fa8e710ad0ee4ff6cc9738fa717883c74d452b95 /src/qml/jsruntime/qv4runtime.cpp | |
parent | 736afb8e9b3694efb8ca1fa8f3a8eeeaef530da2 (diff) |
Move CallData onto the JS stack
Change-Id: I22e853acfd2da337344b581bb0412c5f9930c510
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4runtime.cpp | 80 |
1 files changed, 36 insertions, 44 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 77b11a4fa8..649baaf441 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -449,18 +449,18 @@ Value __qmljs_object_default_value(Object *object, int typeHint) Value conv = object->get(meth1); if (FunctionObject *o = conv.asFunctionObject()) { - CALLDATA(0); - d.thisObject = Value::fromObject(object); - Value r = o->call(d); + ScopedCallData callData(engine, 0); + callData->thisObject = Value::fromObject(object); + Value r = o->call(callData); if (r.isPrimitive()) return r; } conv = object->get(meth2); if (FunctionObject *o = conv.asFunctionObject()) { - CALLDATA(0); - d.thisObject = Value::fromObject(object); - Value r = o->call(d); + ScopedCallData callData(engine, 0); + callData->thisObject = Value::fromObject(object); + Value r = o->call(callData); if (r.isPrimitive()) return r; } @@ -607,10 +607,10 @@ void __qmljs_set_element(ExecutionContext *ctx, const Value &object, const Value return; } - CALLDATA(1); - d.args[0] = value; - d.thisObject = Value::fromObject(o); - setter->call(d); + ScopedCallData callData(ctx->engine, 1); + callData->thisObject = Value::fromObject(o); + callData->args[0] = value; + setter->call(callData); return; } } @@ -738,10 +738,9 @@ void __qmljs_call_global_lookup(ExecutionContext *context, Value *result, uint i return; } - CallData d; - d.thisObject = thisObject; - d.args = args; - d.argc = argc; + ScopedCallData d(context->engine, argc); + d->thisObject = thisObject; + memcpy(d->args, args, argc*sizeof(Value)); Value res = o->call(d); if (result) *result = res; @@ -770,10 +769,9 @@ void __qmljs_call_activation_property(ExecutionContext *context, Value *result, return; } - CallData d; - d.thisObject = thisObject; - d.args = args; - d.argc = argc; + ScopedCallData d(context->engine, argc); + d->thisObject = thisObject; + memcpy(d->args, args, argc*sizeof(Value)); Value res = o->call(d); if (result) *result = res; @@ -800,10 +798,9 @@ void __qmljs_call_property(ExecutionContext *context, Value *result, const Value context->throwTypeError(error); } - CallData d; - d.thisObject = thisObject; - d.args = args; - d.argc = argc; + ScopedCallData d(context->engine, argc); + d->thisObject = thisObject; + memcpy(d->args, args, argc*sizeof(Value)); Value res = o->call(d); if (result) *result = res; @@ -820,10 +817,9 @@ void __qmljs_call_property_lookup(ExecutionContext *context, Value *result, cons if (!o) context->throwTypeError(); - CallData d; - d.thisObject = thisObject; - d.args = args; - d.argc = argc; + ScopedCallData d(context->engine, argc); + d->thisObject = thisObject; + memcpy(d->args, args, argc*sizeof(Value)); Value res = o->call(d); if (result) *result = res; @@ -839,10 +835,9 @@ void __qmljs_call_element(ExecutionContext *context, Value *result, const Value if (!o) context->throwTypeError(); - CallData d; - d.thisObject = thisObject; - d.args = args; - d.argc = argc; + ScopedCallData d(context->engine, argc); + d->thisObject = thisObject; + memcpy(d->args, args, argc*sizeof(Value)); Value res = o->call(d); if (result) *result = res; @@ -853,10 +848,10 @@ void __qmljs_call_value(ExecutionContext *context, Value *result, const Value *t Object *o = func.asObject(); if (!o) context->throwTypeError(); - CallData d; - d.thisObject = thisObject ? *thisObject : Value::undefinedValue(); - d.args = args; - d.argc = argc; + + ScopedCallData d(context->engine, argc); + d->thisObject = thisObject ? *thisObject : Value::undefinedValue(); + memcpy(d->args, args, argc*sizeof(Value)); Value res = o->call(d); if (result) *result = res; @@ -874,10 +869,9 @@ void __qmljs_construct_global_lookup(ExecutionContext *context, Value *result, u if (!f) context->throwTypeError(); - CallData d; - d.args = args; - d.argc = argc; - Value res = f->construct(d); + ScopedCallData callData(context->engine, argc); + memcpy(callData->args, args, argc*sizeof(Value)); + Value res = f->construct(callData); if (result) *result = res; } @@ -892,9 +886,8 @@ 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()) { - CallData d; - d.args = args; - d.argc = argc; + ScopedCallData d(context->engine, argc); + memcpy(d->args, args, argc*sizeof(Value)); Value res = f->construct(d); if (result) *result = res; @@ -910,9 +903,8 @@ void __qmljs_construct_property(ExecutionContext *context, Value *result, const Value func = thisObject->get(name); if (Object *f = func.asObject()) { - CallData d; - d.args = args; - d.argc = argc; + ScopedCallData d(context->engine, argc); + memcpy(d->args, args, argc*sizeof(Value)); Value res = f->construct(d); if (result) *result = res; |