diff options
Diffstat (limited to 'deps/v8/src/objects/hash-table-inl.h')
-rw-r--r-- | deps/v8/src/objects/hash-table-inl.h | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/deps/v8/src/objects/hash-table-inl.h b/deps/v8/src/objects/hash-table-inl.h index aef7d7230b..11aa0392c0 100644 --- a/deps/v8/src/objects/hash-table-inl.h +++ b/deps/v8/src/objects/hash-table-inl.h @@ -58,26 +58,25 @@ int BaseShape<Key>::GetMapRootIndex() { return Heap::kHashTableMapRootIndex; } -template <typename Derived, typename Shape> -int HashTable<Derived, Shape>::FindEntry(Key key) { - return FindEntry(GetIsolate(), key); +int EphemeronHashTableShape::GetMapRootIndex() { + return Heap::kEphemeronHashTableMapRootIndex; } template <typename Derived, typename Shape> int HashTable<Derived, Shape>::FindEntry(Isolate* isolate, Key key) { - return FindEntry(isolate, key, Shape::Hash(isolate, key)); + return FindEntry(ReadOnlyRoots(isolate), key, Shape::Hash(isolate, key)); } // Find entry for key otherwise return kNotFound. template <typename Derived, typename Shape> -int HashTable<Derived, Shape>::FindEntry(Isolate* isolate, Key key, +int HashTable<Derived, Shape>::FindEntry(ReadOnlyRoots roots, Key key, int32_t hash) { uint32_t capacity = Capacity(); uint32_t entry = FirstProbe(hash, capacity); uint32_t count = 1; // EnsureCapacity will guarantee the hash table is never full. - Object* undefined = isolate->heap()->undefined_value(); - Object* the_hole = isolate->heap()->the_hole_value(); + Object* undefined = roots.undefined_value(); + Object* the_hole = roots.the_hole_value(); USE(the_hole); while (true) { Object* element = KeyAt(entry); @@ -93,28 +92,27 @@ int HashTable<Derived, Shape>::FindEntry(Isolate* isolate, Key key, } template <typename Derived, typename Shape> -bool HashTable<Derived, Shape>::IsKey(Isolate* isolate, Object* k) { - return Shape::IsKey(isolate, k); +bool HashTable<Derived, Shape>::IsKey(ReadOnlyRoots roots, Object* k) { + return Shape::IsKey(roots, k); } template <typename Derived, typename Shape> -bool HashTable<Derived, Shape>::ToKey(Isolate* isolate, int entry, +bool HashTable<Derived, Shape>::ToKey(ReadOnlyRoots roots, int entry, Object** out_k) { Object* k = KeyAt(entry); - if (!IsKey(isolate, k)) return false; + if (!IsKey(roots, k)) return false; *out_k = Shape::Unwrap(k); return true; } template <typename KeyT> -bool BaseShape<KeyT>::IsKey(Isolate* isolate, Object* key) { - return IsLive(isolate, key); +bool BaseShape<KeyT>::IsKey(ReadOnlyRoots roots, Object* key) { + return IsLive(roots, key); } template <typename KeyT> -bool BaseShape<KeyT>::IsLive(Isolate* isolate, Object* k) { - Heap* heap = isolate->heap(); - return k != heap->the_hole_value() && k != heap->undefined_value(); +bool BaseShape<KeyT>::IsLive(ReadOnlyRoots roots, Object* k) { + return k != roots.the_hole_value() && k != roots.undefined_value(); } template <typename Derived, typename Shape> @@ -131,13 +129,13 @@ const HashTable<Derived, Shape>* HashTable<Derived, Shape>::cast( } bool ObjectHashSet::Has(Isolate* isolate, Handle<Object> key, int32_t hash) { - return FindEntry(isolate, key, hash) != kNotFound; + return FindEntry(ReadOnlyRoots(isolate), key, hash) != kNotFound; } bool ObjectHashSet::Has(Isolate* isolate, Handle<Object> key) { Object* hash = key->GetHash(); if (!hash->IsSmi()) return false; - return FindEntry(isolate, key, Smi::ToInt(hash)) != kNotFound; + return FindEntry(ReadOnlyRoots(isolate), key, Smi::ToInt(hash)) != kNotFound; } } // namespace internal |