Revert "[heap] Spawn parallel scavenging task per page in the from space"

This reverts commit 5c6e407d9d.

Reason for revert: memory regression

Bug: chromium:982663

Original change's description:
> [heap] Spawn parallel scavenging task per page in the from space
> 
> This makes the heuristic for computing the number of parallel tasks
> in Scavenger consistent with that in Mark-Compactor.
> 
> The patch helps mobile devices where even 1 MB new space can take
> 10ms to scavenge.
> 
> Change-Id: I979de5e8485b93808ea079af2756f53d9b720e10
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1685612
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#62566}

TBR=ulan@chromium.org,mlippautz@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I046ba0297807ef66abc33241d8948c934fa78028
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1697245
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62769}
This commit is contained in:
Ulan Degenbaev 2019-07-11 09:44:16 +00:00 committed by Commit Bot
parent bc96cbd68c
commit d79a77fb1c
2 changed files with 5 additions and 4 deletions

View File

@ -362,9 +362,11 @@ void ScavengerCollector::MergeSurvivingNewLargeObjects(
int ScavengerCollector::NumberOfScavengeTasks() {
if (!FLAG_parallel_scavenge) return 1;
const int num_pages = heap_->new_space()->from_space().pages_used();
const int num_cores = V8::GetCurrentPlatform()->NumberOfWorkerThreads() + 1;
int tasks = Max(1, Min(Min(num_pages, kMaxScavengerTasks), num_cores));
const int num_scavenge_tasks =
static_cast<int>(heap_->new_space()->TotalCapacity()) / MB;
static int num_cores = V8::GetCurrentPlatform()->NumberOfWorkerThreads() + 1;
int tasks =
Max(1, Min(Min(num_scavenge_tasks, kMaxScavengerTasks), num_cores));
if (!heap_->CanExpandOldGeneration(
static_cast<size_t>(tasks * Page::kPageSize))) {
// Optimize for memory usage near the heap limit.

View File

@ -2782,7 +2782,6 @@ void SemiSpace::Swap(SemiSpace* from, SemiSpace* to) {
std::swap(from->current_page_, to->current_page_);
std::swap(from->external_backing_store_bytes_,
to->external_backing_store_bytes_);
std::swap(from->pages_used_, to->pages_used_);
to->FixPagesFlags(saved_to_space_flags, Page::kCopyOnFlipFlagsMask);
from->FixPagesFlags(0, 0);