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/qv4dateobject.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/qv4dateobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4dateobject.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp index 47730f2f2e..87d93add6e 100644 --- a/src/qml/jsruntime/qv4dateobject.cpp +++ b/src/qml/jsruntime/qv4dateobject.cpp @@ -659,15 +659,15 @@ DateCtor::DateCtor(ExecutionContext *scope) vtbl = &static_vtbl; } -Value DateCtor::construct(Managed *m, Value *args, int argc) +Value DateCtor::construct(Managed *m, const CallData &d) { double t = 0; - if (argc == 0) + if (d.argc == 0) t = currentTime(); - else if (argc == 1) { - Value arg = args[0]; + else if (d.argc == 1) { + Value arg = d.args[0]; if (DateObject *d = arg.asDateObject()) arg = d->value; else @@ -679,25 +679,25 @@ Value DateCtor::construct(Managed *m, Value *args, int argc) t = TimeClip(arg.toNumber()); } - else { // argc > 1 - double year = args[0].toNumber(); - double month = args[1].toNumber(); - double day = argc >= 3 ? args[2].toNumber() : 1; - double hours = argc >= 4 ? args[3].toNumber() : 0; - double mins = argc >= 5 ? args[4].toNumber() : 0; - double secs = argc >= 6 ? args[5].toNumber() : 0; - double ms = argc >= 7 ? args[6].toNumber() : 0; + else { // d.argc > 1 + double year = d.args[0].toNumber(); + double month = d.args[1].toNumber(); + double day = d.argc >= 3 ? d.args[2].toNumber() : 1; + double hours = d.argc >= 4 ? d.args[3].toNumber() : 0; + double mins = d.argc >= 5 ? d.args[4].toNumber() : 0; + double secs = d.argc >= 6 ? d.args[5].toNumber() : 0; + double ms = d.argc >= 7 ? d.args[6].toNumber() : 0; if (year >= 0 && year <= 99) year += 1900; t = MakeDate(MakeDay(year, month, day), MakeTime(hours, mins, secs, ms)); t = TimeClip(UTC(t)); } - Object *d = m->engine()->newDateObject(Value::fromDouble(t)); - return Value::fromObject(d); + Object *o = m->engine()->newDateObject(Value::fromDouble(t)); + return Value::fromObject(o); } -Value DateCtor::call(Managed *m, const Value &, Value *, int) +Value DateCtor::call(Managed *m, const CallData &) { double t = currentTime(); return Value::fromString(m->engine()->current, ToString(t)); @@ -1306,7 +1306,9 @@ Value DatePrototype::method_toJSON(SimpleCallContext *ctx) if (!toIso) ctx->throwTypeError(); - return toIso->call(ctx->thisObject, 0, 0); + CALLDATA(0); + d.thisObject = ctx->thisObject; + return toIso->call(d); } void DatePrototype::timezoneUpdated() |