X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/2d39b0e377c0896910ee49ae70082ba665faf986..ed1e77d3adeb83d26fd1dfb16dd84cabdcefd250:/runtime/JSSetIterator.h?ds=sidebyside diff --git a/runtime/JSSetIterator.h b/runtime/JSSetIterator.h index 0ecd19e..6dad6b1 100644 --- a/runtime/JSSetIterator.h +++ b/runtime/JSSetIterator.h @@ -58,33 +58,45 @@ public: bool next(CallFrame* callFrame, JSValue& value) { - if (!m_iterator.ensureSlot()) + WTF::KeyValuePair 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 m_iteratedObjectData; - MapData::const_iterator m_iterator; + WriteBarrier m_set; + JSSet::SetData::IteratorData m_iterator; SetIterationKind m_kind; };