[heap] Sweeper only needs to remove old-to-old-slots during GC

Only remove old-to-old slots during a GC, but DCHECK that the
old-to-old-slot set is empty after a full GC.

Previously we simply removed from the remembered set during and outside
the full GC. We now have a flag to DCHECK this more precisely.

Bug: v8:12760
Change-Id: Ie6adc3f47a700497aaa818da0e83d6cb94e3c75d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3562981
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79798}
This commit is contained in:
Dominik Inführ 2022-04-05 13:49:17 +02:00 committed by V8 LUCI CQ
parent 0056f4ff33
commit c2852992fc

View File

@ -263,9 +263,14 @@ V8_INLINE void Sweeper::CleanupRememberedSetEntriesForFreedMemory(
// sweeper thread would race with the main thread. // sweeper thread would race with the main thread.
RememberedSet<OLD_TO_NEW>::RemoveRange(page, free_start, free_end, RememberedSet<OLD_TO_NEW>::RemoveRange(page, free_start, free_end,
SlotSet::KEEP_EMPTY_BUCKETS); SlotSet::KEEP_EMPTY_BUCKETS);
}
// While we only add old-to-old slots on live objects, we can still end up
// with old-to-old slots in free memory with e.g. right-trimming of objects.
RememberedSet<OLD_TO_OLD>::RemoveRange(page, free_start, free_end, RememberedSet<OLD_TO_OLD>::RemoveRange(page, free_start, free_end,
SlotSet::KEEP_EMPTY_BUCKETS); SlotSet::KEEP_EMPTY_BUCKETS);
} else {
DCHECK_NULL(page->slot_set<OLD_TO_OLD>());
}
if (non_empty_typed_slots) { if (non_empty_typed_slots) {
free_ranges_map->insert(std::pair<uint32_t, uint32_t>( free_ranges_map->insert(std::pair<uint32_t, uint32_t>(
static_cast<uint32_t>(free_start - page->address()), static_cast<uint32_t>(free_start - page->address()),