@@ -13744,6 +13744,16 @@ void HashTable<Derived, Shape, Key>::Rehash(Key key) {
1374413744 }
1374513745 }
1374613746 }
13747+ // Wipe deleted entries.
13748+ Heap* heap = GetHeap();
13749+ Object* the_hole = heap->the_hole_value();
13750+ Object* undefined = heap->undefined_value();
13751+ for (uint32_t current = 0; current < capacity; current++) {
13752+ if (get(EntryToIndex(current)) == the_hole) {
13753+ set(EntryToIndex(current), undefined);
13754+ }
13755+ }
13756+ SetNumberOfDeletedElements(0);
1374713757}
1374813758
1374913759
@@ -14656,6 +14666,7 @@ Handle<CompilationCacheTable> CompilationCacheTable::PutRegExp(
1465614666void CompilationCacheTable::Age() {
1465714667 DisallowHeapAllocation no_allocation;
1465814668 Object* the_hole_value = GetHeap()->the_hole_value();
14669+ uint32_t capacity = Capacity();
1465914670 for (int entry = 0, size = Capacity(); entry < size; entry++) {
1466014671 int entry_index = EntryToIndex(entry);
1466114672 int value_index = entry_index + 1;
@@ -14679,6 +14690,16 @@ void CompilationCacheTable::Age() {
1467914690 }
1468014691 }
1468114692 }
14693+ // Wipe deleted entries.
14694+ Heap* heap = GetHeap();
14695+ Object* the_hole = heap->the_hole_value();
14696+ Object* undefined = heap->undefined_value();
14697+ for (uint32_t current = 0; current < capacity; current++) {
14698+ if (get(EntryToIndex(current)) == the_hole) {
14699+ set(EntryToIndex(current), undefined);
14700+ }
14701+ }
14702+ SetNumberOfDeletedElements(0);
1468214703}
1468314704
1468414705
@@ -15187,6 +15208,12 @@ Handle<ObjectHashTable> ObjectHashTable::Put(Handle<ObjectHashTable> table,
1518715208 return table;
1518815209 }
1518915210
15211+ // Rehash if more than 25% of the entries are deleted entries.
15212+ // TODO(jochen): Consider to shrink the fixed array in place.
15213+ if ((table->NumberOfDeletedElements() << 1) > table->NumberOfElements()) {
15214+ table->Rehash(isolate->factory()->undefined_value());
15215+ }
15216+
1519015217 // Check whether the hash table should be extended.
1519115218 table = EnsureCapacity(table, 1, key);
1519215219 table->AddEntry(table->FindInsertionEntry(hash), *key, *value);
0 commit comments