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/qv4regexpobject.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/qv4regexpobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4regexpobject.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp index 0dc14e5722..16b23e2edb 100644 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@ -220,10 +220,10 @@ RegExpCtor::RegExpCtor(ExecutionContext *scope) vtbl = &static_vtbl; } -Value RegExpCtor::construct(Managed *m, Value *argv, int argc) +Value RegExpCtor::construct(Managed *m, const CallData &d) { - Value r = argc > 0 ? argv[0] : Value::undefinedValue(); - Value f = argc > 1 ? argv[1] : Value::undefinedValue(); + Value r = d.argc > 0 ? d.args[0] : Value::undefinedValue(); + Value f = d.argc > 1 ? d.args[1] : Value::undefinedValue(); ExecutionContext *ctx = m->engine()->current; if (RegExpObject *re = r.as<RegExpObject>()) { if (!f.isUndefined()) @@ -264,14 +264,14 @@ Value RegExpCtor::construct(Managed *m, Value *argv, int argc) return Value::fromObject(o); } -Value RegExpCtor::call(Managed *that, const Value &, Value *argv, int argc) +Value RegExpCtor::call(Managed *that, const CallData &d) { - if (argc > 0 && argv[0].as<RegExpObject>()) { - if (argc == 1 || argv[1].isUndefined()) - return argv[0]; + if (d.argc > 0 && d.args[0].as<RegExpObject>()) { + if (d.argc == 1 || d.args[1].isUndefined()) + return d.args[0]; } - return construct(that, argv, argc); + return construct(that, d); } void RegExpPrototype::init(ExecutionContext *ctx, const Value &ctor) @@ -349,7 +349,10 @@ Value RegExpPrototype::method_compile(SimpleCallContext *ctx) if (!r) ctx->throwTypeError(); - RegExpObject *re = ctx->engine->regExpCtor.asFunctionObject()->construct(ctx->arguments, ctx->argumentCount).as<RegExpObject>(); + CallData d; + d.args = ctx->arguments; + d.argc = ctx->argumentCount; + RegExpObject *re = ctx->engine->regExpCtor.asFunctionObject()->construct(d).as<RegExpObject>(); r->value = re->value; r->global = re->global; |