[heap] Cleanup OLD_TO_SHARED slots in sweeper
Sweeper needs to clean up slots in the OLD_TO_SHARED remembered set as well in the future. Unlike OLD_TO_NEW or OLD_TO_OLD this remembered set will not be reset after a full GC. So we will have to remove from it both during and after a full GC when sweeping. However in the current implementation we still reset this remembered set in a shared GC. This only works because we scan all client heaps during a shared GC anyways to rebuild the remembered set. We will get rid of that when all required write barriers are implemented. Bug: v8:11708 Change-Id: Ib891a882fdf70671a483c8662408cf64e72134c6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3574546 Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Dominik Inführ <dinfuehr@chromium.org> Cr-Commit-Position: refs/heads/main@{#79874}
This commit is contained in:
parent
e0b8ce19f3
commit
55f6a97366
@ -272,6 +272,11 @@ V8_INLINE void Sweeper::CleanupRememberedSetEntriesForFreedMemory(
|
|||||||
DCHECK_NULL(page->slot_set<OLD_TO_OLD>());
|
DCHECK_NULL(page->slot_set<OLD_TO_OLD>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Old-to-shared isn't reset after a full GC, so needs to be cleaned both
|
||||||
|
// during and after a full GC.
|
||||||
|
RememberedSet<OLD_TO_SHARED>::RemoveRange(page, free_start, free_end,
|
||||||
|
SlotSet::KEEP_EMPTY_BUCKETS);
|
||||||
|
|
||||||
if (record_free_ranges) {
|
if (record_free_ranges) {
|
||||||
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()),
|
||||||
@ -291,6 +296,8 @@ void Sweeper::CleanupInvalidTypedSlotsOfFreeRanges(
|
|||||||
// Also code objects are never right-trimmed, so there cannot be any slots
|
// Also code objects are never right-trimmed, so there cannot be any slots
|
||||||
// in a free range.
|
// in a free range.
|
||||||
page->AssertNoInvalidTypedSlots<OLD_TO_OLD>(free_ranges_map);
|
page->AssertNoInvalidTypedSlots<OLD_TO_OLD>(free_ranges_map);
|
||||||
|
|
||||||
|
page->ClearInvalidTypedSlots<OLD_TO_SHARED>(free_ranges_map);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,6 +307,7 @@ void Sweeper::CleanupInvalidTypedSlotsOfFreeRanges(
|
|||||||
// could create new slots but not in a free range.
|
// could create new slots but not in a free range.
|
||||||
page->AssertNoInvalidTypedSlots<OLD_TO_NEW>(free_ranges_map);
|
page->AssertNoInvalidTypedSlots<OLD_TO_NEW>(free_ranges_map);
|
||||||
DCHECK_NULL(page->typed_slot_set<OLD_TO_OLD>());
|
DCHECK_NULL(page->typed_slot_set<OLD_TO_OLD>());
|
||||||
|
page->ClearInvalidTypedSlots<OLD_TO_SHARED>(free_ranges_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sweeper::ClearMarkBitsAndHandleLivenessStatistics(
|
void Sweeper::ClearMarkBitsAndHandleLivenessStatistics(
|
||||||
@ -356,6 +364,7 @@ int Sweeper::RawSweep(Page* p, FreeListRebuildingMode free_list_mode,
|
|||||||
|
|
||||||
bool record_free_ranges = p->typed_slot_set<OLD_TO_NEW>() != nullptr ||
|
bool record_free_ranges = p->typed_slot_set<OLD_TO_NEW>() != nullptr ||
|
||||||
p->typed_slot_set<OLD_TO_OLD>() != nullptr ||
|
p->typed_slot_set<OLD_TO_OLD>() != nullptr ||
|
||||||
|
p->typed_slot_set<OLD_TO_SHARED>() != nullptr ||
|
||||||
DEBUG_BOOL;
|
DEBUG_BOOL;
|
||||||
|
|
||||||
// Clean invalidated slots during the final atomic pause. After resuming
|
// Clean invalidated slots during the final atomic pause. After resuming
|
||||||
|
Loading…
Reference in New Issue
Block a user