diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/runtime/SparseArrayValueMap.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/JavaScriptCore/runtime/SparseArrayValueMap.h')
-rw-r--r-- | Source/JavaScriptCore/runtime/SparseArrayValueMap.h | 24 |
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 - |