diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-01-19 16:29:48 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2015-01-23 12:30:43 +0100 |
commit | d24b7fb904771ba078ac52e05984b23327ddff3b (patch) | |
tree | 4c67db1a53556187049ba920eabc0137cb4770d9 /src/qml/jsruntime/qv4functionobject.cpp | |
parent | 0c2ab6e20ca23e74055d0a95539315cf1bf360bf (diff) |
Remove the realArgumentsCount member in CallContext
The data is easily available through the CallData, only used by
the Arguments object and we save a pointer in Heap::CallData this way.
For this to work, let CallData::argc always return the real number
of arguments passed into the function.
Change-Id: I59c7c41e8c1af160db09fa794977ab7084c9e12d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 63efb4f9f6..ed96cceb9a 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -498,10 +498,8 @@ ReturnedValue SimpleScriptFunction::construct(Managed *that, CallData *callData) ctx.lookups = ctx.compilationUnit->runtimeLookups; ctx.outer = f->scope(); ctx.locals = scope.alloc(f->varCount()); - while (callData->argc < (int)f->formalParameterCount()) { - callData->args[callData->argc] = Encode::undefined(); - ++callData->argc; - } + for (int i = callData->argc; i < (int)f->formalParameterCount(); ++i) + callData->args[i] = Encode::undefined(); Q_ASSERT(v4->currentContext() == &ctx); ScopedObject result(scope, Q_V4_PROFILE(v4, f->function())); @@ -535,10 +533,8 @@ ReturnedValue SimpleScriptFunction::call(Managed *that, CallData *callData) ctx.lookups = ctx.compilationUnit->runtimeLookups; ctx.outer = f->scope(); ctx.locals = scope.alloc(f->varCount()); - while (callData->argc < (int)f->formalParameterCount()) { - callData->args[callData->argc] = Encode::undefined(); - ++callData->argc; - } + for (int i = callData->argc; i < (int)f->formalParameterCount(); ++i) + callData->args[i] = Encode::undefined(); Q_ASSERT(v4->currentContext() == &ctx); ScopedValue result(scope, Q_V4_PROFILE(v4, f->function())); |