aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4argumentsobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-03-31 15:48:02 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-04 17:26:20 +0200
commit8e556778c8324c61ddf5842e457c873c1b5aac02 (patch)
treeca9dd1cd85510fdbd01221005cb0c096a844a762 /src/qml/jsruntime/qv4argumentsobject.cpp
parentb02eeeee586abe343b8866385c1327ac009b3ef0 (diff)
Garbage collect member data
Move the allocated member data into the garbage collected area, so that we can avoid using malloc/free for it. Change-Id: I20625efa67ecd60238568742b74854b0c8cb2e3e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4argumentsobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4argumentsobject.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp
index c8ba2c4037..1c210b53b6 100644
--- a/src/qml/jsruntime/qv4argumentsobject.cpp
+++ b/src/qml/jsruntime/qv4argumentsobject.cpp
@@ -93,8 +93,9 @@ void ArgumentsObject::fullyCreate()
uint argCount = qMin(context->realArgumentCount, context->callData->argc);
ArrayData::realloc(this, ArrayData::Sparse, 0, argCount, true);
context->engine->requireArgumentsAccessors(numAccessors);
+ mappedArguments.ensureIndex(engine(), numAccessors);
for (uint i = 0; i < (uint)numAccessors; ++i) {
- mappedArguments.append(context->callData->args[i]);
+ mappedArguments[i] = context->callData->args[i];
arraySet(i, context->engine->argumentsAccessors[i], Attr_Accessor);
}
arrayPut(numAccessors, context->callData->args + numAccessors, argCount - numAccessors);
@@ -113,7 +114,8 @@ bool ArgumentsObject::defineOwnProperty(ExecutionContext *ctx, uint index, const
Property map;
PropertyAttributes mapAttrs;
bool isMapped = false;
- if (pd && index < (uint)mappedArguments.size())
+ uint numAccessors = qMin((int)context->function->formalParameterCount(), context->realArgumentCount);
+ if (pd && index < (uint)numAccessors)
isMapped = arrayData->attributes(index).isAccessor() && pd->getter() == context->engine->argumentsAccessors[index].getter();
if (isMapped) {
@@ -121,7 +123,7 @@ bool ArgumentsObject::defineOwnProperty(ExecutionContext *ctx, uint index, const
map.copy(*pd, mapAttrs);
setArrayAttributes(index, Attr_Data);
pd = arrayData->getProperty(index);
- pd->value = mappedArguments.at(index);
+ pd->value = mappedArguments[index];
}
bool strict = ctx->strictMode;
@@ -232,9 +234,9 @@ ReturnedValue ArgumentsSetterFunction::call(Managed *setter, CallData *callData)
void ArgumentsObject::markObjects(Managed *that, ExecutionEngine *e)
{
ArgumentsObject *o = static_cast<ArgumentsObject *>(that);
- o->context->mark(e);
- for (int i = 0; i < o->mappedArguments.size(); ++i)
- o->mappedArguments.at(i).mark(e);
+ if (o->context)
+ o->context->mark(e);
+ o->mappedArguments.mark(e);
Object::markObjects(that, e);
}