Commit dd27284c authored by ulan's avatar ulan Committed by Commit bot

[heap] Compute number of pointer update tasks based on available cores.

BUG=

Review-Url: https://codereview.chromium.org/2477733002
Cr-Commit-Position: refs/heads/master@{#40728}
parent 50eac423
......@@ -3588,9 +3588,11 @@ class PointerUpdateJobTraits {
int NumberOfPointerUpdateTasks(int pages) {
if (!FLAG_parallel_pointer_update) return 1;
const int kMaxTasks = 4;
const int available_cores = Max(
1, static_cast<int>(
V8::GetCurrentPlatform()->NumberOfAvailableBackgroundThreads()));
const int kPagesPerTask = 4;
return Min(kMaxTasks, (pages + kPagesPerTask - 1) / kPagesPerTask);
return Min(available_cores, (pages + kPagesPerTask - 1) / kPagesPerTask);
}
template <PointerDirection direction>
......
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