aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4arraydata.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-01-15 11:36:57 +0100
committerLars Knoll <lars.knoll@digia.com>2015-01-23 08:07:32 +0100
commit002a5d4303b3b182ae4abc4a752c49787c1c2821 (patch)
tree69c7666ed1061c7acacee1d76597c06405459c80 /src/qml/jsruntime/qv4arraydata.cpp
parentfddc75e862032163af36d2282051758647b62d15 (diff)
Get rid of most uses of ValueRef
Instead pass a const Value & into the functions With our new inheritance structure, we can get rid of ValueRef and instead simply pass a pointer to a Value again. Pointers to Values are safe to use again now, as they are now guaranteed to be in a place where the GC knows about them. Change-Id: I44c606fde764db3993b8128fd6fb781d3a298e53 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4arraydata.cpp')
-rw-r--r--src/qml/jsruntime/qv4arraydata.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
index 8f1fe1bbe6..3157a41d21 100644
--- a/src/qml/jsruntime/qv4arraydata.cpp
+++ b/src/qml/jsruntime/qv4arraydata.cpp
@@ -229,7 +229,7 @@ ReturnedValue SimpleArrayData::get(const Heap::ArrayData *d, uint index)
return dd->data(index).asReturnedValue();
}
-bool SimpleArrayData::put(Object *o, uint index, ValueRef value)
+bool SimpleArrayData::put(Object *o, uint index, const Value &value)
{
Heap::SimpleArrayData *dd = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
Q_ASSERT(index >= dd->len || !dd->attrs || !dd->attrs[index].isAccessor());
@@ -317,7 +317,7 @@ uint SimpleArrayData::length(const Heap::ArrayData *d)
return d->len;
}
-bool SimpleArrayData::putArray(Object *o, uint index, Value *values, uint n)
+bool SimpleArrayData::putArray(Object *o, uint index, const Value *values, uint n)
{
Heap::SimpleArrayData *dd = static_cast<Heap::SimpleArrayData *>(o->d()->arrayData);
if (index + n > dd->alloc) {
@@ -414,9 +414,9 @@ ReturnedValue SparseArrayData::get(const Heap::ArrayData *d, uint index)
return s->arrayData[index].asReturnedValue();
}
-bool SparseArrayData::put(Object *o, uint index, ValueRef value)
+bool SparseArrayData::put(Object *o, uint index, const Value &value)
{
- if (value->isEmpty())
+ if (value.isEmpty())
return true;
Heap::SparseArrayData *s = static_cast<Heap::SparseArrayData *>(o->d()->arrayData);
@@ -546,7 +546,7 @@ uint SparseArrayData::length(const Heap::ArrayData *d)
return n ? n->key() + 1 : 0;
}
-bool SparseArrayData::putArray(Object *o, uint index, Value *values, uint n)
+bool SparseArrayData::putArray(Object *o, uint index, const Value *values, uint n)
{
for (uint i = 0; i < n; ++i)
put(o, index + i, values[i]);
@@ -636,7 +636,7 @@ Property *ArrayData::insert(Object *o, uint index, bool isAccessor)
class ArrayElementLessThan
{
public:
- inline ArrayElementLessThan(ExecutionEngine *engine, Object *thisObject, const ValueRef comparefn)
+ inline ArrayElementLessThan(ExecutionEngine *engine, Object *thisObject, const Value &comparefn)
: m_engine(engine), thisObject(thisObject), m_comparefn(comparefn) {}
bool operator()(Value v1, Value v2) const;
@@ -644,7 +644,7 @@ public:
private:
ExecutionEngine *m_engine;
Object *thisObject;
- const ValueRef m_comparefn;
+ const Value &m_comparefn;
};
@@ -727,7 +727,7 @@ top:
}
-void ArrayData::sort(ExecutionEngine *engine, Object *thisObject, const ValueRef comparefn, uint len)
+void ArrayData::sort(ExecutionEngine *engine, Object *thisObject, const Value &comparefn, uint len)
{
if (!len)
return;
@@ -738,7 +738,7 @@ void ArrayData::sort(ExecutionEngine *engine, Object *thisObject, const ValueRef
if (!arrayData || !arrayData->length())
return;
- if (!(comparefn->isUndefined() || comparefn->asObject())) {
+ if (!(comparefn.isUndefined() || comparefn.asObject())) {
engine->throwTypeError();
return;
}