X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/f9bf01c6616d5ddcf65b13b33cedf9e387ff7a63..93a3786624b2768d89bfa27e46598dc64e2fb70a:/runtime/JSPropertyNameIterator.h diff --git a/runtime/JSPropertyNameIterator.h b/runtime/JSPropertyNameIterator.h index 3f533a0..ba931b1 100644 --- a/runtime/JSPropertyNameIterator.h +++ b/runtime/JSPropertyNameIterator.h @@ -38,65 +38,79 @@ namespace JSC { class Identifier; class JSObject; + class LLIntOffsetsExtractor; class JSPropertyNameIterator : public JSCell { friend class JIT; public: - static JSPropertyNameIterator* create(ExecState*, JSObject*); - - static PassRefPtr createStructure(JSValue prototype) - { - return Structure::create(prototype, TypeInfo(CompoundType, OverridesMarkChildren), AnonymousSlotCount); - } - - virtual ~JSPropertyNameIterator(); + typedef JSCell Base; - virtual bool isPropertyNameIterator() const { return true; } - - virtual void markChildren(MarkStack&); + static JSPropertyNameIterator* create(ExecState*, JSObject*); - bool getOffset(size_t i, int& offset) + static const bool needsDestruction = true; + static const bool hasImmortalStructure = true; + static void destroy(JSCell*); + + static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - if (i >= m_numCacheableSlots) - return false; - offset = i; - return true; + return Structure::create(vm, globalObject, prototype, TypeInfo(CompoundType, OverridesVisitChildren), &s_info); } + static void visitChildren(JSCell*, SlotVisitor&); + JSValue get(ExecState*, JSObject*, size_t i); size_t size() { return m_jsStringsSize; } - void setCachedStructure(Structure* structure) { m_cachedStructure = structure; } - Structure* cachedStructure() { return m_cachedStructure; } + void setCachedStructure(VM& vm, Structure* structure) + { + ASSERT(!m_cachedStructure); + ASSERT(structure); + m_cachedStructure.set(vm, this, structure); + } + Structure* cachedStructure() { return m_cachedStructure.get(); } - void setCachedPrototypeChain(NonNullPassRefPtr cachedPrototypeChain) { m_cachedPrototypeChain = cachedPrototypeChain; } + void setCachedPrototypeChain(VM& vm, StructureChain* cachedPrototypeChain) { m_cachedPrototypeChain.set(vm, this, cachedPrototypeChain); } StructureChain* cachedPrototypeChain() { return m_cachedPrototypeChain.get(); } + + static JS_EXPORTDATA const ClassInfo s_info; + + protected: + void finishCreation(ExecState* exec, PropertyNameArrayData* propertyNameArrayData, JSObject* object) + { + Base::finishCreation(exec->vm()); + PropertyNameArrayData::PropertyNameVector& propertyNameVector = propertyNameArrayData->propertyNameVector(); + for (size_t i = 0; i < m_jsStringsSize; ++i) + m_jsStrings[i].set(exec->vm(), this, jsOwnedString(exec, propertyNameVector[i].string())); + m_cachedStructureInlineCapacity = object->structure()->inlineCapacity(); + } private: + friend class LLIntOffsetsExtractor; + JSPropertyNameIterator(ExecState*, PropertyNameArrayData* propertyNameArrayData, size_t numCacheableSlot); - Structure* m_cachedStructure; - RefPtr m_cachedPrototypeChain; + WriteBarrier m_cachedStructure; + WriteBarrier m_cachedPrototypeChain; uint32_t m_numCacheableSlots; uint32_t m_jsStringsSize; - OwnArrayPtr m_jsStrings; + unsigned m_cachedStructureInlineCapacity; + OwnArrayPtr > m_jsStrings; }; - inline void Structure::setEnumerationCache(JSPropertyNameIterator* enumerationCache) + ALWAYS_INLINE JSPropertyNameIterator* Register::propertyNameIterator() const { - ASSERT(!isDictionary()); - m_enumerationCache = enumerationCache; + return jsCast(jsValue().asCell()); } - inline void Structure::clearEnumerationCache(JSPropertyNameIterator* enumerationCache) + inline JSPropertyNameIterator* StructureRareData::enumerationCache() { - m_enumerationCache.clear(enumerationCache); + return m_enumerationCache.get(); } - - inline JSPropertyNameIterator* Structure::enumerationCache() + + inline void StructureRareData::setEnumerationCache(VM& vm, const Structure* owner, JSPropertyNameIterator* value) { - return m_enumerationCache.get(); + m_enumerationCache.set(vm, owner, value); } } // namespace JSC