Commit 6546bfe3 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[heap] Factor out NumberOfAvailableCores

Bug: chromium:651354
Change-Id: Ie940c8715a33e5fc8e8859c4660ab14ecc6f9233
Reviewed-on: https://chromium-review.googlesource.com/505488Reviewed-by: 's avatarHannes Payer <hpayer@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45302}
parent cea35990
......@@ -335,20 +335,19 @@ class YoungGenerationEvacuationVerifier : public EvacuationVerifier {
// MarkCompactCollectorBase, MinorMarkCompactCollector, MarkCompactCollector
// =============================================================================
int MarkCompactCollectorBase::NumberOfParallelCompactionTasks(int pages) {
if (!FLAG_parallel_compaction) return 1;
const int available_cores = Max(
static int NumberOfAvailableCores() {
return Max(
1, static_cast<int>(
V8::GetCurrentPlatform()->NumberOfAvailableBackgroundThreads()));
return Min(available_cores, pages);
}
int MarkCompactCollectorBase::NumberOfParallelCompactionTasks(int pages) {
return FLAG_parallel_compaction ? Min(NumberOfAvailableCores(), pages) : 1;
}
int MarkCompactCollectorBase::NumberOfPointerUpdateTasks(int pages) {
if (!FLAG_parallel_pointer_update) return 1;
const int available_cores = Max(
1, static_cast<int>(
V8::GetCurrentPlatform()->NumberOfAvailableBackgroundThreads()));
return Min(available_cores, pages);
return FLAG_parallel_pointer_update ? Min(NumberOfAvailableCores(), pages)
: 1;
}
MarkCompactCollector::MarkCompactCollector(Heap* heap)
......
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