summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/WeakMapData.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/runtime/WeakMapData.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/JavaScriptCore/runtime/WeakMapData.h')
-rw-r--r--Source/JavaScriptCore/runtime/WeakMapData.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/Source/JavaScriptCore/runtime/WeakMapData.h b/Source/JavaScriptCore/runtime/WeakMapData.h
index 0cb7b735a..6a4d4f89a 100644
--- a/Source/JavaScriptCore/runtime/WeakMapData.h
+++ b/Source/JavaScriptCore/runtime/WeakMapData.h
@@ -23,8 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WeakMapData_h
-#define WeakMapData_h
+#pragma once
#include "JSCell.h"
#include "Structure.h"
@@ -34,9 +33,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 +47,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,11 +60,16 @@ public:
DECLARE_INFO;
- static const unsigned StructureFlags = OverridesVisitChildren | Base::StructureFlags;
+ typedef HashMap<JSObject*, WriteBarrier<Unknown>> 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&);
static void destroy(JSCell*);
+ static size_t estimatedSize(JSCell*);
static void visitChildren(JSCell*, SlotVisitor&);
void finishCreation(VM&);
@@ -76,16 +80,13 @@ private:
{
}
private:
- virtual void visitWeakReferences(SlotVisitor&) override;
- virtual void finalizeUnconditionally() override;
- int m_liveKeyCount;
+ void visitWeakReferences(SlotVisitor&) override;
+ void finalizeUnconditionally() override;
+ unsigned m_liveKeyCount;
WeakMapData* m_target;
};
DeadKeyCleaner m_deadKeyCleaner;
- typedef HashMap<JSObject*, WriteBarrier<Unknown>> MapType;
MapType m_map;
};
-}
-
-#endif /* !defined(WeakMapData_h) */
+} // namespace JSC