Commit 69bc0157 authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[heap] Avoid unnecessary expansion of compaction spaces

This fixes a corner case during young generation evacuation:
1) Sweeping is in progress, but all pages are swept.
2) The main thread has acquired all swept pages.
3) A compaction space cannot get any swept page and has to allocate a
   new page.

This reduces memory usage of ArrayLiteralInitialSpreadLargeDoubleHoley
microbenchmark by 2x.

Bug: chromium:934453
Change-Id: I146d22a408910ae89adbfbac5822448952f5f0c7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1505798Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60069}
parent e15bb0b3
......@@ -3255,9 +3255,11 @@ bool PagedSpace::RawSlowRefillLinearAllocationArea(int size_in_bytes) {
static_cast<size_t>(size_in_bytes)))
return true;
}
} else if (is_local()) {
// Sweeping not in progress and we are on a {CompactionSpace}. This can
// only happen when we are evacuating for the young generation.
}
if (is_local()) {
// The main thread may have acquired all swept pages. Try to steal from
// it. This can only happen during young generation evacuation.
PagedSpace* main_space = heap()->paged_space(identity());
Page* page = main_space->RemovePageSafe(size_in_bytes);
if (page != nullptr) {
......
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