diff options
author | Lars Knoll <[email protected]> | 2013-12-16 09:16:57 +0100 |
---|---|---|
committer | The Qt Project <[email protected]> | 2014-01-09 07:47:06 +0100 |
commit | 459c9a2a8840995436e610459216957bc7ebd914 (patch) | |
tree | ef28df2fdbc62bf551088d13850492d2c6a771b1 /src/qml/jsruntime/qv4functionobject.cpp | |
parent | 5cf95512af83fc6a0f70d3493be571accaf50d84 (diff) |
Rework array handling for JS objects
Split up ArrayData into two classes, one for regular
arrays, one for sparse arrays and cleanly separate
the two cases. Only create array data on demand.
Change-Id: I9ca8d0b53592174f213ba0f20caf93e77dba690a
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 4538884bce..10b2590047 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -343,19 +343,19 @@ ReturnedValue FunctionPrototype::method_apply(CallContext *ctx) if (!arg->isNullOrUndefined()) return ctx->throwTypeError(); } else { - len = ArrayPrototype::getLength(ctx, arr); + len = arr->getLength(); } ScopedCallData callData(scope, len); if (len) { - if (!(arr->flags & SimpleArray) || arr->protoHasArray() || arr->hasAccessorProperty) { + if (arr->arrayType() != ArrayData::Simple || arr->protoHasArray() || arr->hasAccessorProperty) { for (quint32 i = 0; i < len; ++i) callData->args[i] = arr->getIndexed(i); } else { - int alen = qMin(len, arr->arrayData.length); + int alen = qMin(len, arr->arrayData->length()); for (int i = 0; i < alen; ++i) - callData->args[i] = arr->arrayData.data[i].value; + callData->args[i] = arr->arrayData->data[i].value; for (quint32 i = alen; i < len; ++i) callData->args[i] = Primitive::undefinedValue(); } |