| 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 3567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3578 | 3578 |
| 3579 int NumberOfPointerUpdateTasks(int pages) { | 3579 int NumberOfPointerUpdateTasks(int pages) { |
| 3580 if (!FLAG_parallel_pointer_update) return 1; | 3580 if (!FLAG_parallel_pointer_update) return 1; |
| 3581 const int kMaxTasks = 4; | 3581 const int kMaxTasks = 4; |
| 3582 const int kPagesPerTask = 4; | 3582 const int kPagesPerTask = 4; |
| 3583 return Min(kMaxTasks, (pages + kPagesPerTask - 1) / kPagesPerTask); | 3583 return Min(kMaxTasks, (pages + kPagesPerTask - 1) / kPagesPerTask); |
| 3584 } | 3584 } |
| 3585 | 3585 |
| 3586 template <PointerDirection direction> | 3586 template <PointerDirection direction> |
| 3587 void UpdatePointersInParallel(Heap* heap) { | 3587 void UpdatePointersInParallel(Heap* heap) { |
| 3588 PageParallelJob<PointerUpdateJobTraits<direction> >* job = | 3588 PageParallelJob<PointerUpdateJobTraits<direction> > job( |
| 3589 new PageParallelJob<PointerUpdateJobTraits<direction> >( | 3589 heap, heap->isolate()->cancelable_task_manager()); |
| 3590 heap, heap->isolate()->cancelable_task_manager()); | |
| 3591 RememberedSet<direction>::IterateMemoryChunks( | 3590 RememberedSet<direction>::IterateMemoryChunks( |
| 3592 heap, [job](MemoryChunk* chunk) { job->AddPage(chunk, 0); }); | 3591 heap, [&job](MemoryChunk* chunk) { job.AddPage(chunk, 0); }); |
| 3593 PointersUpdatingVisitor visitor(heap); | 3592 PointersUpdatingVisitor visitor(heap); |
| 3594 int num_pages = job->NumberOfPages(); | 3593 int num_pages = job.NumberOfPages(); |
| 3595 int num_tasks = NumberOfPointerUpdateTasks(num_pages); | 3594 int num_tasks = NumberOfPointerUpdateTasks(num_pages); |
| 3596 job->Run(num_tasks, [&visitor](int i) { return &visitor; }); | 3595 job.Run(num_tasks, [&visitor](int i) { return &visitor; }); |
| 3597 delete job; | |
| 3598 } | 3596 } |
| 3599 | 3597 |
| 3600 void MarkCompactCollector::UpdatePointersAfterEvacuation() { | 3598 void MarkCompactCollector::UpdatePointersAfterEvacuation() { |
| 3601 GCTracer::Scope gc_scope(heap()->tracer(), | 3599 GCTracer::Scope gc_scope(heap()->tracer(), |
| 3602 GCTracer::Scope::MC_EVACUATE_UPDATE_POINTERS); | 3600 GCTracer::Scope::MC_EVACUATE_UPDATE_POINTERS); |
| 3603 | 3601 |
| 3604 PointersUpdatingVisitor updating_visitor(heap()); | 3602 PointersUpdatingVisitor updating_visitor(heap()); |
| 3605 | 3603 |
| 3606 { | 3604 { |
| 3607 GCTracer::Scope gc_scope( | 3605 GCTracer::Scope gc_scope( |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3879 MarkBit mark_bit = Marking::MarkBitFrom(host); | 3877 MarkBit mark_bit = Marking::MarkBitFrom(host); |
| 3880 if (Marking::IsBlack(mark_bit)) { | 3878 if (Marking::IsBlack(mark_bit)) { |
| 3881 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 3879 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
| 3882 RecordRelocSlot(host, &rinfo, target); | 3880 RecordRelocSlot(host, &rinfo, target); |
| 3883 } | 3881 } |
| 3884 } | 3882 } |
| 3885 } | 3883 } |
| 3886 | 3884 |
| 3887 } // namespace internal | 3885 } // namespace internal |
| 3888 } // namespace v8 | 3886 } // namespace v8 |
| OLD | NEW |