Commit 599313b7 authored by Dominik Inführ's avatar Dominik Inführ Committed by V8 LUCI CQ

[heap] Sort map space pages in the sweeper

Now that the map space gets compacted as well, we want to sort pages
for that space when starting sweeping as well.

Bug: v8:12578
Change-Id: I8f25fb05f311d70697d2f7154bd428b4c3e56c13
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3455142
Auto-Submit: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79042}
parent 47e4193f
...@@ -165,18 +165,14 @@ void Sweeper::StartSweeping() { ...@@ -165,18 +165,14 @@ void Sweeper::StartSweeping() {
// evacuating a page, already swept pages will have enough free bytes to // evacuating a page, already swept pages will have enough free bytes to
// hold the objects to move (and therefore, we won't need to wait for more // hold the objects to move (and therefore, we won't need to wait for more
// pages to be swept in order to move those objects). // pages to be swept in order to move those objects).
// Since maps don't move, there is no need to sort the pages from MAP_SPACE
// before sweeping them.
// We sort in descending order of live bytes, i.e., ascending order of free // We sort in descending order of live bytes, i.e., ascending order of free
// bytes, because GetSweepingPageSafe returns pages in reverse order. // bytes, because GetSweepingPageSafe returns pages in reverse order.
if (space != MAP_SPACE) {
int space_index = GetSweepSpaceIndex(space); int space_index = GetSweepSpaceIndex(space);
std::sort( std::sort(
sweeping_list_[space_index].begin(), sweeping_list_[space_index].begin(), sweeping_list_[space_index].end(),
sweeping_list_[space_index].end(), [marking_state](Page* a, Page* b) { [marking_state](Page* a, Page* b) {
return marking_state->live_bytes(a) > marking_state->live_bytes(b); return marking_state->live_bytes(a) > marking_state->live_bytes(b);
}); });
}
}); });
} }
......
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