class Identifier;
class JSObject;
+ class LLIntOffsetsExtractor;
class JSPropertyNameIterator : public JSCell {
friend class JIT;
public:
- static JSPropertyNameIterator* create(ExecState*, JSObject*);
-
- static PassRefPtr<Structure> 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<StructureChain> 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<StructureChain> m_cachedPrototypeChain;
+ WriteBarrier<Structure> m_cachedStructure;
+ WriteBarrier<StructureChain> m_cachedPrototypeChain;
uint32_t m_numCacheableSlots;
uint32_t m_jsStringsSize;
- OwnArrayPtr<JSValue> m_jsStrings;
+ unsigned m_cachedStructureInlineCapacity;
+ OwnArrayPtr<WriteBarrier<Unknown> > m_jsStrings;
};
- inline void Structure::setEnumerationCache(JSPropertyNameIterator* enumerationCache)
+ ALWAYS_INLINE JSPropertyNameIterator* Register::propertyNameIterator() const
{
- ASSERT(!isDictionary());
- m_enumerationCache = enumerationCache;
+ return jsCast<JSPropertyNameIterator*>(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