summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/JSMap.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/JSMap.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/JavaScriptCore/runtime/JSMap.h')
-rw-r--r--Source/JavaScriptCore/runtime/JSMap.h40
1 files changed, 18 insertions, 22 deletions
diff --git a/Source/JavaScriptCore/runtime/JSMap.h b/Source/JavaScriptCore/runtime/JSMap.h
index 29aa18243..551a2fbeb 100644
--- a/Source/JavaScriptCore/runtime/JSMap.h
+++ b/Source/JavaScriptCore/runtime/JSMap.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,55 +23,51 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef JSMap_h
-#define JSMap_h
+#pragma once
#include "JSObject.h"
+#include "MapBase.h"
namespace JSC {
-class MapData;
+class JSMapIterator;
-class JSMap : public JSNonFinalObject {
+class JSMap : public MapBase<HashMapBucket<HashMapBucketDataKeyValue>> {
+ typedef MapBase<HashMapBucket<HashMapBucketDataKeyValue>> Base;
public:
- typedef JSNonFinalObject Base;
+ friend class JSMapIterator;
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(JSMapType, StructureFlags), info());
}
- static JSMap* create(VM& vm, Structure* structure)
+ static JSMap* create(ExecState* exec, VM& vm, Structure* structure)
{
JSMap* instance = new (NotNull, allocateCell<JSMap>(vm.heap)) JSMap(vm, structure);
- instance->finishCreation(vm);
+ instance->finishCreation(exec, vm);
return instance;
}
- static JSMap* create(ExecState* exec, Structure* structure)
+ ALWAYS_INLINE JSValue get(ExecState* exec, JSValue key)
{
- return create(exec->vm(), structure);
+ return m_map->get(exec, key);
}
- MapData* mapData() { return m_mapData.get(); }
+ ALWAYS_INLINE void set(ExecState* exec, JSValue key, JSValue value)
+ {
+ m_map->add(exec, key, value);
+ }
private:
- static const unsigned StructureFlags = OverridesVisitChildren | Base::StructureFlags;
-
JSMap(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(JSMap_h)
+} // namespace JSC