Skip to content

Commit 5f5a328

Browse files
mi-acCommit bot
authored andcommitted
Revert of Rehash and clear deleted entries in weak collections during GC (patchset #8 id:140001 of https://codereview.chromium.org/1877233005/ )
Reason for revert: [Sheriff] Speculative revert. Suspect for gc stress crashes, like: https://build.chromium.org/p/client.v8/builders/V8%20Linux64%20GC%20Stress%20-%20custom%20snapshot/builds/5119 Original issue's description: > Rehash and clear deleted entries in weak collections during GC > > Otherwise, they'll just keep growing until we run out of memory or hit the FixedArray's maximum capacity. > > BUG=v8:4909 > R=hpayer@chromium.org > LOG=n > > Committed: https://crrev.com/e093a047796d4c0575fe63d36529e7fe89b8865d > Cr-Commit-Position: refs/heads/master@{#35514} TBR=hpayer@chromium.org,jochen@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=v8:4909 Review URL: https://codereview.chromium.org/1891863003 Cr-Commit-Position: refs/heads/master@{#35519}
1 parent 2f9eb09 commit 5f5a328

5 files changed

Lines changed: 3 additions & 24 deletions

File tree

src/heap/mark-compact.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2572,13 +2572,6 @@ void MarkCompactCollector::ClearWeakCollections() {
25722572
table->RemoveEntry(i);
25732573
}
25742574
}
2575-
// Rehash if more than 25% of the entries are deleted entries.
2576-
// TODO(jochen): Consider to shrink the fixed array in place.
2577-
if ((table->NumberOfDeletedElements() << kJSWeakCollectionLoadFactorExp) >
2578-
table->NumberOfElements()) {
2579-
HandleScope scope(heap()->isolate());
2580-
table->Rehash(heap()->isolate()->factory()->undefined_value());
2581-
}
25822575
}
25832576
weak_collection_obj = weak_collection->next();
25842577
weak_collection->set_next(heap()->undefined_value());

src/heap/mark-compact.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,10 +512,6 @@ class MarkCompactCollector {
512512
static const uint32_t kSingleFreeEncoding = 0;
513513
static const uint32_t kMultiFreeEncoding = 1;
514514

515-
// If the number of deleted slots in a JSWeakCollection exceeds the number
516-
// of entries / 2^(factor), we rehash the table.
517-
static const int kJSWeakCollectionLoadFactorExp = 1;
518-
519515
static inline bool IsMarked(Object* obj);
520516
static bool IsUnmarkedHeapObjectWithHeap(Heap* heap, Object** p);
521517

src/objects.cc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16867,16 +16867,6 @@ void HashTable<Derived, Shape, Key>::Rehash(Key key) {
1686716867
}
1686816868
}
1686916869
}
16870-
// Wipe deleted entries.
16871-
Heap* heap = GetHeap();
16872-
Object* the_hole = heap->the_hole_value();
16873-
Object* undefined = heap->undefined_value();
16874-
for (uint32_t current = 0; current < capacity; current++) {
16875-
if (get(EntryToIndex(current)) == the_hole) {
16876-
set(EntryToIndex(current), undefined);
16877-
}
16878-
}
16879-
SetNumberOfDeletedElements(0);
1688016870
}
1688116871

1688216872

test/cctest/test-weakmaps.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ TEST(Weakness) {
124124
heap->CollectAllGarbage(false);
125125
CHECK_EQ(1, NumberOfWeakCalls);
126126
CHECK_EQ(0, ObjectHashTable::cast(weakmap->table())->NumberOfElements());
127-
CHECK_EQ(0,
127+
CHECK_EQ(2,
128128
ObjectHashTable::cast(weakmap->table())->NumberOfDeletedElements());
129129
}
130130

test/cctest/test-weaksets.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ TEST(WeakSet_Weakness) {
123123
heap->CollectAllGarbage(false);
124124
CHECK_EQ(1, NumberOfWeakCalls);
125125
CHECK_EQ(0, ObjectHashTable::cast(weakset->table())->NumberOfElements());
126-
CHECK_EQ(0,
127-
ObjectHashTable::cast(weakset->table())->NumberOfDeletedElements());
126+
CHECK_EQ(
127+
1, ObjectHashTable::cast(weakset->table())->NumberOfDeletedElements());
128128
}
129129

130130

0 commit comments

Comments
 (0)