OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/heap/mark-compact.h" | 5 #include "src/heap/mark-compact.h" |
6 | 6 |
7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/base/sys-info.h" | 9 #include "src/base/sys-info.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 3264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3275 // Used for trace summary. | 3275 // Used for trace summary. |
3276 intptr_t compaction_speed = 0; | 3276 intptr_t compaction_speed = 0; |
3277 if (FLAG_trace_fragmentation) { | 3277 if (FLAG_trace_fragmentation) { |
3278 compaction_speed = heap()->tracer()->CompactionSpeedInBytesPerMillisecond(); | 3278 compaction_speed = heap()->tracer()->CompactionSpeedInBytesPerMillisecond(); |
3279 } | 3279 } |
3280 | 3280 |
3281 const int num_tasks = NumberOfParallelCompactionTasks(num_pages, live_bytes); | 3281 const int num_tasks = NumberOfParallelCompactionTasks(num_pages, live_bytes); |
3282 | 3282 |
3283 // Set up compaction spaces. | 3283 // Set up compaction spaces. |
3284 Evacuator** evacuators = new Evacuator*[num_tasks]; | 3284 Evacuator** evacuators = new Evacuator*[num_tasks]; |
| 3285 CompactionSpaceCollection** compaction_spaces_for_tasks = |
| 3286 new CompactionSpaceCollection*[num_tasks]; |
3285 for (int i = 0; i < num_tasks; i++) { | 3287 for (int i = 0; i < num_tasks; i++) { |
3286 evacuators[i] = new Evacuator(this, evacuation_candidates_, | 3288 evacuators[i] = new Evacuator(this, evacuation_candidates_, |
3287 newspace_evacuation_candidates_); | 3289 newspace_evacuation_candidates_); |
| 3290 compaction_spaces_for_tasks[i] = evacuators[i]->compaction_spaces(); |
3288 } | 3291 } |
| 3292 heap()->old_space()->DivideUponCompactionSpaces(compaction_spaces_for_tasks, |
| 3293 num_tasks); |
| 3294 heap()->code_space()->DivideUponCompactionSpaces(compaction_spaces_for_tasks, |
| 3295 num_tasks); |
| 3296 delete[] compaction_spaces_for_tasks; |
3289 | 3297 |
3290 // Kick off parallel tasks. | 3298 // Kick off parallel tasks. |
3291 StartParallelCompaction(evacuators, num_tasks); | 3299 StartParallelCompaction(evacuators, num_tasks); |
3292 // Wait for unfinished and not-yet-started tasks. | 3300 // Wait for unfinished and not-yet-started tasks. |
3293 WaitUntilCompactionCompleted(&evacuators[1], num_tasks - 1); | 3301 WaitUntilCompactionCompleted(&evacuators[1], num_tasks - 1); |
3294 | 3302 |
3295 // Finalize local evacuators by merging back all locally cached data. | 3303 // Finalize local evacuators by merging back all locally cached data. |
3296 for (int i = 0; i < num_tasks; i++) { | 3304 for (int i = 0; i < num_tasks; i++) { |
3297 evacuators[i]->Finalize(); | 3305 evacuators[i]->Finalize(); |
3298 delete evacuators[i]; | 3306 delete evacuators[i]; |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4056 MarkBit mark_bit = Marking::MarkBitFrom(host); | 4064 MarkBit mark_bit = Marking::MarkBitFrom(host); |
4057 if (Marking::IsBlack(mark_bit)) { | 4065 if (Marking::IsBlack(mark_bit)) { |
4058 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 4066 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
4059 RecordRelocSlot(&rinfo, target); | 4067 RecordRelocSlot(&rinfo, target); |
4060 } | 4068 } |
4061 } | 4069 } |
4062 } | 4070 } |
4063 | 4071 |
4064 } // namespace internal | 4072 } // namespace internal |
4065 } // namespace v8 | 4073 } // namespace v8 |
OLD | NEW |