Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Unified Diff: src/heap/mark-compact.h

Issue 1354383002: [heap] Add more tasks for parallel compaction (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Turn on parallel compaction Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();

Powered by Google App Engine
This is Rietveld 408576698