diff options
Diffstat (limited to 'deps/v8/src/objects/hash-table-inl.h')
-rw-r--r-- | deps/v8/src/objects/hash-table-inl.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/deps/v8/src/objects/hash-table-inl.h b/deps/v8/src/objects/hash-table-inl.h index b807851d85..d4c96f4df4 100644 --- a/deps/v8/src/objects/hash-table-inl.h +++ b/deps/v8/src/objects/hash-table-inl.h @@ -7,6 +7,7 @@ #include "src/objects/hash-table.h" +#include "src/execution/isolate-utils-inl.h" #include "src/heap/heap.h" #include "src/objects/fixed-array-inl.h" #include "src/objects/heap-object-inl.h" @@ -179,6 +180,17 @@ bool HashTable<Derived, Shape>::ToKey(Isolate* isolate, int entry, } template <typename Derived, typename Shape> +Object HashTable<Derived, Shape>::KeyAt(int entry) { + Isolate* isolate = GetIsolateForPtrCompr(*this); + return KeyAt(isolate, entry); +} + +template <typename Derived, typename Shape> +Object HashTable<Derived, Shape>::KeyAt(Isolate* isolate, int entry) { + return get(isolate, EntryToIndex(entry) + kEntryKeyIndex); +} + +template <typename Derived, typename Shape> void HashTable<Derived, Shape>::set_key(int index, Object value) { DCHECK(!IsEphemeronHashTable()); FixedArray::set(index, value); @@ -191,6 +203,16 @@ void HashTable<Derived, Shape>::set_key(int index, Object value, FixedArray::set(index, value, mode); } +template <typename Derived, typename Shape> +void HashTable<Derived, Shape>::SetCapacity(int capacity) { + // To scale a computed hash code to fit within the hash table, we + // use bit-wise AND with a mask, so the capacity must be positive + // and non-zero. + DCHECK_GT(capacity, 0); + DCHECK_LE(capacity, kMaxCapacity); + set(kCapacityIndex, Smi::FromInt(capacity)); +} + template <typename KeyT> bool BaseShape<KeyT>::IsKey(ReadOnlyRoots roots, Object key) { return IsLive(roots, key); |