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

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

Issue 2872063003: [heap] Bound number of tasks by embedder limit instead of artificially capping (Closed)
Patch Set: Fix compilation Created 3 years, 7 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
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/page-parallel-job.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index e1e1af4b054d4e9eef6a8fe7d03c346675d166ed..e810649af8ef8e9884e8346874befc6761a05c8c 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -335,32 +335,20 @@ class YoungGenerationEvacuationVerifier : public EvacuationVerifier {
// MarkCompactCollectorBase, MinorMarkCompactCollector, MarkCompactCollector
// =============================================================================
-int MarkCompactCollectorBase::NumberOfParallelCompactionTasks(
- int pages, intptr_t live_bytes) {
+int MarkCompactCollectorBase::NumberOfParallelCompactionTasks(int pages) {
if (!FLAG_parallel_compaction) return 1;
- // Compute the number of needed tasks based on a target compaction time, the
- // profiled compaction speed and marked live memory.
- //
- // The number of parallel compaction tasks is limited by:
- // - #evacuation pages
- // - #cores
- const double kTargetCompactionTimeInMs = .5;
-
- double compaction_speed =
- heap()->tracer()->CompactionSpeedInBytesPerMillisecond();
+ const int available_cores = Max(
+ 1, static_cast<int>(
+ V8::GetCurrentPlatform()->NumberOfAvailableBackgroundThreads()));
+ return Min(available_cores, pages);
+}
+int MarkCompactCollectorBase::NumberOfPointerUpdateTasks(int pages) {
+ if (!FLAG_parallel_pointer_update) return 1;
const int available_cores = Max(
1, static_cast<int>(
V8::GetCurrentPlatform()->NumberOfAvailableBackgroundThreads()));
- int tasks;
- if (compaction_speed > 0) {
- tasks = 1 + static_cast<int>(live_bytes / compaction_speed /
- kTargetCompactionTimeInMs);
- } else {
- tasks = pages;
- }
- const int tasks_capped_pages = Min(pages, tasks);
- return Min(available_cores, tasks_capped_pages);
+ return Min(available_cores, pages);
}
MarkCompactCollector::MarkCompactCollector(Heap* heap)
@@ -3744,7 +3732,7 @@ void MarkCompactCollectorBase::CreateAndExecuteEvacuationTasks(
ProfilingMigrationObserver profiling_observer(heap());
const int wanted_num_tasks =
- NumberOfParallelCompactionTasks(job->NumberOfPages(), live_bytes);
+ NumberOfParallelCompactionTasks(job->NumberOfPages());
Evacuator** evacuators = new Evacuator*[wanted_num_tasks];
for (int i = 0; i < wanted_num_tasks; i++) {
evacuators[i] = new Evacuator(collector, record_visitor);
@@ -4262,18 +4250,10 @@ class PointerUpdateJobTraits {
}
};
-int NumberOfPointerUpdateTasks(int pages) {
- if (!FLAG_parallel_pointer_update) return 1;
- const int available_cores = Max(
- 1, static_cast<int>(
- V8::GetCurrentPlatform()->NumberOfAvailableBackgroundThreads()));
- const int kPagesPerTask = 4;
- return Min(available_cores, (pages + kPagesPerTask - 1) / kPagesPerTask);
-}
-
template <RememberedSetType type>
-void UpdatePointersInParallel(Heap* heap, base::Semaphore* semaphore,
- const MarkCompactCollectorBase* collector) {
+void MarkCompactCollectorBase::UpdatePointersInParallel(
+ Heap* heap, base::Semaphore* semaphore,
+ const MarkCompactCollectorBase* collector) {
PageParallelJob<PointerUpdateJobTraits<type> > job(
heap, heap->isolate()->cancelable_task_manager(), semaphore);
RememberedSet<type>::IterateMemoryChunks(
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/page-parallel-job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698