Index: src/heap/mark-compact.cc |
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc |
index 7232d80683476c53668185ca0a1249e1cafaa573..284b201c33dd5fd67b775c92f24d7140c2e62691 100644 |
--- a/src/heap/mark-compact.cc |
+++ b/src/heap/mark-compact.cc |
@@ -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> |