[heap] Factor out NumberOfAvailableCores
Bug: chromium:651354 Change-Id: Ie940c8715a33e5fc8e8859c4660ab14ecc6f9233 Reviewed-on: https://chromium-review.googlesource.com/505488 Reviewed-by: Hannes Payer <hpayer@chromium.org> Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/master@{#45302}
This commit is contained in:
parent
cea359906a
commit
6546bfe316
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user