1 // Copyright 2018 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_OBJECTS_ORDERED_HASH_TABLE_INL_H_ 6 #define V8_OBJECTS_ORDERED_HASH_TABLE_INL_H_ 7 8 #include "src/objects/ordered-hash-table.h" 9 10 #include "src/heap/heap.h" 11 #include "src/objects/fixed-array-inl.h" 12 13 namespace v8 { 14 namespace internal { 15 16 int OrderedHashSet::GetMapRootIndex() { 17 return Heap::kOrderedHashSetMapRootIndex; 18 } 19 20 int OrderedHashMap::GetMapRootIndex() { 21 return Heap::kOrderedHashMapMapRootIndex; 22 } 23 24 int SmallOrderedHashMap::GetMapRootIndex() { 25 return Heap::kSmallOrderedHashMapMapRootIndex; 26 } 27 28 int SmallOrderedHashSet::GetMapRootIndex() { 29 return Heap::kSmallOrderedHashSetMapRootIndex; 30 } 31 32 inline Object* OrderedHashMap::ValueAt(int entry) { 33 DCHECK_LT(entry, this->UsedCapacity()); 34 return get(EntryToIndex(entry) + kValueOffset); 35 } 36 37 inline bool OrderedHashSet::Is(Handle<HeapObject> table) { 38 return table->IsOrderedHashSet(); 39 } 40 41 inline bool OrderedHashMap::Is(Handle<HeapObject> table) { 42 return table->IsOrderedHashMap(); 43 } 44 45 inline bool SmallOrderedHashSet::Is(Handle<HeapObject> table) { 46 return table->IsSmallOrderedHashSet(); 47 } 48 49 inline bool SmallOrderedHashMap::Is(Handle<HeapObject> table) { 50 return table->IsSmallOrderedHashMap(); 51 } 52 } // namespace internal 53 } // namespace v8 54 55 #endif // V8_OBJECTS_ORDERED_HASH_TABLE_INL_H_ 56