Chromium Code Reviews| Index: src/heap/mark-compact.cc |
| diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc |
| index 7f98b33ec508509c858f20078a5548009ed9d941..96a10c5d30d5afbaba9f53c22278388ba7552932 100644 |
| --- a/src/heap/mark-compact.cc |
| +++ b/src/heap/mark-compact.cc |
| @@ -3370,23 +3370,22 @@ bool MarkCompactCollector::EvacuateLiveObjectsFromPage( |
| void MarkCompactCollector::EvacuatePagesInParallel() { |
| if (evacuation_candidates_.length() == 0) return; |
| - int num_tasks = 1; |
| - if (FLAG_parallel_compaction) { |
| - num_tasks = NumberOfParallelCompactionTasks(); |
| - } |
| + const int num_tasks = NumberOfParallelCompactionTasks(); |
| // Set up compaction spaces. |
| CompactionSpaceCollection** compaction_spaces_for_tasks = |
| new CompactionSpaceCollection*[num_tasks]; |
| + FreeList** free_lists = new FreeList*[2 * num_tasks]; |
| for (int i = 0; i < num_tasks; i++) { |
| compaction_spaces_for_tasks[i] = new CompactionSpaceCollection(heap()); |
| + free_lists[i] = compaction_spaces_for_tasks[i]->Get(OLD_SPACE)->free_list(); |
| + free_lists[i + num_tasks] = |
| + compaction_spaces_for_tasks[i]->Get(CODE_SPACE)->free_list(); |
| } |
| - |
| - compaction_spaces_for_tasks[0]->Get(OLD_SPACE)->MoveOverFreeMemory( |
| - heap()->old_space()); |
| - compaction_spaces_for_tasks[0] |
| - ->Get(CODE_SPACE) |
| - ->MoveOverFreeMemory(heap()->code_space()); |
| + heap()->old_space()->free_list()->Divide(free_lists, num_tasks, 1 * MB); |
| + heap()->code_space()->free_list()->Divide(&free_lists[num_tasks], num_tasks, |
| + 1 * MB); |
| + delete[] free_lists; |
| compaction_in_progress_ = true; |
| // Kick off parallel tasks. |
| @@ -3397,10 +3396,8 @@ void MarkCompactCollector::EvacuatePagesInParallel() { |
| v8::Platform::kShortRunningTask); |
| } |
| - // Contribute in main thread. Counter and signal are in principal not needed. |
| - concurrent_compaction_tasks_active_++; |
| + // Contribute in main thread. |
|
Hannes Payer (out of office)
2015/09/23 07:26:03
// Perform compaction on the main thread.
Michael Lippautz
2015/09/23 07:40:50
Done.
|
| EvacuatePages(compaction_spaces_for_tasks[0], &migration_slots_buffer_); |
| - pending_compaction_tasks_semaphore_.Signal(); |
| WaitUntilCompactionCompleted(); |