summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/JSSet.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSSet.h')
-rw-r--r--Source/JavaScriptCore/runtime/JSSet.h39
1 files changed, 15 insertions, 24 deletions
diff --git a/Source/JavaScriptCore/runtime/JSSet.h b/Source/JavaScriptCore/runtime/JSSet.h
index 22c5d860b..e356a7af7 100644
--- a/Source/JavaScriptCore/runtime/JSSet.h
+++ b/Source/JavaScriptCore/runtime/JSSet.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,56 +23,47 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef JSSet_h
-#define JSSet_h
+#pragma once
#include "JSObject.h"
+#include "MapBase.h"
namespace JSC {
-class MapData;
+class JSSetIterator;
-class JSSet : public JSNonFinalObject {
+class JSSet : public MapBase<HashMapBucket<HashMapBucketDataKey>> {
+ typedef MapBase<HashMapBucket<HashMapBucketDataKey>> Base;
public:
- typedef JSNonFinalObject Base;
+
+ friend class JSSetIterator;
DECLARE_EXPORT_INFO;
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
- return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+ return Structure::create(vm, globalObject, prototype, TypeInfo(JSSetType, StructureFlags), info());
}
- static JSSet* create(VM& vm, Structure* structure)
+ static JSSet* create(ExecState* exec, VM& vm, Structure* structure)
{
JSSet* instance = new (NotNull, allocateCell<JSSet>(vm.heap)) JSSet(vm, structure);
- instance->finishCreation(vm);
+ instance->finishCreation(exec, vm);
return instance;
}
- static JSSet* create(ExecState* exec, Structure* structure)
+ ALWAYS_INLINE void add(ExecState* exec, JSValue key)
{
- return create(exec->vm(), structure);
+ m_map->add(exec, key);
}
- MapData* mapData() { return m_mapData.get(); }
-
private:
-
- static const unsigned StructureFlags = OverridesVisitChildren | Base::StructureFlags;
-
JSSet(VM& vm, Structure* structure)
: Base(vm, structure)
{
}
- JS_EXPORT_PRIVATE void finishCreation(VM&);
-
- static void visitChildren(JSCell*, SlotVisitor&);
-
- WriteBarrier<MapData> m_mapData;
+ static String toStringName(const JSObject*, ExecState*);
};
-}
-
-#endif // !defined(JSSet_h)
+} // namespace JSC