Index: src/heap/mark-compact.h |
diff --git a/src/heap/mark-compact.h b/src/heap/mark-compact.h |
index 6558eb2ddebba2b6349c64eb2fbf4f2c9ea40247..f5d09e0b2678e4a781a917e47c5b696027aa3ce2 100644 |
--- a/src/heap/mark-compact.h |
+++ b/src/heap/mark-compact.h |
@@ -6,6 +6,7 @@ |
#define V8_HEAP_MARK_COMPACT_H_ |
#include "src/base/bits.h" |
+#include "src/base/sys-info.h" |
#include "src/heap/spaces.h" |
namespace v8 { |
@@ -709,10 +710,15 @@ class MarkCompactCollector { |
void EvacuatePagesInParallel(); |
+ // The number of parallel compaction tasks, including the main thread. |
int NumberOfParallelCompactionTasks() { |
Hannes Payer (out of office)
2015/09/23 07:26:03
Implement this in the cc file. That makes it faste
Michael Lippautz
2015/09/23 07:40:50
Done.
|
- // TODO(hpayer, mlippautz): Figure out some logic to determine the number |
- // of compaction tasks. |
- return 1; |
+ if (!FLAG_parallel_compaction) return 1; |
+ // We cap the number of parallel compaction tasks by |
+ // - (#cores - 1) |
+ // - a value depending on the list of evacuation candidates |
+ // - a hard limit |
Hannes Payer (out of office)
2015/09/23 07:26:03
Make the magic limits named constants.
Michael Lippautz
2015/09/23 07:40:50
Done.
|
+ return Min(8, Min(1 + evacuation_candidates_.length() / 4, |
+ Max(1, base::SysInfo::NumberOfProcessors() - 1))); |
} |
void WaitUntilCompactionCompleted(); |