diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-08-21 17:31:22 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-02 17:27:36 +0200 |
commit | 6f472680ebecb3a4d700eedcf62cb423b05c4fd1 (patch) | |
tree | bc732911a9c353dbac232ebda5a94468e3e261fe /src/qml/jsruntime/qv4jsonobject.cpp | |
parent | da2f24d8e5c32fe4ed45dcb89aa357465f85fc1e (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/qv4jsonobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4jsonobject.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp index e5a8582d19..68a4c5ca71 100644 --- a/src/qml/jsruntime/qv4jsonobject.cpp +++ b/src/qml/jsruntime/qv4jsonobject.cpp @@ -702,8 +702,10 @@ QString Stringify::Str(const QString &key, Value value) if (Object *o = value.asObject()) { FunctionObject *toJSON = o->get(ctx->engine->newString(QStringLiteral("toJSON"))).asFunctionObject(); if (toJSON) { - Value arg = Value::fromString(ctx, key); - value = toJSON->call(value, &arg, 1); + CALLDATA(1); + d.thisObject = value; + d.args[0] = Value::fromString(ctx, key); + value = toJSON->call(d); } } @@ -711,10 +713,11 @@ QString Stringify::Str(const QString &key, Value value) Object *holder = ctx->engine->newObject(); Value holderValue = Value::fromObject(holder); holder->put(ctx, QString(), value); - Value args[2]; - args[0] = Value::fromString(ctx, key); - args[1] = value; - value = replacerFunction->call(holderValue, args, 2); + CALLDATA(2); + d.args[0] = Value::fromString(ctx, key); + d.args[1] = value; + d.thisObject = holderValue; + value = replacerFunction->call(d); } if (Object *o = value.asObject()) { |