bool next(CallFrame* callFrame, JSValue& value)
{
- if (!m_iterator.ensureSlot())
+ WTF::KeyValuePair<JSValue, JSValue> pair;
+ if (!m_iterator.next(pair))
return false;
if (m_kind == SetIterateValue || m_kind == SetIterateKey)
- value = m_iterator.key();
+ value = pair.key;
else
- value = createPair(callFrame, m_iterator.key(), m_iterator.key());
- ++m_iterator;
+ value = createPair(callFrame, pair.key, pair.key);
return true;
}
-private:
+ void finish()
+ {
+ m_iterator.finish();
+ }
- static const unsigned StructureFlags = Base::StructureFlags | OverridesVisitChildren;
+ SetIterationKind kind() const { return m_kind; }
+ JSValue iteratedValue() const { return m_set.get(); }
+ JSSetIterator* clone(ExecState*);
+ JSSet::SetData::IteratorData* iteratorData()
+ {
+ return &m_iterator;
+ }
+
+private:
JSSetIterator(VM& vm, Structure* structure, JSSet* iteratedObject, SetIterationKind kind)
: Base(vm, structure)
- , m_iterator(iteratedObject->mapData()->begin())
+ , m_iterator(iteratedObject->m_setData.createIteratorData(this))
, m_kind(kind)
{
}
- void finishCreation(VM&, JSSet*);
- JSValue createPair(CallFrame*, JSValue, JSValue);
+ static void destroy(JSCell*);
+ JS_EXPORT_PRIVATE void finishCreation(VM&, JSSet*);
+ JS_EXPORT_PRIVATE JSValue createPair(CallFrame*, JSValue, JSValue);
static void visitChildren(JSCell*, SlotVisitor&);
- WriteBarrier<MapData> m_iteratedObjectData;
- MapData::const_iterator m_iterator;
+ WriteBarrier<JSSet> m_set;
+ JSSet::SetData::IteratorData m_iterator;
SetIterationKind m_kind;
};