aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-08-02 16:54:59 +0200
committerLars Knoll <lars.knoll@qt.io>2018-08-02 20:25:55 +0000
commita88f01364e147d9ea093bf0fdc639b45feef1788 (patch)
treecf1c49dee57f1c691eeecd633bffd0601256f236 /src
parent0d63c22eee293fe59d7691608deaaf3468045eb3 (diff)
Implement ObjectIterator using the new iteration mechanism
And with that get rid of the old advanceIterator methods. Change-Id: I969fa89d25df8992a4b08c8c081b91c92ffdfddd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qml/jsruntime/qv4object.cpp71
-rw-r--r--src/qml/jsruntime/qv4object_p.h3
-rw-r--r--src/qml/jsruntime/qv4objectiterator.cpp58
-rw-r--r--src/qml/jsruntime/qv4objectiterator_p.h41
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp54
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper_p.h1
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp25
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp29
-rw-r--r--src/qml/jsruntime/qv4stringobject_p.h1
-rw-r--r--src/qml/jsruntime/qv4vtable_p.h4
-rw-r--r--src/qml/qml/qqmllistwrapper.cpp17
-rw-r--r--src/qml/qml/qqmllistwrapper_p.h1
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper.cpp28
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper_p.h1
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp10
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions_p.h1
-rw-r--r--src/qml/types/qqmllistmodel.cpp23
-rw-r--r--src/qml/types/qqmllistmodel_p_p.h1
18 files changed, 23 insertions, 346 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index f4604dbce7..6a6687661c 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -337,77 +337,6 @@ bool Object::virtualDeleteProperty(Managed *m, PropertyKey id)
return static_cast<Object *>(m)->internalDeleteProperty(id);
}
-void Object::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *pd, PropertyAttributes *attrs)
-{
- Object *o = static_cast<Object *>(m);
- name->setM(nullptr);
- *index = UINT_MAX;
-
- if (o->arrayData()) {
- if (!it->arrayIndex)
- it->arrayNode = o->sparseBegin();
-
- // sparse arrays
- if (it->arrayNode) {
- while (it->arrayNode != o->sparseEnd()) {
- int k = it->arrayNode->key();
- uint pidx = it->arrayNode->value;
- Heap::SparseArrayData *sa = o->d()->arrayData.cast<Heap::SparseArrayData>();
- const Property *p = reinterpret_cast<const Property *>(sa->values.data() + pidx);
- it->arrayNode = it->arrayNode->nextNode();
- PropertyAttributes a = sa->attrs ? sa->attrs[pidx] : Attr_Data;
- if (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable()) {
- it->arrayIndex = k + 1;
- *index = k;
- *attrs = a;
- pd->copy(p, a);
- return;
- }
- }
- it->arrayNode = nullptr;
- it->arrayIndex = UINT_MAX;
- }
- // dense arrays
- while (it->arrayIndex < o->d()->arrayData->values.size) {
- Heap::SimpleArrayData *sa = o->d()->arrayData.cast<Heap::SimpleArrayData>();
- const Value &val = sa->data(it->arrayIndex);
- PropertyAttributes a = o->arrayData()->attributes(it->arrayIndex);
- ++it->arrayIndex;
- if (!val.isEmpty()
- && (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable())) {
- *index = it->arrayIndex - 1;
- *attrs = a;
- pd->value = val;
- return;
- }
- }
- }
-
- while (it->memberIndex < o->internalClass()->size) {
- PropertyKey n = o->internalClass()->nameMap.at(it->memberIndex);
- if (!n.isStringOrSymbol() || !n.asStringOrSymbol()->internalClass->vtable->isString) {
- // accessor properties have a dummy entry with n == 0
- // symbol entries are supposed to be skipped
- ++it->memberIndex;
- continue;
- }
-
- int idx = it->memberIndex;
- PropertyAttributes a = o->internalClass()->propertyData[it->memberIndex];
- ++it->memberIndex;
- if (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable()) {
- name->setM(n.asStringOrSymbol());
- *attrs = a;
- pd->value = *o->propertyData(idx);
- if (a.isAccessor())
- pd->set = *o->propertyData(idx + SetterOffset);
- return;
- }
- }
-
- *attrs = PropertyAttributes();
-}
-
PropertyKey ObjectOwnPropertyKeyIterator::next(const Object *o, Property *pd, PropertyAttributes *attrs)
{
if (arrayIndex != UINT_MAX && o->arrayData()) {
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index 3f1eb2d537..431c378334 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -353,8 +353,6 @@ public:
bool deleteProperty(PropertyKey id)
{ return vtable()->deleteProperty(this, id); }
- void advanceIterator(ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes)
- { vtable()->advanceIterator(this, it, name, index, p, attributes); }
OwnPropertyKeyIterator *ownPropertyKeys() const
{ return vtable()->ownPropertyKeys(this); }
qint64 getLength() const { return vtable()->getLength(this); }
@@ -377,7 +375,6 @@ protected:
static bool virtualPreventExtensions(Managed *);
static Heap::Object *virtualGetPrototypeOf(const Managed *);
static bool virtualSetPrototypeOf(Managed *, const Object *);
- static void virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes);
static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m);
static qint64 virtualGetLength(const Managed *m);
static ReturnedValue virtualInstanceOf(const Object *typeObject, const Value &var);
diff --git a/src/qml/jsruntime/qv4objectiterator.cpp b/src/qml/jsruntime/qv4objectiterator.cpp
index a6af3ecf9b..8c5830315c 100644
--- a/src/qml/jsruntime/qv4objectiterator.cpp
+++ b/src/qml/jsruntime/qv4objectiterator.cpp
@@ -52,64 +52,32 @@ void ForInIteratorPrototype::init(ExecutionEngine *)
defineDefaultProperty(QStringLiteral("next"), method_next, 0);
}
-void ObjectIterator::init(const Object *o)
-{
- object->setM(o ? o->m() : nullptr);
- current->setM(o ? o->m() : nullptr);
-
- if (object->as<ArgumentsObject>()) {
- Scope scope(engine);
- Scoped<ArgumentsObject> (scope, object->asReturnedValue())->fullyCreate();
- }
-}
-
void ObjectIterator::next(Value *name, uint *index, Property *pd, PropertyAttributes *attrs)
{
- name->setM(nullptr);
- *index = UINT_MAX;
-
- if (!object->as<Object>()) {
+ if (!object) {
+ *name = Encode::undefined();
*attrs = PropertyAttributes();
return;
}
Scope scope(engine);
ScopedObject o(scope);
ScopedString n(scope);
+ ScopedPropertyKey key(scope);
while (1) {
- Object *co = current->objectValue();
- if (!co)
- break;
-
- while (1) {
- co->advanceIterator(this, name, index, pd, attrs);
- if (attrs->isEmpty())
- break;
- // check the property is not already defined earlier in the proto chain
- if (co->heapObject() != object->heapObject()) {
- o = object->as<Object>();
- n = *name;
- bool shadowed = false;
- while (o->d() != current->heapObject()) {
- PropertyKey id = n ? (n->toPropertyKey()) : PropertyKey::fromArrayIndex(*index);
- if (id.isValid() && o->getOwnProperty(id) != Attr_Invalid) {
- shadowed = true;
- break;
- }
- o = o->getPrototypeOf();
- }
- if (shadowed)
- continue;
- }
+ key = iterator->next(object, pd, attrs);
+ if (!key->isValid()) {
+ object = nullptr;
+ *name = Encode::undefined();
+ *attrs = PropertyAttributes();
return;
}
-
- current->setM(nullptr);
-
- arrayIndex = 0;
- memberIndex = 0;
+ if (key->isSymbol() || ((flags & EnumerableOnly) && !attrs->isEnumerable()))
+ continue;
+ *name = key->asStringOrSymbol();
+ *index = key->asArrayIndex();
+ return;
}
- *attrs = PropertyAttributes();
}
ReturnedValue ObjectIterator::nextPropertyName(Value *value)
diff --git a/src/qml/jsruntime/qv4objectiterator_p.h b/src/qml/jsruntime/qv4objectiterator_p.h
index ca40748b79..d6160b9dd0 100644
--- a/src/qml/jsruntime/qv4objectiterator_p.h
+++ b/src/qml/jsruntime/qv4objectiterator_p.h
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
-struct Q_QML_EXPORT ObjectIteratorData
+struct Q_QML_EXPORT ObjectIterator
{
enum Flags {
NoFlags = 0,
@@ -65,48 +65,27 @@ struct Q_QML_EXPORT ObjectIteratorData
};
ExecutionEngine *engine;
- Value *object;
- Value *current;
- SparseArrayNode *arrayNode;
- uint arrayIndex;
- uint memberIndex;
+ Object *object;
+ OwnPropertyKeyIterator *iterator = nullptr;
uint flags;
-};
-Q_STATIC_ASSERT(std::is_trivial< ObjectIteratorData >::value);
-
-struct Q_QML_EXPORT ObjectIterator: ObjectIteratorData
-{
- ObjectIterator(ExecutionEngine *e, Value *scratch1, Value *scratch2, Object *o, uint flags)
- {
- engine = e;
- object = scratch1;
- current = scratch2;
- arrayNode = nullptr;
- arrayIndex = 0;
- memberIndex = 0;
- this->flags = flags;
- init(o);
- }
ObjectIterator(Scope &scope, const Object *o, uint flags)
{
engine = scope.engine;
- object = scope.alloc();
- current = scope.alloc();
- arrayNode = nullptr;
- arrayIndex = 0;
- memberIndex = 0;
+ object = static_cast<Object *>(scope.alloc());
this->flags = flags;
- init(o);
+ object->setM(o ? o->m() : nullptr);
+ iterator = object->ownPropertyKeys();
+ }
+ ~ObjectIterator()
+ {
+ delete iterator;
}
void next(Value *name, uint *index, Property *pd, PropertyAttributes *attributes = nullptr);
ReturnedValue nextPropertyName(Value *value);
ReturnedValue nextPropertyNameAsString(Value *value);
ReturnedValue nextPropertyNameAsString();
-
-private:
- void init(const Object *o);
};
namespace Heap {
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 61678acdad..23a268b8b9 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -760,60 +760,6 @@ PropertyAttributes QObjectWrapper::virtualGetOwnProperty(Managed *m, PropertyKey
return QV4::Object::virtualGetOwnProperty(m, id, p);
}
-void QObjectWrapper::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes)
-{
- // Used to block access to QObject::destroyed() and QObject::deleteLater() from QML
- static const int destroyedIdx1 = QObject::staticMetaObject.indexOfSignal("destroyed(QObject*)");
- static const int destroyedIdx2 = QObject::staticMetaObject.indexOfSignal("destroyed()");
- static const int deleteLaterIdx = QObject::staticMetaObject.indexOfSlot("deleteLater()");
-
- name->setM(nullptr);
- *index = UINT_MAX;
-
- QObjectWrapper *that = static_cast<QObjectWrapper*>(m);
-
- QObject *thatObject = that->d()->object();
- if (thatObject && !QQmlData::wasDeleted(thatObject)) {
- const QMetaObject *mo = thatObject->metaObject();
- // These indices don't apply to gadgets, so don't block them.
- const bool preventDestruction = mo->superClass() || mo == &QObject::staticMetaObject;
- const int propertyCount = mo->propertyCount();
- if (it->arrayIndex < static_cast<uint>(propertyCount)) {
- ExecutionEngine *thatEngine = that->engine();
- Scope scope(thatEngine);
- const QMetaProperty property = mo->property(it->arrayIndex);
- ScopedString propName(scope, thatEngine->newString(QString::fromUtf8(property.name())));
- name->setM(propName->d());
- ++it->arrayIndex;
- *attributes = QV4::Attr_Data;
-
- QQmlPropertyData local;
- local.load(property);
- p->value = that->getProperty(thatEngine, thatObject, &local);
- return;
- }
- const int methodCount = mo->methodCount();
- while (it->arrayIndex < static_cast<uint>(propertyCount + methodCount)) {
- const int index = it->arrayIndex - propertyCount;
- const QMetaMethod method = mo->method(index);
- ++it->arrayIndex;
- if (method.access() == QMetaMethod::Private || (preventDestruction && (index == deleteLaterIdx || index == destroyedIdx1 || index == destroyedIdx2)))
- continue;
- ExecutionEngine *thatEngine = that->engine();
- Scope scope(thatEngine);
- ScopedString methodName(scope, thatEngine->newString(QString::fromUtf8(method.name())));
- name->setM(methodName->d());
- *attributes = QV4::Attr_Data;
-
- QQmlPropertyData local;
- local.load(method);
- p->value = that->getProperty(thatEngine, thatObject, &local);
- return;
- }
- }
- QV4::Object::virtualAdvanceIterator(m, it, name, index, p, attributes);
-}
-
struct QObjectWrapperOwnPropertyKeyIterator : ObjectOwnPropertyKeyIterator
{
int propertyIndex = 0;
diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h
index 203bbfa151..1772ce434d 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper_p.h
+++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h
@@ -195,7 +195,6 @@ protected:
static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver);
static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p);
- static void virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes);
static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m);
static ReturnedValue method_connect(const FunctionObject *, const Value *thisObject, const Value *argv, int argc);
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index ab05a819c1..da5aa17719 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -342,29 +342,6 @@ public:
return (index < size_t(d()->container->size())) ? QV4::Attr_Data : QV4::Attr_Invalid;
}
- void containerAdvanceIterator(ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs)
- {
- name->setM(nullptr);
- *index = UINT_MAX;
-
- if (d()->isReference) {
- if (!d()->object) {
- QV4::Object::virtualAdvanceIterator(this, it, name, index, p, attrs);
- return;
- }
- loadReference();
- }
-
- if (it->arrayIndex < static_cast<uint>(d()->container->size())) {
- *index = it->arrayIndex;
- ++it->arrayIndex;
- *attrs = QV4::Attr_Data;
- p->value = convertElementToValue(engine(), d()->container->at(*index));
- return;
- }
- QV4::Object::virtualAdvanceIterator(this, it, name, index, p, attrs);
- }
-
struct OwnPropertyKeyIterator : ObjectOwnPropertyKeyIterator
{
~OwnPropertyKeyIterator() override = default;
@@ -619,8 +596,6 @@ public:
}
static bool virtualIsEqualTo(Managed *that, Managed *other)
{ return static_cast<QQmlSequence<Container> *>(that)->containerIsEqualTo(other); }
- static void virtualAdvanceIterator(Managed *that, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs)
- { return static_cast<QQmlSequence<Container> *>(that)->containerAdvanceIterator(it, name, index, p, attrs); }
static QV4::OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m)
{ return static_cast<const QQmlSequence<Container> *>(m)->containerOwnPropertyKeys(m);}
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index 12fed62bcc..a48ff0b00d 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -109,35 +109,6 @@ bool StringObject::virtualDeleteProperty(Managed *m, PropertyKey id)
return Object::virtualDeleteProperty(m, id);
}
-void StringObject::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs)
-{
- name->setM(nullptr);
- StringObject *s = static_cast<StringObject *>(m);
- uint slen = s->d()->string->toQString().length();
- if (it->arrayIndex <= slen) {
- while (it->arrayIndex < slen) {
- *index = it->arrayIndex;
- ++it->arrayIndex;
- Property pd;
- PropertyAttributes a = s->getOwnProperty(PropertyKey::fromArrayIndex(*index), &pd);
- if (!(it->flags & ObjectIterator::EnumerableOnly) || a.isEnumerable()) {
- *attrs = a;
- p->copy(&pd, a);
- return;
- }
- }
- if (s->arrayData()) {
- it->arrayNode = s->sparseBegin();
- // iterate until we're past the end of the string
- while (it->arrayNode && it->arrayNode->key() < slen)
- it->arrayNode = it->arrayNode->nextNode();
- }
- }
-
- return Object::virtualAdvanceIterator(m, it, name, index, p, attrs);
-}
-
-
struct StringObjectOwnPropertyKeyIterator : ObjectOwnPropertyKeyIterator
{
~StringObjectOwnPropertyKeyIterator() override = default;
diff --git a/src/qml/jsruntime/qv4stringobject_p.h b/src/qml/jsruntime/qv4stringobject_p.h
index 4dd114e06a..20d8cf3fd4 100644
--- a/src/qml/jsruntime/qv4stringobject_p.h
+++ b/src/qml/jsruntime/qv4stringobject_p.h
@@ -101,7 +101,6 @@ struct StringObject: Object {
using Object::getOwnProperty;
protected:
static bool virtualDeleteProperty(Managed *m, PropertyKey id);
- static void virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs);
static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m);
static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p);
};
diff --git a/src/qml/jsruntime/qv4vtable_p.h b/src/qml/jsruntime/qv4vtable_p.h
index aff8eb83ac..7058991a34 100644
--- a/src/qml/jsruntime/qv4vtable_p.h
+++ b/src/qml/jsruntime/qv4vtable_p.h
@@ -78,7 +78,6 @@ struct VTable
typedef Heap::Object *(*GetPrototypeOf)(const Managed *);
typedef bool (*SetPrototypeOf)(Managed *, const Object *);
typedef qint64 (*GetLength)(const Managed *m);
- typedef void (*AdvanceIterator)(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes);
typedef OwnPropertyKeyIterator *(*OwnPropertyKeys)(const Object *m);
typedef ReturnedValue (*InstanceOf)(const Object *typeObject, const Value &var);
@@ -114,7 +113,6 @@ struct VTable
GetPrototypeOf getPrototypeOf;
SetPrototypeOf setPrototypeOf;
GetLength getLength;
- AdvanceIterator advanceIterator;
OwnPropertyKeys ownPropertyKeys;
InstanceOf instanceOf;
@@ -139,7 +137,6 @@ protected:
static constexpr VTable::GetPrototypeOf virtualGetPrototypeOf = nullptr;
static constexpr VTable::SetPrototypeOf virtualSetPrototypeOf = nullptr;
static constexpr VTable::GetLength virtualGetLength = nullptr;
- static constexpr VTable::AdvanceIterator virtualAdvanceIterator = nullptr;
static constexpr VTable::OwnPropertyKeys virtualOwnPropertyKeys = nullptr;
static constexpr VTable::InstanceOf virtualInstanceOf = nullptr;
@@ -179,7 +176,6 @@ protected:
classname::virtualGetPrototypeOf, \
classname::virtualSetPrototypeOf, \
classname::virtualGetLength, \
- classname::virtualAdvanceIterator, \
classname::virtualOwnPropertyKeys, \
classname::virtualInstanceOf, \
\
diff --git a/src/qml/qml/qqmllistwrapper.cpp b/src/qml/qml/qqmllistwrapper.cpp
index d491cd6166..54ead29131 100644
--- a/src/qml/qml/qqmllistwrapper.cpp
+++ b/src/qml/qml/qqmllistwrapper.cpp
@@ -140,23 +140,6 @@ bool QmlListWrapper::virtualPut(Managed *m, PropertyKey id, const Value &value,
return false;
}
-void QmlListWrapper::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs)
-{
- name->setM(nullptr);
- *index = UINT_MAX;
- Q_ASSERT(m->as<QmlListWrapper>());
- QmlListWrapper *w = static_cast<QmlListWrapper *>(m);
- quint32 count = w->d()->property().count ? w->d()->property().count(&w->d()->property()) : 0;
- if (it->arrayIndex < count) {
- *index = it->arrayIndex;
- ++it->arrayIndex;
- *attrs = QV4::Attr_Data;
- p->value = QV4::QObjectWrapper::wrap(w->engine(), w->d()->property().at(&w->d()->property(), *index));
- return;
- }
- return QV4::Object::virtualAdvanceIterator(m, it, name, index, p, attrs);
-}
-
struct QmlListWrapperOwnPropertyKeyIterator : ObjectOwnPropertyKeyIterator
{
~QmlListWrapperOwnPropertyKeyIterator() override = default;
diff --git a/src/qml/qml/qqmllistwrapper_p.h b/src/qml/qml/qqmllistwrapper_p.h
index e78b779344..99aad94248 100644
--- a/src/qml/qml/qqmllistwrapper_p.h
+++ b/src/qml/qml/qqmllistwrapper_p.h
@@ -95,7 +95,6 @@ struct Q_QML_EXPORT QmlListWrapper : Object
static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver);
- static void virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes);
static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m);
};
diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp
index 29f37fc217..2612518cb8 100644
--- a/src/qml/qml/qqmlvaluetypewrapper.cpp
+++ b/src/qml/qml/qqmlvaluetypewrapper.cpp
@@ -254,34 +254,6 @@ PropertyAttributes QQmlValueTypeWrapper::virtualGetOwnProperty(Managed *m, Prope
return QV4::Object::virtualGetOwnProperty(m, id, p);
}
-void QQmlValueTypeWrapper::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes)
-{
- name->setM(nullptr);
- *index = UINT_MAX;
-
- QQmlValueTypeWrapper *that = static_cast<QQmlValueTypeWrapper*>(m);
-
- if (QQmlValueTypeReference *ref = that->as<QQmlValueTypeReference>()) {
- if (!ref->readReferenceValue())
- return;
- }
-
- if (that->d()->propertyCache()) {
- const QMetaObject *mo = that->d()->propertyCache()->createMetaObject();
- const int propertyCount = mo->propertyCount();
- if (it->arrayIndex < static_cast<uint>(propertyCount)) {
- Scope scope(that->engine());
- ScopedString propName(scope, that->engine()->newString(QString::fromUtf8(mo->property(it->arrayIndex).name())));
- name->setM(propName->d());
- ++it->arrayIndex;
- *attributes = QV4::Attr_Data;
- p->value = that->QV4::Object::get(propName);
- return;
- }
- }
- QV4::Object::virtualAdvanceIterator(m, it, name, index, p, attributes);
-}
-
struct QQmlValueTypeWrapperOwnPropertyKeyIterator : ObjectOwnPropertyKeyIterator
{
int propertyIndex = 0;
diff --git a/src/qml/qml/qqmlvaluetypewrapper_p.h b/src/qml/qml/qqmlvaluetypewrapper_p.h
index 2df4dbb257..a1d3b74a45 100644
--- a/src/qml/qml/qqmlvaluetypewrapper_p.h
+++ b/src/qml/qml/qqmlvaluetypewrapper_p.h
@@ -110,7 +110,6 @@ public:
static bool virtualPut(Managed *m, PropertyKey id, const Value &value, Value *receiver);
static bool virtualIsEqualTo(Managed *m, Managed *other);
static PropertyAttributes virtualGetOwnProperty(Managed *m, PropertyKey id, Property *p);
- static void virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes);
static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m);
static ReturnedValue method_toString(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc);
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index 1ad4a5aa9e..60cd618e9f 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -219,16 +219,6 @@ ReturnedValue QtObject::virtualGet(const Managed *m, PropertyKey id, const Value
return ret;
}
-void QtObject::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes)
-{
- auto that = static_cast<QtObject*>(m);
- if (!that->d()->isComplete()) {
- that->addAll();
- }
-
- QV4::Object::virtualAdvanceIterator(m, it, name, index, p, attributes);
-}
-
OwnPropertyKeyIterator *QtObject::virtualOwnPropertyKeys(const Object *m)
{
auto that = static_cast<const QtObject*>(m);
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
index 896a9960b9..5dba1544e9 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
@@ -94,7 +94,6 @@ struct QtObject : Object
V4_OBJECT2(QtObject, Object)
static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
- static void virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes);
static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m);
static ReturnedValue method_isQtObject(const FunctionObject *b, const Value *thisObject, const Value *argv, int argc);
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 30e5b83d5c..8d1ea6f828 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -1610,29 +1610,6 @@ ReturnedValue ModelObject::virtualGet(const Managed *m, PropertyKey id, const Va
return that->engine()->fromVariant(value);
}
-void ModelObject::virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes)
-{
- ModelObject *that = static_cast<ModelObject*>(m);
- ExecutionEngine *v4 = that->engine();
- name->setM(nullptr);
- *index = UINT_MAX;
- if (it->arrayIndex < uint(that->d()->m_model->m_listModel->roleCount())) {
- Scope scope(that->engine());
- const ListLayout::Role &role = that->d()->m_model->m_listModel->getExistingRole(it->arrayIndex);
- ++it->arrayIndex;
- ScopedString roleName(scope, v4->newString(role.name));
- name->setM(roleName->d());
- *attributes = QV4::Attr_Data;
- QVariant value = that->d()->m_model->data(that->d()->elementIndex(), role.index);
- p->value = v4->fromVariant(value);
- return;
- }
- // Fall back to QV4::Object as opposed to QV4::QObjectWrapper otherwise it will add
- // unnecessary entries that relate to the roles used. These just create extra work
- // later on as they will just be ignored.
- QV4::Object::virtualAdvanceIterator(m, it, name, index, p, attributes);
-}
-
struct ModelObjectOwnPropertyKeyIterator : ObjectOwnPropertyKeyIterator
{
int roleNameIndex = 0;
diff --git a/src/qml/types/qqmllistmodel_p_p.h b/src/qml/types/qqmllistmodel_p_p.h
index dbd0b0a2a2..46a41ac8c8 100644
--- a/src/qml/types/qqmllistmodel_p_p.h
+++ b/src/qml/types/qqmllistmodel_p_p.h
@@ -181,7 +181,6 @@ struct ModelObject : public QObjectWrapper
protected:
static bool virtualPut(Managed *m, PropertyKey id, const Value& value, Value *receiver);
static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
- static void virtualAdvanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes);
static OwnPropertyKeyIterator *virtualOwnPropertyKeys(const Object *m);
};