aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4serialize.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-12-16 09:16:57 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-09 07:47:06 +0100
commit459c9a2a8840995436e610459216957bc7ebd914 (patch)
treeef28df2fdbc62bf551088d13850492d2c6a771b1 /src/qml/jsruntime/qv4serialize.cpp
parent5cf95512af83fc6a0f70d3493be571accaf50d84 (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 <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4serialize.cpp')
-rw-r--r--src/qml/jsruntime/qv4serialize.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4serialize.cpp b/src/qml/jsruntime/qv4serialize.cpp
index b199c86d78..5f9e24d89c 100644
--- a/src/qml/jsruntime/qv4serialize.cpp
+++ b/src/qml/jsruntime/qv4serialize.cpp
@@ -183,7 +183,7 @@ void Serialize::serialize(QByteArray &data, const QV4::ValueRef v, QV8Engine *en
push(data, valueheader(WorkerUndefined));
} else if (v->asArrayObject()) {
QV4::ScopedArrayObject array(scope, v);
- uint32_t length = array->arrayLength();
+ uint32_t length = array->getLength();
if (length > 0xFFFFFF) {
push(data, valueheader(WorkerUndefined));
return;
@@ -266,7 +266,7 @@ void Serialize::serialize(QByteArray &data, const QV4::ValueRef v, QV8Engine *en
// regular object
QV4::ScopedValue val(scope, *v);
QV4::ScopedArrayObject properties(scope, QV4::ObjectPrototype::getOwnPropertyNames(v4, val));
- quint32 length = properties->arrayLength();
+ quint32 length = properties->getLength();
if (length > 0xFFFFFF) {
push(data, valueheader(WorkerUndefined));
return;
@@ -390,8 +390,8 @@ ReturnedValue Serialize::deserialize(const char *&data, QV8Engine *engine)
array->arrayReserve(seqLength);
for (quint32 ii = 0; ii < seqLength; ++ii) {
value = deserialize(data, engine);
- array->arrayData.data[ii].value = value.asReturnedValue();
- array->arrayData.length = ii + 1;
+ array->arrayData->put(ii, value);
+ array->arrayData->setLength(ii + 1);
}
array->setArrayLengthUnchecked(seqLength);
QVariant seqVariant = QV4::SequencePrototype::toVariant(array, sequenceType, &succeeded);