summaryrefslogtreecommitdiff
path: root/src/qml/jsruntime/qv4arraydata.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2014-11-17 21:08:13 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-12-10 11:00:25 +0100
commit2e6e49f829d53fa4a08587bcd38f8db7903810e1 (patch)
tree4a1eadaf9b86bba4f8fd677de477dac7af62b00f /src/qml/jsruntime/qv4arraydata.cpp
parentd5b43dc8479f5a75ba2e3108d6454ff3f046a36e (diff)
downloadqtdeclarative-2e6e49f829d53fa4a08587bcd38f8db7903810e1.tar.gz
Move readonly accessors into Heap::ArrayData
these methods don't modify the object, so it's safe to have them there and this simplifies quite a bit of the code. Change-Id: I2f591758efba9cb8d17b956bc7c02e2d7a468ea4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4arraydata.cpp')
-rw-r--r--src/qml/jsruntime/qv4arraydata.cpp25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
index 5c3f3e1adc..a4f11b2b5a 100644
--- a/src/qml/jsruntime/qv4arraydata.cpp
+++ b/src/qml/jsruntime/qv4arraydata.cpp
@@ -64,7 +64,6 @@ const ArrayVTable SimpleArrayData::static_vtbl =
SimpleArrayData::putArray,
SimpleArrayData::del,
SimpleArrayData::setAttribute,
- SimpleArrayData::attribute,
SimpleArrayData::push_front,
SimpleArrayData::pop_front,
SimpleArrayData::truncate,
@@ -81,7 +80,6 @@ const ArrayVTable SparseArrayData::static_vtbl =
SparseArrayData::putArray,
SparseArrayData::del,
SparseArrayData::setAttribute,
- SparseArrayData::attribute,
SparseArrayData::push_front,
SparseArrayData::pop_front,
SparseArrayData::truncate,
@@ -222,10 +220,10 @@ void SimpleArrayData::markObjects(Heap::Base *d, ExecutionEngine *e)
dd->arrayData[i].mark(e);
}
-ReturnedValue SimpleArrayData::get(const ArrayData *d, uint index)
+ReturnedValue SimpleArrayData::get(const Heap::ArrayData *d, uint index)
{
- const SimpleArrayData *dd = static_cast<const SimpleArrayData *>(d);
- if (index >= dd->len())
+ const Heap::SimpleArrayData *dd = static_cast<const Heap::SimpleArrayData *>(d);
+ if (index >= dd->len)
return Primitive::emptyValue().asReturnedValue();
return dd->data(index).asReturnedValue();
}
@@ -266,11 +264,6 @@ void SimpleArrayData::setAttribute(Object *o, uint index, PropertyAttributes att
o->arrayData()->attrs()[index] = attrs;
}
-PropertyAttributes SimpleArrayData::attribute(const ArrayData *d, uint index)
-{
- return d->attrs()[index];
-}
-
void SimpleArrayData::push_front(Object *o, Value *values, uint n)
{
Heap::SimpleArrayData *dd = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
@@ -412,9 +405,9 @@ uint SparseArrayData::allocate(Object *o, bool doubleSlot)
}
}
-ReturnedValue SparseArrayData::get(const ArrayData *d, uint index)
+ReturnedValue SparseArrayData::get(const Heap::ArrayData *d, uint index)
{
- const Heap::SparseArrayData *s = static_cast<const SparseArrayData *>(d)->d();
+ const Heap::SparseArrayData *s = static_cast<const Heap::SparseArrayData *>(d);
index = s->mappedIndex(index);
if (index == UINT_MAX)
return Primitive::emptyValue().asReturnedValue();
@@ -491,14 +484,6 @@ void SparseArrayData::setAttribute(Object *o, uint index, PropertyAttributes att
d->attrs[n->value] = attrs;
}
-PropertyAttributes SparseArrayData::attribute(const ArrayData *d, uint index)
-{
- SparseArrayNode *n = d->d()->sparse->findNode(index);
- if (!n)
- return PropertyAttributes();
- return d->d()->attrs[n->value];
-}
-
void SparseArrayData::push_front(Object *o, Value *values, uint n)
{
Heap::SparseArrayData *d = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);