summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/SparseArrayValueMap.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/runtime/SparseArrayValueMap.h')
-rw-r--r--Source/JavaScriptCore/runtime/SparseArrayValueMap.h24
1 files changed, 8 insertions, 16 deletions
diff --git a/Source/JavaScriptCore/runtime/SparseArrayValueMap.h b/Source/JavaScriptCore/runtime/SparseArrayValueMap.h
index 113beb350..1c7dcb256 100644
--- a/Source/JavaScriptCore/runtime/SparseArrayValueMap.h
+++ b/Source/JavaScriptCore/runtime/SparseArrayValueMap.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-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,8 +23,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SparseArrayValueMap_h
-#define SparseArrayValueMap_h
+#pragma once
#include "JSCell.h"
#include "JSTypeInfo.h"
@@ -32,7 +31,6 @@
#include "PutDirectIndexMode.h"
#include "WriteBarrier.h"
#include <wtf/HashMap.h>
-#include <wtf/Platform.h>
namespace JSC {
@@ -43,18 +41,18 @@ struct SparseArrayEntry : public WriteBarrier<Unknown> {
SparseArrayEntry() : attributes(0) { }
- JSValue get(ExecState*, JSObject*) const;
void get(JSObject*, PropertySlot&) const;
void get(PropertyDescriptor&) const;
- void put(ExecState*, JSValue thisValue, SparseArrayValueMap*, JSValue, bool shouldThrow);
+ bool put(ExecState*, JSValue thisValue, SparseArrayValueMap*, JSValue, bool shouldThrow);
JSValue getNonSparseMode() const;
unsigned attributes;
};
-class SparseArrayValueMap : public JSCell {
+class SparseArrayValueMap final : public JSCell {
public:
typedef JSCell Base;
+ static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
private:
typedef HashMap<uint64_t, SparseArrayEntry, WTF::IntHash<uint64_t>, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> Map;
@@ -70,8 +68,6 @@ private:
void finishCreation(VM&);
- static const unsigned StructureFlags = OverridesVisitChildren | JSCell::StructureFlags;
-
public:
DECLARE_EXPORT_INFO;
@@ -82,7 +78,6 @@ public:
static SparseArrayValueMap* create(VM&);
static const bool needsDestruction = true;
- static const bool hasImmortalStructure = true;
static void destroy(JSCell*);
static Structure* createStructure(VM&, JSGlobalObject*, JSValue prototype);
@@ -110,13 +105,13 @@ public:
}
// These methods may mutate the contents of the map
- void putEntry(ExecState*, JSObject*, unsigned, JSValue, bool shouldThrow);
+ bool putEntry(ExecState*, JSObject*, unsigned, JSValue, bool shouldThrow);
bool putDirect(ExecState*, JSObject*, unsigned, JSValue, unsigned attributes, PutDirectIndexMode);
AddResult add(JSObject*, unsigned);
iterator find(unsigned i) { return m_map.find(i); }
// This should ASSERT the remove is valid (check the result of the find).
- void remove(iterator it) { m_map.remove(it); }
- void remove(unsigned i) { m_map.remove(i); }
+ void remove(iterator it);
+ void remove(unsigned i);
// These methods do not mutate the contents of the map.
iterator notFound() { return m_map.end(); }
@@ -134,6 +129,3 @@ private:
};
} // namespace JSC
-
-#endif // SparseArrayValueMap_h
-