18template <
class Derived,
int entrysize>
28 if (capacity > MaxCapacity()) {
32 NewRangeError(MessageTemplate::kCollectionGrowFailed,
33 isolate->factory()->empty_string()),
36 int num_buckets = capacity / kLoadFactor;
38 Derived::GetMap(isolate->roots_table()),
39 HashTableStartIndex() + num_buckets + (capacity * kEntrySize),
44 for (
int i = 0;
i < num_buckets; ++
i) {
47 raw_table->SetNumberOfBuckets(num_buckets);
48 raw_table->SetNumberOfElements(0);
49 raw_table->SetNumberOfDeletedElements(0);
53template <
class Derived,
int entrysize>
62 Derived::GetMap(isolate->roots_table()), HashTableStartIndex(),
67 raw_table->SetNumberOfBuckets(0);
68 raw_table->SetNumberOfElements(0);
69 raw_table->SetNumberOfDeletedElements(0);
73template <
class Derived,
int entrysize>
74template <
template <
typename>
typename HandleType>
76HandleType<Derived>::MaybeType
78 Isolate* isolate, HandleType<Derived> table) {
79 DCHECK(!table->IsObsolete());
81 int nof = table->NumberOfElements();
82 int nod = table->NumberOfDeletedElements();
83 int capacity = table->Capacity();
84 if ((nof + nod) < capacity)
return table;
89 new_capacity = kInitialCapacity;
90 }
else if (nod >= (capacity >> 1)) {
94 new_capacity = capacity;
96 new_capacity = capacity << 1;
99 return Derived::Rehash(isolate, table, new_capacity);
102template <
class Derived,
int entrysize>
103template <
template <
typename>
typename HandleType>
106 Isolate* isolate, HandleType<Derived> table) {
107 DCHECK(!table->IsObsolete());
109 int nof = table->NumberOfElements();
110 int capacity = table->Capacity();
111 if (nof >= (capacity >> 2))
return table;
112 return Derived::Rehash(isolate, table, capacity / 2).ToHandleChecked();
115template <
class Derived,
int entrysize>
118 DCHECK(!table->IsObsolete());
125 Allocate(isolate, kInitialCapacity, allocation_type).ToHandleChecked();
127 if (table->NumberOfBuckets() > 0) {
129 table->SetNextTable(*new_table);
130 table->SetNumberOfDeletedElements(kClearedTableSentinel);
136template <
class Derived,
int entrysize>
147template <
class Derived,
int entrysize>
150 if (NumberOfElements() == 0) {
175 raw_entry = NextChainEntryRaw(raw_entry);
181template <
template <
typename>
typename HandleType>
182 requires(std::is_convertible_v<HandleType<OrderedHashSet>,
185 Isolate* isolate, HandleType<OrderedHashSet> table,
193 if (raw_table->NumberOfElements() > 0) {
194 int raw_entry = raw_table->HashToEntryRaw(hash);
201 raw_entry = raw_table->NextChainEntryRaw(raw_entry);
206 typename HandleType<OrderedHashSet>::MaybeType table_candidate =
208 if (!table_candidate.ToHandle(&table)) {
209 CHECK(isolate->has_exception());
210 return table_candidate;
215 int bucket = raw_table->HashToBucket(hash);
216 int previous_entry = raw_table->HashToEntryRaw(hash);
217 int nof = raw_table->NumberOfElements();
219 int new_entry = nof + raw_table->NumberOfDeletedElements();
220 int new_index = raw_table->EntryToIndexRaw(new_entry);
221 raw_table->set(new_index, *
key);
222 raw_table->set(new_index + kChainOffset,
Smi::FromInt(previous_entry));
224 raw_table->set(HashTableStartIndex() + bucket,
Smi::FromInt(new_entry));
225 raw_table->SetNumberOfElements(nof + 1);
238 int length = table->NumberOfElements();
239 int nof_buckets = table->NumberOfBuckets();
244 int const kMaxStringTableEntries =
245 isolate->heap()->MaxNumberToStringCacheSize();
249 uint32_t index_value;
253 bool use_cache =
i < kMaxStringTableEntries;
254 key = *isolate->factory()->Uint32ToString(index_value, use_cache);
267 return ro_roots.empty_ordered_hash_set();
271 return ro_roots.empty_ordered_hash_map();
274template <
class Derived,
int entrysize>
275template <
template <
typename>
typename HandleType>
278 Isolate* isolate, HandleType<Derived> table) {
283template <
class Derived,
int entrysize>
284template <
template <
typename>
typename HandleType>
287 Isolate* isolate, HandleType<Derived> table,
int new_capacity) {
288 DCHECK(!table->IsObsolete());
290 typename HandleType<Derived>::MaybeType new_table_candidate =
291 Derived::Allocate(isolate, new_capacity,
296 if (!new_table_candidate.ToHandle(&new_table)) {
297 return new_table_candidate;
299 int new_buckets = new_table->NumberOfBuckets();
301 int removed_holes_index = 0;
306 int old_entry_raw = old_entry.as_int();
308 if (IsHashTableHole(
key, isolate)) {
309 table->SetRemovedIndexAt(removed_holes_index++, old_entry_raw);
314 int bucket =
Smi::ToInt(hash) & (new_buckets - 1);
315 Tagged<Object> chain_entry = new_table->get(HashTableStartIndex() + bucket);
316 new_table->set(HashTableStartIndex() + bucket,
Smi::FromInt(new_entry));
317 int new_index = new_table->EntryToIndexRaw(new_entry);
318 int old_index = table->EntryToIndexRaw(old_entry_raw);
319 for (
int i = 0;
i < entrysize; ++
i) {
321 new_table->set(new_index +
i, value);
323 new_table->set(new_index + kChainOffset, chain_entry);
327 DCHECK_EQ(table->NumberOfDeletedElements(), removed_holes_index);
329 new_table->SetNumberOfElements(table->NumberOfElements());
330 if (table->NumberOfBuckets() > 0) {
332 table->SetNextTable(*new_table);
335 return new_table_candidate;
338template <
template <
typename>
typename HandleType>
339 requires(std::is_convertible_v<HandleType<OrderedHashSet>,
342 Isolate* isolate, HandleType<OrderedHashSet> table) {
343 return Base::Rehash(isolate, table);
346template <
template <
typename>
typename HandleType>
347 requires(std::is_convertible_v<HandleType<OrderedHashSet>,
350 Isolate* isolate, HandleType<OrderedHashSet> table,
int new_capacity) {
351 return Base::Rehash(isolate, table, new_capacity);
365template <
template <
typename>
typename HandleType>
366 requires(std::is_convertible_v<HandleType<OrderedHashMap>,
369 Isolate* isolate, HandleType<OrderedHashMap> table) {
370 return Base::Rehash(isolate, table);
372template <
template <
typename>
typename HandleType>
373 requires(std::is_convertible_v<HandleType<OrderedHashMap>,
376 Isolate* isolate, HandleType<OrderedHashMap> table,
int new_capacity) {
377 return Base::Rehash(isolate, table, new_capacity);
391template <
template <
typename>
typename HandleType>
392 requires(std::is_convertible_v<HandleType<OrderedNameDictionary>,
395 Isolate* isolate, HandleType<OrderedNameDictionary> table,
397 typename HandleType<OrderedNameDictionary>::MaybeType new_table_candidate =
398 Base::Rehash(isolate, table, new_capacity);
400 if (new_table_candidate.ToHandle(&new_table)) {
401 new_table->SetHash(table->Hash());
403 return new_table_candidate;
415template <
class Derived,
int entrysize>
423 int nof = table->NumberOfElements();
424 int nod = table->NumberOfDeletedElements();
425 int index = table->EntryToIndex(entry);
429 for (
int i = 0;
i < entrysize; ++
i) {
430 table->set(index +
i, hash_table_hole);
433 table->SetNumberOfElements(nof - 1);
434 table->SetNumberOfDeletedElements(nod + 1);
455 if (table->NumberOfElements() > 0) {
456 int raw_entry = table->HashToEntryRaw(hash);
465 raw_entry = table->NextChainEntryRaw(raw_entry);
472 if (!table_candidate.
ToHandle(&table)) {
473 return table_candidate;
478 int bucket = raw_table->HashToBucket(hash);
479 int previous_entry = raw_table->HashToEntryRaw(hash);
480 int nof = raw_table->NumberOfElements();
482 int new_entry = nof + raw_table->NumberOfDeletedElements();
483 int new_index = raw_table->EntryToIndexRaw(new_entry);
484 raw_table->set(new_index, *
key);
489 raw_table->SetNumberOfElements(nof + 1);
501template <
typename IsolateT>
519 DCHECK(IsHashTableHole(candidate_key) ||
521 if (candidate_key == raw_key)
return entry;
537 DCHECK(table->FindEntry(isolate, *
key).is_not_found());
541 if (!table_candidate.
ToHandle(&table)) {
542 return table_candidate;
547 int hash =
key->hash();
548 int bucket = raw_table->HashToBucket(hash);
549 int previous_entry = raw_table->HashToEntryRaw(hash);
550 int nof = raw_table->NumberOfElements();
552 int new_entry = nof + raw_table->NumberOfDeletedElements();
553 int new_index = raw_table->EntryToIndexRaw(new_entry);
554 raw_table->set(new_index, *
key);
565 raw_table->SetNumberOfElements(nof + 1);
593 table->SetEntry(entry, hash_table_hole, hash_table_hole, details);
595 int nof = table->NumberOfElements();
596 table->SetNumberOfElements(nof - 1);
597 int nod = table->NumberOfDeletedElements();
598 table->SetNumberOfDeletedElements(nod + 1);
600 return Shrink(isolate, table);
603template <
typename IsolateT>
609template <
typename IsolateT>
620 if (table_candidate.
ToHandle(&table)) {
623 return table_candidate;
628 RootIndex ri = RootIndex::kEmptyOrderedHashSet;
634 RootIndex ri = RootIndex::kEmptyOrderedHashMap;
640 RootIndex ri = RootIndex::kEmptyOrderedPropertyDictionary;
644 if (table_candidate.
ToHandle(&table)) {
648 return table_candidate;
667 return isolate->factory()->NewSmallOrderedHashSet(capacity, allocation);
674 return isolate->factory()->NewSmallOrderedHashMap(capacity, allocation);
681 return isolate->factory()->NewSmallOrderedNameDictionary(capacity,
685template <
class Derived>
689 int num_buckets = capacity / kLoadFactor;
690 int num_chains = capacity;
692 SetNumberOfBuckets(num_buckets);
693 SetNumberOfElements(0);
694 SetNumberOfDeletedElements(0);
695 memset(
reinterpret_cast<void*
>(field_address(PaddingOffset())), 0,
698 Address hashtable_start = GetHashTableStartAddress(capacity);
699 memset(
reinterpret_cast<uint8_t*
>(hashtable_start),
kNotFound,
700 num_buckets + num_chains);
704 capacity * Derived::kEntrySize);
707 for (
int i = 0;
i < num_buckets; ++
i) {
711 for (
int i = 0;
i < num_chains; ++
i) {
715 for (
int i = 0;
i < capacity; ++
i) {
716 for (
int j = 0; j < Derived::kEntrySize; j++) {
717 DCHECK_EQ(ReadOnlyRoots(isolate).the_hole_value(), GetDataEntry(
i, j));
726 if (table->HasKey(isolate,
key))
return table;
728 if (table->UsedCapacity() >= table->Capacity()) {
739 int nof = raw_table->NumberOfElements();
742 int bucket = raw_table->HashToBucket(hash);
743 int previous_entry = raw_table->HashToFirstEntry(hash);
746 int new_entry = nof + raw_table->NumberOfDeletedElements();
749 raw_table->SetFirstEntry(bucket, new_entry);
750 raw_table->SetNextEntry(new_entry, previous_entry);
753 raw_table->SetNumberOfElements(nof + 1);
772 if (table->HasKey(isolate,
key))
return table;
774 if (table->UsedCapacity() >= table->Capacity()) {
784 int nof = raw_table->NumberOfElements();
787 int bucket = raw_table->HashToBucket(hash);
788 int previous_entry = raw_table->HashToFirstEntry(hash);
791 int new_entry = nof + raw_table->NumberOfDeletedElements();
795 raw_table->SetFirstEntry(bucket, new_entry);
796 raw_table->SetNextEntry(new_entry, previous_entry);
799 raw_table->SetNumberOfElements(nof + 1);
823 int raw_entry = HashToFirstEntry(raw_key->hash());
829 if (candidate_key ==
key)
return entry;
830 raw_entry = GetNextEntry(raw_entry);
841 DCHECK(table->FindEntry(isolate, *
key).is_not_found());
843 if (table->UsedCapacity() >= table->Capacity()) {
851 int nof = table->NumberOfElements();
854 int hash =
key->hash();
855 int bucket = table->HashToBucket(hash);
856 int previous_entry = table->HashToFirstEntry(hash);
859 int new_entry = nof + table->NumberOfDeletedElements();
867 table->SetDataEntry(new_entry,
870 table->SetFirstEntry(bucket, new_entry);
871 table->SetNextEntry(new_entry, previous_entry);
874 table->SetNumberOfElements(nof + 1);
883 int raw_entry = entry.
as_int();
894template <
class Derived>
898 return FindEntry(isolate, *
key).is_found();
901template <
class Derived>
906 InternalIndex entry = table->FindEntry(isolate,
key);
907 if (entry.is_not_found())
return false;
909 int nof = table->NumberOfElements();
910 int nod = table->NumberOfDeletedElements();
912 Tagged<Object> the_hole = ReadOnlyRoots(isolate).the_hole_value();
913 for (
int j = 0; j < Derived::kEntrySize; j++) {
914 table->SetDataEntry(entry.as_int(), j, the_hole);
917 table->SetNumberOfElements(nof - 1);
918 table->SetNumberOfDeletedElements(nod + 1);
931 table->SetEntry(entry, the_hole, the_hole, details);
933 int nof = table->NumberOfElements();
934 table->SetNumberOfElements(nof - 1);
935 int nod = table->NumberOfDeletedElements();
936 table->SetNumberOfDeletedElements(nod + 1);
938 return Shrink(isolate, table);
941template <
class Derived>
948 isolate, new_capacity,
957 if (IsTheHole(
key, isolate))
continue;
960 int bucket = new_table->HashToBucket(hash);
961 int chain = new_table->GetFirstEntry(bucket);
963 new_table->SetFirstEntry(bucket, new_entry);
964 new_table->SetNextEntry(new_entry, chain);
966 for (
int i = 0;
i < Derived::kEntrySize; ++
i) {
968 new_table->SetDataEntry(new_entry,
i, value);
974 new_table->SetNumberOfElements(table->NumberOfElements());
997 new_table->SetHash(table->Hash());
1001template <
class Derived>
1004 int nof = table->NumberOfElements();
1005 int capacity = table->Capacity();
1006 if (nof >= (capacity >> 2))
return table;
1007 return Derived::Rehash(isolate, table, capacity / 2);
1010template <
class Derived>
1013 int capacity = table->Capacity();
1014 int new_capacity = capacity;
1018 if (table->NumberOfDeletedElements() < (capacity >> 1)) {
1019 new_capacity = capacity << 1;
1024 if (new_capacity == kGrowthHack) {
1025 new_capacity = kMaxCapacity;
1029 if (new_capacity > kMaxCapacity) {
1030 return MaybeHandle<Derived>();
1034 return Derived::Rehash(isolate, table, new_capacity);
1037template <
class Derived>
1044 int raw_entry = HashToFirstEntry(
Smi::ToInt(hash));
1048 InternalIndex entry(raw_entry);
1051 raw_entry = GetNextEntry(raw_entry);
1058 DirectHandle<Object>
key);
1077 DirectHandle<Object>
key);
1102template <
class SmallTable,
class LargeTable>
1103MaybeHandle<HeapObject>
1104OrderedHashTableHandler<SmallTable, LargeTable>::Allocate(Isolate* isolate,
1106 if (capacity < SmallTable::kMaxCapacity) {
1107 return SmallTable::Allocate(isolate, capacity);
1110 return LargeTable::Allocate(isolate, capacity);
1114OrderedHashTableHandler<SmallOrderedHashSet, OrderedHashSet>::Allocate(
1115 Isolate* isolate,
int capacity);
1117OrderedHashTableHandler<SmallOrderedHashMap, OrderedHashMap>::Allocate(
1118 Isolate* isolate,
int capacity);
1120OrderedHashTableHandler<SmallOrderedNameDictionary,
1121 OrderedNameDictionary>::Allocate(Isolate* isolate,
1124template <
class SmallTable,
class LargeTable>
1125bool OrderedHashTableHandler<SmallTable, LargeTable>::Delete(
1126 Isolate* isolate, Handle<HeapObject> table, DirectHandle<Object>
key) {
1127 if (SmallTable::Is(table)) {
1131 DCHECK(LargeTable::Is(table));
1137template <
class SmallTable,
class LargeTable>
1138bool OrderedHashTableHandler<SmallTable, LargeTable>::HasKey(
1139 Isolate* isolate, Handle<HeapObject> table, Handle<Object>
key) {
1140 if (SmallTable::Is(table)) {
1144 DCHECK(LargeTable::Is(table));
1149OrderedHashTableHandler<SmallOrderedHashSet, OrderedHashSet>::HasKey(
1150 Isolate* isolate, Handle<HeapObject> table, Handle<Object>
key);
1152OrderedHashTableHandler<SmallOrderedHashMap, OrderedHashMap>::HasKey(
1153 Isolate* isolate, Handle<HeapObject> table, Handle<Object>
key);
1156OrderedHashTableHandler<SmallOrderedHashSet, OrderedHashSet>::Delete(
1157 Isolate* isolate, Handle<HeapObject> table, DirectHandle<Object>
key);
1159OrderedHashTableHandler<SmallOrderedHashMap, OrderedHashMap>::Delete(
1160 Isolate* isolate, Handle<HeapObject> table, DirectHandle<Object>
key);
1161template bool OrderedHashTableHandler<
1162 SmallOrderedNameDictionary,
1163 OrderedNameDictionary>::Delete(Isolate* isolate, Handle<HeapObject> table,
1164 DirectHandle<Object>
key);
1171 if (!new_table_candidate.
ToHandle(&new_table)) {
1172 return new_table_candidate;
1180 if (IsTheHole(*
key, isolate))
continue;
1185 if (!new_table_candidate.
ToHandle(&new_table)) {
1186 return new_table_candidate;
1190 return new_table_candidate;
1198 if (!new_table_candidate.
ToHandle(&new_table)) {
1199 return new_table_candidate;
1207 if (IsTheHole(*
key, isolate))
continue;
1209 if (!new_table_candidate.
ToHandle(&new_table)) {
1210 return new_table_candidate;
1214 return new_table_candidate;
1223 if (!new_table_candidate.
ToHandle(&new_table)) {
1224 return new_table_candidate;
1232 if (IsTheHole(*
key, isolate))
continue;
1235 new_table_candidate =
1237 if (!new_table_candidate.
ToHandle(&new_table)) {
1238 return new_table_candidate;
1242 return new_table_candidate;
1249 if (IsSmallOrderedHashMap(*table)) {
1259 if (!table_candidate.
ToHandle(&table)) {
1260 return table_candidate;
1264 DCHECK(IsOrderedHashMap(*table));
1271 if (IsSmallOrderedHashSet(*table)) {
1281 if (!table_candidate.
ToHandle(&table)) {
1282 return table_candidate;
1286 DCHECK(IsOrderedHashSet(*table));
1293 if (IsSmallOrderedNameDictionary(*table)) {
1305 if (!table_candidate.
ToHandle(&table)) {
1306 return table_candidate;
1310 DCHECK(IsOrderedNameDictionary(*table));
1312 key, value, details);
1321 if (IsSmallOrderedNameDictionary(table)) {
1326 DCHECK(IsOrderedNameDictionary(table));
1335 if (IsSmallOrderedNameDictionary(table)) {
1339 DCHECK(IsOrderedNameDictionary(table));
1345 if (IsSmallOrderedNameDictionary(table)) {
1349 DCHECK(IsOrderedNameDictionary(table));
1356 if (IsSmallOrderedNameDictionary(table)) {
1360 DCHECK(IsOrderedNameDictionary(table));
1366 if (IsSmallOrderedNameDictionary(table)) {
1370 DCHECK(IsOrderedNameDictionary(table));
1377 if (IsSmallOrderedNameDictionary(table)) {
1382 DCHECK(IsOrderedNameDictionary(table));
1387 if (IsSmallOrderedNameDictionary(table)) {
1391 DCHECK(IsOrderedNameDictionary(table));
1396 if (IsSmallOrderedNameDictionary(table)) {
1400 DCHECK(IsOrderedNameDictionary(table));
1406 if (IsSmallOrderedNameDictionary(table)) {
1415 if (IsSmallOrderedNameDictionary(table)) {
1423 if (IsSmallOrderedNameDictionary(table)) {
1432 if (IsSmallOrderedNameDictionary(*table)) {
1445 if (IsSmallOrderedNameDictionary(*table)) {
1456template <
class Derived,
class TableType>
1460 if (!table->IsObsolete())
return;
1464 while (table->IsObsolete()) {
1468 int nod = table->NumberOfDeletedElements();
1470 if (nod == TableType::kClearedTableSentinel) {
1473 int old_index =
index;
1474 for (
int i = 0;
i < nod; ++
i) {
1475 int removed_index = table->RemovedIndexAt(
i);
1476 if (removed_index >= old_index)
break;
1489template <
class Derived,
class TableType>
1498 int used_capacity = table->UsedCapacity();
1500 while (index < used_capacity &&
1501 IsHashTableHole(table->KeyAt(
InternalIndex(index)), ro_roots)) {
1507 if (index < used_capacity)
return true;
1509 set_table(TableType::GetEmpty(ro_roots));
1540#define EXTERN_DEFINE_ORDERED_HASH_TABLE(DERIVED, ENTRY_SIZE) \
1541 template V8_EXPORT_PRIVATE MaybeIndirectHandle<DERIVED> \
1542 OrderedHashTable<DERIVED, ENTRY_SIZE>::EnsureCapacityForAdding( \
1543 Isolate* isolate, IndirectHandle<DERIVED> table); \
1544 template V8_EXPORT_PRIVATE MaybeDirectHandle<DERIVED> \
1545 OrderedHashTable<DERIVED, ENTRY_SIZE>::EnsureCapacityForAdding( \
1546 Isolate* isolate, DirectHandle<DERIVED> table); \
1547 template V8_EXPORT_PRIVATE IndirectHandle<DERIVED> \
1548 OrderedHashTable<DERIVED, ENTRY_SIZE>::Shrink( \
1549 Isolate* isolate, IndirectHandle<DERIVED> table); \
1550 template V8_EXPORT_PRIVATE DirectHandle<DERIVED> \
1551 OrderedHashTable<DERIVED, ENTRY_SIZE>::Shrink(Isolate* isolate, \
1552 DirectHandle<DERIVED> table); \
1553 template V8_EXPORT_PRIVATE Handle<DERIVED> \
1554 OrderedHashTable<DERIVED, ENTRY_SIZE>::Clear(Isolate* isolate, \
1555 Handle<DERIVED> table); \
1556 template V8_EXPORT_PRIVATE MaybeHandle<DERIVED> \
1557 OrderedHashTable<DERIVED, ENTRY_SIZE>::Allocate( \
1558 Isolate* isolate, int capacity, AllocationType allocation); \
1559 template V8_EXPORT_PRIVATE bool \
1560 OrderedHashTable<DERIVED, ENTRY_SIZE>::HasKey( \
1561 Isolate* isolate, Tagged<DERIVED> table, Tagged<Object> key); \
1562 template V8_EXPORT_PRIVATE bool \
1563 OrderedHashTable<DERIVED, ENTRY_SIZE>::Delete( \
1564 Isolate* isolate, Tagged<DERIVED> table, Tagged<Object> key); \
1565 template V8_EXPORT_PRIVATE InternalIndex \
1566 OrderedHashTable<DERIVED, ENTRY_SIZE>::FindEntry(Isolate* isolate, \
1567 Tagged<Object> key);
static HandleType< FixedArray > RightTrimOrEmpty(Isolate *isolate, HandleType< FixedArray > array, int new_length)
static V8_INLINE bool InYoungGeneration(Tagged< Object > object)
bool is_not_found() const
static InternalIndex NotFound()
constexpr int as_int() const
V8_INLINE Handle< T > ToHandleChecked() const
V8_WARN_UNUSED_RESULT V8_INLINE bool ToHandle(Handle< S > *out) const
static V8_WARN_UNUSED_RESULT bool ToArrayIndex(Tagged< Object > obj, uint32_t *index)
static bool SameValueZero(Tagged< Object > obj, Tagged< Object > other)
static V8_EXPORT_PRIVATE Tagged< Smi > GetOrCreateHash(Tagged< Object > obj, Isolate *isolate)
static MaybeHandle< OrderedHashMap > AdjustRepresentation(Isolate *isolate, DirectHandle< SmallOrderedHashMap > table)
static MaybeHandle< HeapObject > Add(Isolate *isolate, Handle< HeapObject > table, DirectHandle< Object > key, DirectHandle< Object > value)
static MaybeHandle< OrderedHashMap > AllocateEmpty(Isolate *isolate, AllocationType allocation=AllocationType::kReadOnly)
static MaybeHandle< OrderedHashMap > Allocate(IsolateT *isolate, int capacity, AllocationType allocation=AllocationType::kYoung)
void SetEntry(InternalIndex entry, Tagged< Object > key, Tagged< Object > value)
static Tagged< HeapObject > GetEmpty(ReadOnlyRoots ro_roots)
static Address GetHash(Isolate *isolate, Address raw_key)
static HandleType< OrderedHashMap >::MaybeType Rehash(Isolate *isolate, HandleType< OrderedHashMap > table)
static MaybeHandle< OrderedHashMap > Add(Isolate *isolate, Handle< OrderedHashMap > table, DirectHandle< Object > key, DirectHandle< Object > value)
static const int kValueOffset
static MaybeHandle< OrderedHashSet > AdjustRepresentation(Isolate *isolate, DirectHandle< SmallOrderedHashSet > table)
static MaybeHandle< HeapObject > Add(Isolate *isolate, Handle< HeapObject > table, DirectHandle< Object > key)
static Tagged< HeapObject > GetEmpty(ReadOnlyRoots ro_roots)
static HandleType< OrderedHashSet >::MaybeType Rehash(Isolate *isolate, HandleType< OrderedHashSet > table)
static MaybeHandle< OrderedHashSet > Allocate(IsolateT *isolate, int capacity, AllocationType allocation=AllocationType::kYoung)
static Handle< FixedArray > ConvertToKeysArray(Isolate *isolate, Handle< OrderedHashSet > table, GetKeysConversion convert)
static MaybeHandle< OrderedHashSet > AllocateEmpty(Isolate *isolate, AllocationType allocation=AllocationType::kReadOnly)
static HandleType< OrderedHashSet >::MaybeType Add(Isolate *isolate, HandleType< OrderedHashSet > table, DirectHandle< Object > value)
Tagged< Object > CurrentKey()
static const int kEntrySize
static HandleType< OrderedNameDictionary > Shrink(Isolate *isolate, HandleType< OrderedNameDictionary > table)
static MaybeHandle< Derived > Allocate(Isolate *isolate, int capacity, AllocationType allocation=AllocationType::kYoung)
int NextChainEntryRaw(int entry)
Tagged< Object > KeyAt(InternalIndex entry)
static const int kNotFound
static Handle< Derived > Clear(Isolate *isolate, Handle< Derived > table)
int NumberOfElements() const
static HandleType< OrderedHashSet >::MaybeType EnsureCapacityForAdding(Isolate *isolate, HandleType< OrderedHashSet > table)
int EntryToIndex(InternalIndex entry)
static constexpr int HashTableStartIndex()
static HandleType< Derived >::MaybeType Rehash(Isolate *isolate, HandleType< Derived > table)
int HashToEntryRaw(int hash)
static MaybeHandle< Derived > AllocateEmpty(Isolate *isolate, AllocationType allocation, RootIndex root_ndex)
static bool HasKey(Isolate *isolate, Tagged< Derived > table, Tagged< Object > key)
InternalIndex FindEntry(Isolate *isolate, Tagged< Object > key)
static bool Delete(Isolate *isolate, Tagged< Derived > table, Tagged< Object > key)
static const int kChainOffset
static Tagged< Object > ValueAt(Tagged< HeapObject > table, InternalIndex entry)
static MaybeHandle< OrderedNameDictionary > AdjustRepresentation(Isolate *isolate, DirectHandle< SmallOrderedNameDictionary > table)
static DirectHandle< HeapObject > Shrink(Isolate *isolate, Handle< HeapObject > table)
static void DetailsAtPut(Tagged< HeapObject > table, InternalIndex entry, PropertyDetails value)
static Tagged< Name > KeyAt(Tagged< HeapObject > table, InternalIndex entry)
static PropertyDetails DetailsAt(Tagged< HeapObject > table, InternalIndex entry)
static int Capacity(Tagged< HeapObject > table)
static void ValueAtPut(Tagged< HeapObject > table, InternalIndex entry, Tagged< Object > value)
static int Hash(Tagged< HeapObject > table)
static int NumberOfElements(Tagged< HeapObject > table)
static void SetEntry(Tagged< HeapObject > table, InternalIndex entry, Tagged< Object > key, Tagged< Object > value, PropertyDetails details)
static MaybeHandle< HeapObject > Add(Isolate *isolate, Handle< HeapObject > table, DirectHandle< Name > key, DirectHandle< Object > value, PropertyDetails details)
static InternalIndex FindEntry(Isolate *isolate, Tagged< HeapObject > table, Tagged< Name > key)
static DirectHandle< HeapObject > DeleteEntry(Isolate *isolate, Handle< HeapObject > table, InternalIndex entry)
static void SetHash(Tagged< HeapObject > table, int hash)
InternalIndex FindEntry(IsolateT *isolate, Tagged< Object > key)
static Handle< OrderedNameDictionary > DeleteEntry(Isolate *isolate, Handle< OrderedNameDictionary > table, InternalIndex entry)
static MaybeHandle< OrderedNameDictionary > Add(Isolate *isolate, Handle< OrderedNameDictionary > table, DirectHandle< Name > key, DirectHandle< Object > value, PropertyDetails details)
static MaybeHandle< OrderedNameDictionary > Allocate(Isolate *isolate, int capacity, AllocationType allocation=AllocationType::kYoung)
static MaybeHandle< OrderedNameDictionary > AllocateEmpty(Isolate *isolate, AllocationType allocation=AllocationType::kReadOnly)
static HandleType< OrderedNameDictionary >::MaybeType Rehash(Isolate *isolate, HandleType< OrderedNameDictionary > table, int new_capacity)
static const int kPropertyDetailsOffset
void SetEntry(InternalIndex entry, Tagged< Object > key, Tagged< Object > value, PropertyDetails details)
static const int kValueOffset
static const int kNoHashSentinel
static constexpr PropertyDetails Empty(PropertyCellType cell_type=PropertyCellType::kNoCell)
Tagged< Smi > AsSmi() const
static const int kKeyIndex
static Handle< SmallOrderedHashMap > Rehash(Isolate *isolate, Handle< SmallOrderedHashMap > table, int new_capacity)
static const int kValueIndex
V8_EXPORT_PRIVATE bool HasKey(Isolate *isolate, DirectHandle< Object > key)
static V8_EXPORT_PRIVATE MaybeHandle< SmallOrderedHashMap > Add(Isolate *isolate, Handle< SmallOrderedHashMap > table, DirectHandle< Object > key, DirectHandle< Object > value)
static V8_EXPORT_PRIVATE bool Delete(Isolate *isolate, Tagged< SmallOrderedHashMap > table, Tagged< Object > key)
static V8_EXPORT_PRIVATE MaybeHandle< SmallOrderedHashSet > Add(Isolate *isolate, Handle< SmallOrderedHashSet > table, DirectHandle< Object > key)
V8_EXPORT_PRIVATE bool HasKey(Isolate *isolate, DirectHandle< Object > key)
static Handle< SmallOrderedHashSet > Rehash(Isolate *isolate, Handle< SmallOrderedHashSet > table, int new_capacity)
static const int kKeyIndex
static V8_EXPORT_PRIVATE bool Delete(Isolate *isolate, Tagged< SmallOrderedHashSet > table, Tagged< Object > key)
static bool Delete(Isolate *isolate, Tagged< Derived > table, Tagged< Object > key)
void SetDataEntry(int entry, int relative_index, Tagged< Object > value)
static Handle< Derived > Rehash(Isolate *isolate, Handle< Derived > table, int new_capacity)
bool HasKey(Isolate *isolate, DirectHandle< Object > key)
InternalIndex FindEntry(Isolate *isolate, Tagged< Object > key)
static MaybeHandle< SmallOrderedHashSet > Grow(Isolate *isolate, Handle< SmallOrderedHashSet > table)
static Handle< Derived > Allocate(Isolate *isolate, int capacity, AllocationType allocation=AllocationType::kYoung)
static Handle< SmallOrderedNameDictionary > Shrink(Isolate *isolate, Handle< SmallOrderedNameDictionary > table)
void Initialize(Isolate *isolate, int capacity)
static const int kValueIndex
static const int kKeyIndex
V8_EXPORT_PRIVATE void SetEntry(InternalIndex entry, Tagged< Object > key, Tagged< Object > value, PropertyDetails details)
static const int kPropertyDetailsIndex
static Handle< SmallOrderedNameDictionary > Rehash(Isolate *isolate, Handle< SmallOrderedNameDictionary > table, int new_capacity)
static V8_EXPORT_PRIVATE MaybeHandle< SmallOrderedNameDictionary > Add(Isolate *isolate, Handle< SmallOrderedNameDictionary > table, DirectHandle< Name > key, DirectHandle< Object > value, PropertyDetails details)
static V8_EXPORT_PRIVATE Handle< SmallOrderedNameDictionary > DeleteEntry(Isolate *isolate, Handle< SmallOrderedNameDictionary > table, InternalIndex entry)
static constexpr int ToInt(const Tagged< Object > object)
static constexpr Tagged< Smi > FromInt(int value)
static constexpr int kMaxValue
void set(int index, Tagged< ElementT > value, WriteBarrierMode mode=kDefaultMode)
V8_INLINE constexpr StorageType ptr() const
V8_INLINE constexpr int32_t value() const
#define THROW_NEW_ERROR_RETURN_VALUE(isolate, call, value)
ZoneVector< RpoNumber > & result
V8_BASE_EXPORT constexpr uint32_t RoundUpToPowerOfTwo32(uint32_t value)
PerThreadAssertScopeDebugOnly< false, SAFEPOINTS_ASSERT, HEAP_ALLOCATION_ASSERT > DisallowGarbageCollection
ReadOnlyRoots GetReadOnlyRoots()
Tagged(T object) -> Tagged< T >
uint32_t ComputeUnseededHash(uint32_t key)
V8_INLINE constexpr bool IsSmi(TaggedImpl< kRefType, StorageType > obj)
void MemsetTagged(Tagged_t *start, Tagged< MaybeObject > value, size_t counter)
bool IsUniqueName(Tagged< Name > obj)
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
#define EXTERN_DEFINE_ORDERED_HASH_TABLE(DERIVED, ENTRY_SIZE)
#define DCHECK_LE(v1, v2)
#define DCHECK_IMPLIES(v1, v2)
#define DCHECK_GE(v1, v2)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
#define V8_EXPORT_PRIVATE