diff options
Diffstat (limited to 'deps/v8/src/objects/dictionary.h')
-rw-r--r-- | deps/v8/src/objects/dictionary.h | 80 |
1 files changed, 41 insertions, 39 deletions
diff --git a/deps/v8/src/objects/dictionary.h b/deps/v8/src/objects/dictionary.h index 66b601dbca..04a06960c9 100644 --- a/deps/v8/src/objects/dictionary.h +++ b/deps/v8/src/objects/dictionary.h @@ -41,8 +41,7 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) Dictionary inline PropertyDetails DetailsAt(InternalIndex entry); // Set the details for entry. - inline void DetailsAtPut(Isolate* isolate, InternalIndex entry, - PropertyDetails value); + inline void DetailsAtPut(InternalIndex entry, PropertyDetails value); // Delete a property from the dictionary. V8_WARN_UNUSED_RESULT static Handle<Derived> DeleteEntry( @@ -66,15 +65,16 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) Dictionary Object SlowReverseLookup(Object value); // Sets the entry to (key, value) pair. - inline void ClearEntry(Isolate* isolate, InternalIndex entry); - inline void SetEntry(Isolate* isolate, InternalIndex entry, Object key, - Object value, PropertyDetails details); + inline void ClearEntry(InternalIndex entry); + inline void SetEntry(InternalIndex entry, Object key, Object value, + PropertyDetails details); // Garbage collection support. inline ObjectSlot RawFieldOfValueAt(InternalIndex entry); + template <typename LocalIsolate> V8_WARN_UNUSED_RESULT static Handle<Derived> Add( - Isolate* isolate, Handle<Derived> dictionary, Key key, + LocalIsolate* isolate, Handle<Derived> dictionary, Key key, Handle<Object> value, PropertyDetails details, InternalIndex* entry_out = nullptr); @@ -89,6 +89,11 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) Dictionary OBJECT_CONSTRUCTORS(Dictionary, HashTable<Derived, Shape>); }; +#define EXTERN_DECLARE_DICTIONARY(DERIVED, SHAPE) \ + EXTERN_DECLARE_HASH_TABLE(DERIVED, SHAPE) \ + extern template class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) \ + Dictionary<DERIVED, SHAPE>; + template <typename Key> class BaseDictionaryShape : public BaseShape<Key> { public: @@ -97,17 +102,19 @@ class BaseDictionaryShape : public BaseShape<Key> { static inline PropertyDetails DetailsAt(Dictionary dict, InternalIndex entry); template <typename Dictionary> - static inline void DetailsAtPut(Isolate* isolate, Dictionary dict, - InternalIndex entry, PropertyDetails value); + static inline void DetailsAtPut(Dictionary dict, InternalIndex entry, + PropertyDetails value); }; class NameDictionaryShape : public BaseDictionaryShape<Handle<Name>> { public: static inline bool IsMatch(Handle<Name> key, Object other); - static inline uint32_t Hash(Isolate* isolate, Handle<Name> key); + static inline uint32_t Hash(ReadOnlyRoots roots, Handle<Name> key); static inline uint32_t HashForObject(ReadOnlyRoots roots, Object object); static inline Handle<Object> AsHandle(Isolate* isolate, Handle<Name> key); - static inline RootIndex GetMapRootIndex(); + static inline Handle<Object> AsHandle(OffThreadIsolate* isolate, + Handle<Name> key); + static inline Handle<Map> GetMap(ReadOnlyRoots roots); static const int kPrefixSize = 2; static const int kEntrySize = 3; static const int kEntryValueIndex = 1; @@ -129,8 +136,9 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) BaseNameDictionary inline int Hash() const; // Creates a new dictionary. + template <typename LocalIsolate> V8_WARN_UNUSED_RESULT static Handle<Derived> New( - Isolate* isolate, int at_least_space_for, + LocalIsolate* isolate, int at_least_space_for, AllocationType allocation = AllocationType::kYoung, MinimumCapacity capacity_option = USE_DEFAULT_MINIMUM_CAPACITY); @@ -157,8 +165,9 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) BaseNameDictionary Handle<FixedArray> storage, KeyCollectionMode mode, KeyAccumulator* accumulator); + template <typename LocalIsolate> V8_WARN_UNUSED_RESULT static Handle<Derived> AddNoUpdateNextEnumerationIndex( - Isolate* isolate, Handle<Derived> dictionary, Key key, + LocalIsolate* isolate, Handle<Derived> dictionary, Key key, Handle<Object> value, PropertyDetails details, InternalIndex* entry_out = nullptr); @@ -170,10 +179,12 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) BaseNameDictionary OBJECT_CONSTRUCTORS(BaseNameDictionary, Dictionary<Derived, Shape>); }; -class NameDictionary; +#define EXTERN_DECLARE_BASE_NAME_DICTIONARY(DERIVED, SHAPE) \ + EXTERN_DECLARE_DICTIONARY(DERIVED, SHAPE) \ + extern template class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) \ + BaseNameDictionary<DERIVED, SHAPE>; -extern template class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) - BaseNameDictionary<NameDictionary, NameDictionaryShape>; +EXTERN_DECLARE_BASE_NAME_DICTIONARY(NameDictionary, NameDictionaryShape) class V8_EXPORT_PRIVATE NameDictionary : public BaseNameDictionary<NameDictionary, NameDictionaryShape> { @@ -205,19 +216,16 @@ class V8_EXPORT_PRIVATE GlobalDictionaryShape : public NameDictionaryShape { static inline PropertyDetails DetailsAt(Dictionary dict, InternalIndex entry); template <typename Dictionary> - static inline void DetailsAtPut(Isolate* isolate, Dictionary dict, - InternalIndex entry, PropertyDetails value); + static inline void DetailsAtPut(Dictionary dict, InternalIndex entry, + PropertyDetails value); static inline Object Unwrap(Object key); static inline bool IsKey(ReadOnlyRoots roots, Object k); static inline bool IsLive(ReadOnlyRoots roots, Object key); - static inline RootIndex GetMapRootIndex(); + static inline Handle<Map> GetMap(ReadOnlyRoots roots); }; -class GlobalDictionary; - -extern template class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) - BaseNameDictionary<GlobalDictionary, GlobalDictionaryShape>; +EXTERN_DECLARE_BASE_NAME_DICTIONARY(GlobalDictionary, GlobalDictionaryShape) class V8_EXPORT_PRIVATE GlobalDictionary : public BaseNameDictionary<GlobalDictionary, GlobalDictionaryShape> { @@ -228,8 +236,8 @@ class V8_EXPORT_PRIVATE GlobalDictionary inline Object ValueAt(const Isolate* isolate, InternalIndex entry); inline PropertyCell CellAt(InternalIndex entry); inline PropertyCell CellAt(const Isolate* isolate, InternalIndex entry); - inline void SetEntry(Isolate* isolate, InternalIndex entry, Object key, - Object value, PropertyDetails details); + inline void SetEntry(InternalIndex entry, Object key, Object value, + PropertyDetails details); inline Name NameAt(InternalIndex entry); inline Name NameAt(const Isolate* isolate, InternalIndex entry); inline void ValueAtPut(InternalIndex entry, Object value); @@ -243,8 +251,10 @@ class NumberDictionaryBaseShape : public BaseDictionaryShape<uint32_t> { public: static inline bool IsMatch(uint32_t key, Object other); static inline Handle<Object> AsHandle(Isolate* isolate, uint32_t key); + static inline Handle<Object> AsHandle(OffThreadIsolate* isolate, + uint32_t key); - static inline uint32_t Hash(Isolate* isolate, uint32_t key); + static inline uint32_t Hash(ReadOnlyRoots roots, uint32_t key); static inline uint32_t HashForObject(ReadOnlyRoots roots, Object object); }; @@ -253,7 +263,7 @@ class NumberDictionaryShape : public NumberDictionaryBaseShape { static const int kPrefixSize = 1; static const int kEntrySize = 3; - static inline RootIndex GetMapRootIndex(); + static inline Handle<Map> GetMap(ReadOnlyRoots roots); }; class SimpleNumberDictionaryShape : public NumberDictionaryBaseShape { @@ -269,19 +279,15 @@ class SimpleNumberDictionaryShape : public NumberDictionaryBaseShape { } template <typename Dictionary> - static inline void DetailsAtPut(Isolate* isolate, Dictionary dict, - InternalIndex entry, PropertyDetails value) { + static inline void DetailsAtPut(Dictionary dict, InternalIndex entry, + PropertyDetails value) { UNREACHABLE(); } - static inline RootIndex GetMapRootIndex(); + static inline Handle<Map> GetMap(ReadOnlyRoots roots); }; -extern template class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) - HashTable<SimpleNumberDictionary, SimpleNumberDictionaryShape>; - -extern template class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) - Dictionary<SimpleNumberDictionary, SimpleNumberDictionaryShape>; +EXTERN_DECLARE_DICTIONARY(SimpleNumberDictionary, SimpleNumberDictionaryShape) // SimpleNumberDictionary is used to map number to an entry. class SimpleNumberDictionary @@ -300,11 +306,7 @@ class SimpleNumberDictionary Dictionary<SimpleNumberDictionary, SimpleNumberDictionaryShape>); }; -extern template class EXPORT_TEMPLATE_DECLARE( - V8_EXPORT_PRIVATE) HashTable<NumberDictionary, NumberDictionaryShape>; - -extern template class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) - Dictionary<NumberDictionary, NumberDictionaryShape>; +EXTERN_DECLARE_DICTIONARY(NumberDictionary, NumberDictionaryShape) // NumberDictionary is used as elements backing store and provides a bitfield // and stores property details for every entry. |