| 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 2366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2377 | 2377 |
| 2378 { | 2378 { |
| 2379 TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_MARK_ROOTS); | 2379 TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_MARK_ROOTS); |
| 2380 heap()->IterateRoots(&root_visitor, VISIT_ALL_IN_SCAVENGE); | 2380 heap()->IterateRoots(&root_visitor, VISIT_ALL_IN_SCAVENGE); |
| 2381 ProcessMarkingDeque(); | 2381 ProcessMarkingDeque(); |
| 2382 } | 2382 } |
| 2383 | 2383 |
| 2384 { | 2384 { |
| 2385 TRACE_GC(heap()->tracer(), | 2385 TRACE_GC(heap()->tracer(), |
| 2386 GCTracer::Scope::MINOR_MC_MARK_OLD_TO_NEW_POINTERS); | 2386 GCTracer::Scope::MINOR_MC_MARK_OLD_TO_NEW_POINTERS); |
| 2387 RememberedSet<OLD_TO_NEW>::Iterate(heap(), [this](Address addr) { | 2387 RememberedSet<OLD_TO_NEW>::Iterate( |
| 2388 return CheckAndMarkObject(heap(), addr); | 2388 heap(), NON_SYNCHRONIZED, |
| 2389 }); | 2389 [this](Address addr) { return CheckAndMarkObject(heap(), addr); }); |
| 2390 RememberedSet<OLD_TO_NEW>::IterateTyped( | 2390 RememberedSet<OLD_TO_NEW>::IterateTyped( |
| 2391 heap(), [this](SlotType type, Address host_addr, Address addr) { | 2391 heap(), NON_SYNCHRONIZED, |
| 2392 [this](SlotType type, Address host_addr, Address addr) { |
| 2392 return UpdateTypedSlotHelper::UpdateTypedSlot( | 2393 return UpdateTypedSlotHelper::UpdateTypedSlot( |
| 2393 isolate(), type, addr, [this](Object** addr) { | 2394 isolate(), type, addr, [this](Object** addr) { |
| 2394 return CheckAndMarkObject(heap(), | 2395 return CheckAndMarkObject(heap(), |
| 2395 reinterpret_cast<Address>(addr)); | 2396 reinterpret_cast<Address>(addr)); |
| 2396 }); | 2397 }); |
| 2397 }); | 2398 }); |
| 2398 ProcessMarkingDeque(); | 2399 ProcessMarkingDeque(); |
| 2399 } | 2400 } |
| 2400 | 2401 |
| 2401 { | 2402 { |
| (...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3979 return max_freed; | 3980 return max_freed; |
| 3980 if ((max_pages > 0) && (pages_freed >= max_pages)) return max_freed; | 3981 if ((max_pages > 0) && (pages_freed >= max_pages)) return max_freed; |
| 3981 } | 3982 } |
| 3982 return max_freed; | 3983 return max_freed; |
| 3983 } | 3984 } |
| 3984 | 3985 |
| 3985 int MarkCompactCollector::Sweeper::ParallelSweepPage(Page* page, | 3986 int MarkCompactCollector::Sweeper::ParallelSweepPage(Page* page, |
| 3986 AllocationSpace identity) { | 3987 AllocationSpace identity) { |
| 3987 int max_freed = 0; | 3988 int max_freed = 0; |
| 3988 { | 3989 { |
| 3989 base::LockGuard<base::Mutex> guard(page->mutex()); | 3990 base::LockGuard<base::RecursiveMutex> guard(page->mutex()); |
| 3990 // If this page was already swept in the meantime, we can return here. | 3991 // If this page was already swept in the meantime, we can return here. |
| 3991 if (page->SweepingDone()) return 0; | 3992 if (page->SweepingDone()) return 0; |
| 3992 DCHECK_EQ(Page::kSweepingPending, | 3993 DCHECK_EQ(Page::kSweepingPending, |
| 3993 page->concurrent_sweeping_state().Value()); | 3994 page->concurrent_sweeping_state().Value()); |
| 3994 page->concurrent_sweeping_state().SetValue(Page::kSweepingInProgress); | 3995 page->concurrent_sweeping_state().SetValue(Page::kSweepingInProgress); |
| 3995 const Sweeper::FreeSpaceTreatmentMode free_space_mode = | 3996 const Sweeper::FreeSpaceTreatmentMode free_space_mode = |
| 3996 Heap::ShouldZapGarbage() ? ZAP_FREE_SPACE : IGNORE_FREE_SPACE; | 3997 Heap::ShouldZapGarbage() ? ZAP_FREE_SPACE : IGNORE_FREE_SPACE; |
| 3997 if (identity == NEW_SPACE) { | 3998 if (identity == NEW_SPACE) { |
| 3998 RawSweep(page, IGNORE_FREE_LIST, free_space_mode); | 3999 RawSweep(page, IGNORE_FREE_LIST, free_space_mode); |
| 3999 } else { | 4000 } else { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4168 // The target is always in old space, we don't have to record the slot in | 4169 // The target is always in old space, we don't have to record the slot in |
| 4169 // the old-to-new remembered set. | 4170 // the old-to-new remembered set. |
| 4170 DCHECK(!heap()->InNewSpace(target)); | 4171 DCHECK(!heap()->InNewSpace(target)); |
| 4171 RecordRelocSlot(host, &rinfo, target); | 4172 RecordRelocSlot(host, &rinfo, target); |
| 4172 } | 4173 } |
| 4173 } | 4174 } |
| 4174 } | 4175 } |
| 4175 | 4176 |
| 4176 } // namespace internal | 4177 } // namespace internal |
| 4177 } // namespace v8 | 4178 } // namespace v8 |
| OLD | NEW |