aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4arraydata.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-11-03 22:08:02 +0100
committerLars Knoll <lars.knoll@qt.io>2017-11-14 21:45:54 +0000
commit353164263c55825a0ec72d30128c50560c626334 (patch)
treee44b831652a84fc75237ce628a06438f620a0599 /src/qml/jsruntime/qv4arraydata.cpp
parent5c0481c1934ef4b39437eef06ddfa15170473bcb (diff)
Avoid marking on simple array data's
Speeds up things by 2-3%. Change-Id: Ib17ab126cf91ce48a0ced7dd7b06c4f7f0a70a3b Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4arraydata.cpp')
-rw-r--r--src/qml/jsruntime/qv4arraydata.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
index 0130dc0077..390840fb1e 100644
--- a/src/qml/jsruntime/qv4arraydata.cpp
+++ b/src/qml/jsruntime/qv4arraydata.cpp
@@ -111,6 +111,13 @@ static Q_ALWAYS_INLINE void storeValue(ReturnedValue *target, uint value)
*target = v.asReturnedValue();
}
+void Heap::ArrayData::markObjects(Heap::Base *base, MarkStack *stack)
+{
+ ArrayData *a = static_cast<ArrayData *>(base);
+ a->values.mark(stack);
+}
+
+
void ArrayData::realloc(Object *o, Type newType, uint requested, bool enforceAttributes)
{
Scope scope(o->engine());
@@ -161,6 +168,8 @@ void ArrayData::realloc(Object *o, Type newType, uint requested, bool enforceAtt
}
newData->setAlloc(alloc);
newData->setType(newType);
+ if (d)
+ newData->d()->needsMark = d->d()->needsMark;
newData->setAttrs(enforceAttributes ? reinterpret_cast<PropertyAttributes *>(newData->d()->values.values + alloc) : 0);
o->setArrayData(newData);
@@ -183,6 +192,8 @@ void ArrayData::realloc(Object *o, Type newType, uint requested, bool enforceAtt
memcpy(newData->d()->values.values, d->d()->values.values + offset, sizeof(Value)*toCopy);
}
+ if (newType != Heap::ArrayData::Simple)
+ newData->d()->needsMark = true;
if (newType != Heap::ArrayData::Sparse)
return;