X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/2d39b0e377c0896910ee49ae70082ba665faf986..ed1e77d3adeb83d26fd1dfb16dd84cabdcefd250:/runtime/WeakMapData.h diff --git a/runtime/WeakMapData.h b/runtime/WeakMapData.h index 07c2032..cfcd853 100644 --- a/runtime/WeakMapData.h +++ b/runtime/WeakMapData.h @@ -34,9 +34,10 @@ namespace JSC { -class WeakMapData : public JSCell { +class WeakMapData final : public JSCell { public: typedef JSCell Base; + static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal; static WeakMapData* create(VM& vm) { @@ -47,11 +48,10 @@ public: static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { - return Structure::create(vm, globalObject, prototype, TypeInfo(CompoundType, StructureFlags), info()); + return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info()); } static const bool needsDestruction = true; - static const bool hasImmortalStructure = true; void set(VM&, JSObject*, JSValue); JSValue get(JSObject*); @@ -61,7 +61,11 @@ public: DECLARE_INFO; - static const unsigned StructureFlags = OverridesVisitChildren | StructureIsImmortal | Base::StructureFlags; + typedef HashMap> MapType; + MapType::const_iterator begin() const { return m_map.begin(); } + MapType::const_iterator end() const { return m_map.end(); } + + int size() const { return m_map.size(); } private: WeakMapData(VM&); @@ -78,11 +82,10 @@ private: private: virtual void visitWeakReferences(SlotVisitor&) override; virtual void finalizeUnconditionally() override; - int m_liveKeyCount; + unsigned m_liveKeyCount; WeakMapData* m_target; }; DeadKeyCleaner m_deadKeyCleaner; - typedef HashMap> MapType; MapType m_map; };