Commit 2bdd845a authored by Dominik Inführ's avatar Dominik Inführ Committed by V8 LUCI CQ

[heap] Turn AssertNoTypedSlotsInFreeMemory into DCHECK

After AssertNoTypedSlotsInFreeMemory being a CHECK for some time now to
get more test coverage, turn this into a DCHECK again.

This CL also renames the methods used by the sweeper to clear typed
slots in free memory. It was previously called "invalid slots" but
IMHO that could be a bit misleading, since this isn't about object slot
invalidation (where we also filter slots) but only really about slots in
free memory.

Bug: v8:12760
Change-Id: I8f414be06207460531fa54189b9ef1be85f4ecb6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3679578Reviewed-by: 's avatarOmer Katz <omerkatz@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80860}
parent d829c653
......@@ -313,7 +313,7 @@ class Page : public MemoryChunk {
ActiveSystemPages* active_system_pages() { return &active_system_pages_; }
template <RememberedSetType remembered_set>
void ClearInvalidTypedSlots(const TypedSlotSet::FreeRangesMap& ranges) {
void ClearTypedSlotsInFreeMemory(const TypedSlotSet::FreeRangesMap& ranges) {
TypedSlotSet* typed_slot_set = this->typed_slot_set<remembered_set>();
if (typed_slot_set != nullptr) {
typed_slot_set->ClearInvalidSlots(ranges);
......@@ -321,12 +321,14 @@ class Page : public MemoryChunk {
}
template <RememberedSetType remembered_set>
void AssertNoInvalidTypedSlots(const TypedSlotSet::FreeRangesMap& ranges) {
// TODO(dinfuehr): Make this a DCHECK eventually.
void AssertNoTypedSlotsInFreeMemory(
const TypedSlotSet::FreeRangesMap& ranges) {
#if DEBUG
TypedSlotSet* typed_slot_set = this->typed_slot_set<OLD_TO_OLD>();
if (typed_slot_set != nullptr) {
typed_slot_set->AssertNoInvalidSlots(ranges);
}
#endif // DEBUG
}
private:
......
......@@ -275,18 +275,18 @@ V8_INLINE void Sweeper::CleanupRememberedSetEntriesForFreedMemory(
invalidated_old_to_shared_cleanup->Free(free_start, free_end);
}
void Sweeper::CleanupInvalidTypedSlotsOfFreeRanges(
void Sweeper::CleanupTypedSlotsInFreeMemory(
Page* page, const TypedSlotSet::FreeRangesMap& free_ranges_map,
SweepingMode sweeping_mode) {
if (sweeping_mode == SweepingMode::kEagerDuringGC) {
page->ClearInvalidTypedSlots<OLD_TO_NEW>(free_ranges_map);
page->ClearTypedSlotsInFreeMemory<OLD_TO_NEW>(free_ranges_map);
// Typed old-to-old slot sets are only ever recorded in live code objects.
// Also code objects are never right-trimmed, so there cannot be any slots
// in a free range.
page->AssertNoInvalidTypedSlots<OLD_TO_OLD>(free_ranges_map);
page->AssertNoTypedSlotsInFreeMemory<OLD_TO_OLD>(free_ranges_map);
page->ClearInvalidTypedSlots<OLD_TO_SHARED>(free_ranges_map);
page->ClearTypedSlotsInFreeMemory<OLD_TO_SHARED>(free_ranges_map);
return;
}
......@@ -294,9 +294,9 @@ void Sweeper::CleanupInvalidTypedSlotsOfFreeRanges(
// After a full GC there are no old-to-new typed slots. The main thread
// could create new slots but not in a free range.
page->AssertNoInvalidTypedSlots<OLD_TO_NEW>(free_ranges_map);
page->AssertNoTypedSlotsInFreeMemory<OLD_TO_NEW>(free_ranges_map);
DCHECK_NULL(page->typed_slot_set<OLD_TO_OLD>());
page->ClearInvalidTypedSlots<OLD_TO_SHARED>(free_ranges_map);
page->ClearTypedSlotsInFreeMemory<OLD_TO_SHARED>(free_ranges_map);
}
void Sweeper::ClearMarkBitsAndHandleLivenessStatistics(Page* page,
......@@ -420,7 +420,7 @@ int Sweeper::RawSweep(Page* p, FreeSpaceTreatmentMode free_space_treatment_mode,
}
// Phase 3: Post process the page.
CleanupInvalidTypedSlotsOfFreeRanges(p, free_ranges_map, sweeping_mode);
CleanupTypedSlotsInFreeMemory(p, free_ranges_map, sweeping_mode);
ClearMarkBitsAndHandleLivenessStatistics(p, live_bytes);
if (active_system_pages_after_sweeping) {
......
......@@ -141,7 +141,7 @@ class Sweeper {
// Helper function for RawSweep. Clears invalid typed slots in the given free
// ranges.
void CleanupInvalidTypedSlotsOfFreeRanges(
void CleanupTypedSlotsInFreeMemory(
Page* page, const TypedSlotSet::FreeRangesMap& free_ranges_map,
SweepingMode sweeping_mode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment