aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4object.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-01-22 15:25:50 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-24 14:32:33 +0100
commitc53fef423a8f607e1443b1d409712864f8cac9d5 (patch)
tree87d1efbdcf64ecb14fa6980a70fb20ffc994831d /src/qml/jsruntime/qv4object.cpp
parent6ae57f01bb1495a74b23a81c590672ce788d5400 (diff)
Change virtual methods in ArrayData to take Object pointer
Pass a pointer to the underlying object instead of the ArrayData to virtual methods that modify the arrayData. This prepares for allocating the ArrayData together with the array itself. Change-Id: I66fe187f8b1e4d382ab243a518dbde5f18a1d16d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4object.cpp')
-rw-r--r--src/qml/jsruntime/qv4object.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index 89e32c4b17..86c7ab1986 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -857,7 +857,7 @@ bool Object::internalDeleteIndexedProperty(uint index)
if (internalClass->engine->hasException)
return false;
- if (!arrayData || arrayData->deleteIndex(index))
+ if (!arrayData || arrayData->vtable()->del(this, index))
return true;
if (engine()->currentContext()->strictMode)
@@ -1025,7 +1025,7 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, uint index, const Stri
if (member.isNull()) {
// need to convert the array and the slot
initSparseArray();
- arrayData->setAttributes(index, cattrs);
+ setArrayAttributes(index, cattrs);
current = arrayData->getProperty(index);
}
current->setGetter(0);
@@ -1036,7 +1036,7 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, uint index, const Stri
cattrs.setWritable(false);
if (member.isNull()) {
// need to convert the array and the slot
- arrayData->setAttributes(index, cattrs);
+ setArrayAttributes(index, cattrs);
current = arrayData->getProperty(index);
}
current->value = Primitive::undefinedValue();
@@ -1062,7 +1062,7 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, uint index, const Stri
if (!member.isNull()) {
internalClass = internalClass->changeMember(member.getPointer(), cattrs);
} else {
- arrayData->setAttributes(index, cattrs);
+ setArrayAttributes(index, cattrs);
}
if (cattrs.isAccessor())
hasAccessorProperty = 1;
@@ -1143,10 +1143,14 @@ bool Object::setArrayLength(uint newLen)
uint oldLen = getLength();
bool ok = true;
if (newLen < oldLen) {
- uint l = arrayData->truncate(newLen);
- if (l != newLen)
- ok = false;
- newLen = l;
+ if (!arrayData) {
+ Q_ASSERT(!newLen);
+ } else {
+ uint l = arrayData->vtable()->truncate(this, newLen);
+ if (l != newLen)
+ ok = false;
+ newLen = l;
+ }
} else {
if (newLen >= 0x100000)
initSparseArray();
@@ -1221,7 +1225,7 @@ ArrayObject::ArrayObject(ExecutionEngine *engine, const QStringList &list)
arrayReserve(len);
ScopedValue v(scope);
for (int ii = 0; ii < len; ++ii)
- arrayData->put(ii, (v = engine->newString(list.at(ii))));
+ arrayPut(ii, (v = engine->newString(list.at(ii))));
setArrayLengthUnchecked(len);
}