Commit 7a261269 authored by Omer Katz's avatar Omer Katz Committed by V8 LUCI CQ

[heap] Revise page iterations

mark-compact.cc: Iterate over all new space pages.
heap-layout-tracer.cc: Iterate over the paged new space.

Bug: v8:12612
Change-Id: I4d8dfc48632908a80793a77c211020452c675ecf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3823134Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82365}
parent 0dc6e037
......@@ -50,16 +50,22 @@ void HeapLayoutTracer::PrintBasicMemoryChunk(std::ostream& os,
// static
void HeapLayoutTracer::PrintHeapLayout(std::ostream& os, Heap* heap) {
const SemiSpaceNewSpace* semi_space_new_space =
SemiSpaceNewSpace::From(heap->new_space());
for (ConstPageIterator it = semi_space_new_space->to_space().begin();
it != semi_space_new_space->to_space().end(); ++it) {
PrintBasicMemoryChunk(os, **it, "to_space");
}
if (FLAG_minor_mc) {
const PagedNewSpace* paged_new_space =
PagedNewSpace::From(heap->new_space());
for (const Page* page : *paged_new_space) {
PrintBasicMemoryChunk(os, *page, "new_space");
}
} else {
const SemiSpaceNewSpace* semi_space_new_space =
SemiSpaceNewSpace::From(heap->new_space());
for (const Page* page : semi_space_new_space->to_space()) {
PrintBasicMemoryChunk(os, *page, "to_space");
}
for (ConstPageIterator it = semi_space_new_space->from_space().begin();
it != semi_space_new_space->from_space().end(); ++it) {
PrintBasicMemoryChunk(os, **it, "from_space");
for (const Page* page : semi_space_new_space->from_space()) {
PrintBasicMemoryChunk(os, *page, "from_space");
}
}
OldGenerationMemoryChunkIterator it(heap);
......
......@@ -3843,13 +3843,12 @@ void MarkCompactCollector::EvacuatePrologue() {
if (new_space) {
// Append the list of new space pages to be processed.
for (Page* p :
PageRange(new_space->first_allocatable_address(), new_space->top())) {
new_space_evacuation_pages_.push_back(p);
for (Page* p : *new_space) {
if (non_atomic_marking_state()->live_bytes(p) > 0) {
new_space_evacuation_pages_.push_back(p);
}
}
new_space->EvacuatePrologue();
DCHECK_EQ(new_space->Size(), 0);
}
if (heap()->new_lo_space()) {
......@@ -5834,9 +5833,11 @@ void MinorMarkCompactCollector::ClearNonLiveReferences() {
void MinorMarkCompactCollector::EvacuatePrologue() {
NewSpace* new_space = heap()->new_space();
// Append the list of new space pages to be processed.
for (Page* p :
PageRange(new_space->first_allocatable_address(), new_space->top())) {
new_space_evacuation_pages_.push_back(p);
DCHECK_NOT_NULL(new_space);
for (Page* p : *new_space) {
if (non_atomic_marking_state()->live_bytes(p) > 0) {
new_space_evacuation_pages_.push_back(p);
}
}
new_space->EvacuatePrologue();
......@@ -6343,7 +6344,7 @@ void MinorMarkCompactCollector::EvacuatePagesInParallel() {
for (Page* page : new_space_evacuation_pages_) {
intptr_t live_bytes_on_page = non_atomic_marking_state()->live_bytes(page);
if (live_bytes_on_page == 0) continue;
DCHECK_LT(0, live_bytes_on_page);
live_bytes += live_bytes_on_page;
if (ShouldMovePage(page, live_bytes_on_page, AlwaysPromoteYoung::kNo)) {
if (page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK)) {
......
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