diff options
Diffstat (limited to 'deps/v8/src/objects/dictionary.h')
-rw-r--r-- | deps/v8/src/objects/dictionary.h | 70 |
1 files changed, 19 insertions, 51 deletions
diff --git a/deps/v8/src/objects/dictionary.h b/deps/v8/src/objects/dictionary.h index 11cf8b1163..5cf6bfb67d 100644 --- a/deps/v8/src/objects/dictionary.h +++ b/deps/v8/src/objects/dictionary.h @@ -92,7 +92,7 @@ class BaseDictionaryShape : public BaseShape<Key> { template <typename Dictionary> static inline PropertyDetails DetailsAt(Dictionary* dict, int entry) { STATIC_ASSERT(Dictionary::kEntrySize == 3); - DCHECK(entry >= 0); // Not found is -1, which is not caught by get(). + DCHECK_GE(entry, 0); // Not found is -1, which is not caught by get(). return PropertyDetails(Smi::cast(dict->get( Dictionary::EntryToIndex(entry) + Dictionary::kEntryDetailsIndex))); } @@ -112,6 +112,7 @@ class NameDictionaryShape : public BaseDictionaryShape<Handle<Name>> { static inline uint32_t Hash(Isolate* isolate, Handle<Name> key); static inline uint32_t HashForObject(Isolate* isolate, Object* object); static inline Handle<Object> AsHandle(Isolate* isolate, Handle<Name> key); + static inline int GetMapRootIndex(); static const int kPrefixSize = 2; static const int kEntrySize = 3; static const int kEntryValueIndex = 1; @@ -171,6 +172,10 @@ class BaseNameDictionary : public Dictionary<Derived, Shape> { // Ensure enough space for n additional elements. static Handle<Derived> EnsureCapacity(Handle<Derived> dictionary, int n); + MUST_USE_RESULT static Handle<Derived> AddNoUpdateNextEnumerationIndex( + Handle<Derived> dictionary, Key key, Handle<Object> value, + PropertyDetails details, int* entry_out = nullptr); + MUST_USE_RESULT static Handle<Derived> Add(Handle<Derived> dictionary, Key key, Handle<Object> value, PropertyDetails details, @@ -207,6 +212,7 @@ class GlobalDictionaryShape : public NameDictionaryShape { static inline Object* Unwrap(Object* key); static inline bool IsKey(Isolate* isolate, Object* k); static inline bool IsLive(Isolate* isolate, Object* key); + static inline int GetMapRootIndex(); }; class GlobalDictionary @@ -224,57 +230,33 @@ class GlobalDictionary class NumberDictionaryShape : public BaseDictionaryShape<uint32_t> { public: - static inline bool IsMatch(uint32_t key, Object* other); - static inline Handle<Object> AsHandle(Isolate* isolate, uint32_t key); -}; - -class SeededNumberDictionaryShape : public NumberDictionaryShape { - public: static const int kPrefixSize = 1; static const int kEntrySize = 3; - static inline uint32_t Hash(Isolate* isolate, uint32_t key); - static inline uint32_t HashForObject(Isolate* isolate, Object* object); -}; - -class UnseededNumberDictionaryShape : public NumberDictionaryShape { - public: - static const bool kHasDetails = false; - static const int kPrefixSize = 0; - static const int kEntrySize = 2; + static inline bool IsMatch(uint32_t key, Object* other); + static inline Handle<Object> AsHandle(Isolate* isolate, uint32_t key); static inline uint32_t Hash(Isolate* isolate, uint32_t key); static inline uint32_t HashForObject(Isolate* isolate, Object* object); - template <typename Dictionary> - static inline PropertyDetails DetailsAt(Dictionary* dict, int entry) { - UNREACHABLE(); - } - - template <typename Dictionary> - static inline void DetailsAtPut(Dictionary* dict, int entry, - PropertyDetails value) { - UNREACHABLE(); - } - - static inline Map* GetMap(Isolate* isolate); + static inline int GetMapRootIndex(); }; -extern template class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) - HashTable<SeededNumberDictionary, SeededNumberDictionaryShape>; +extern template class EXPORT_TEMPLATE_DECLARE( + V8_EXPORT_PRIVATE) HashTable<NumberDictionary, NumberDictionaryShape>; extern template class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) - Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape>; + Dictionary<NumberDictionary, NumberDictionaryShape>; -class SeededNumberDictionary - : public Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape> { +class NumberDictionary + : public Dictionary<NumberDictionary, NumberDictionaryShape> { public: - DECL_CAST(SeededNumberDictionary) + DECL_CAST(NumberDictionary) // Type specific at put (default NONE attributes is used when adding). - MUST_USE_RESULT static Handle<SeededNumberDictionary> Set( - Handle<SeededNumberDictionary> dictionary, uint32_t key, - Handle<Object> value, Handle<JSObject> dictionary_holder, + MUST_USE_RESULT static Handle<NumberDictionary> Set( + Handle<NumberDictionary> dictionary, uint32_t key, Handle<Object> value, + Handle<JSObject> dictionary_holder = Handle<JSObject>::null(), PropertyDetails details = PropertyDetails::Empty()); static const int kMaxNumberKeyIndex = kPrefixStartIndex; @@ -313,20 +295,6 @@ class SeededNumberDictionary static const uint32_t kPreferFastElementsSizeFactor = 3; }; -class UnseededNumberDictionary - : public Dictionary<UnseededNumberDictionary, - UnseededNumberDictionaryShape> { - public: - DECL_CAST(UnseededNumberDictionary) - - // Type specific at put (default NONE attributes is used when adding). - MUST_USE_RESULT static Handle<UnseededNumberDictionary> Set( - Handle<UnseededNumberDictionary> dictionary, uint32_t key, - Handle<Object> value); - - static const int kEntryValueIndex = 1; -}; - } // namespace internal } // namespace v8 |