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 2701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2712 new_space->Flip(); | 2712 new_space->Flip(); |
2713 new_space->ResetAllocationInfo(); | 2713 new_space->ResetAllocationInfo(); |
2714 } | 2714 } |
2715 | 2715 |
2716 void MinorMarkCompactCollector::EvacuateEpilogue() { | 2716 void MinorMarkCompactCollector::EvacuateEpilogue() { |
2717 heap()->new_space()->set_age_mark(heap()->new_space()->top()); | 2717 heap()->new_space()->set_age_mark(heap()->new_space()->top()); |
2718 } | 2718 } |
2719 | 2719 |
2720 void MinorMarkCompactCollector::Evacuate() { | 2720 void MinorMarkCompactCollector::Evacuate() { |
2721 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE); | 2721 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE); |
2722 Heap::RelocationLock relocation_lock(heap()); | 2722 base::LockGuard<base::Mutex> guard(heap()->relocation_mutex()); |
2723 | 2723 |
2724 { | 2724 { |
2725 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_PROLOGUE); | 2725 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_PROLOGUE); |
2726 EvacuatePrologue(); | 2726 EvacuatePrologue(); |
2727 } | 2727 } |
2728 | 2728 |
2729 { | 2729 { |
2730 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_COPY); | 2730 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_COPY); |
2731 EvacuatePagesInParallel(); | 2731 EvacuatePagesInParallel(); |
2732 } | 2732 } |
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4078 } | 4078 } |
4079 | 4079 |
4080 void MarkCompactCollector::Sweeper::AddSweptPageSafe(PagedSpace* space, | 4080 void MarkCompactCollector::Sweeper::AddSweptPageSafe(PagedSpace* space, |
4081 Page* page) { | 4081 Page* page) { |
4082 base::LockGuard<base::Mutex> guard(&mutex_); | 4082 base::LockGuard<base::Mutex> guard(&mutex_); |
4083 swept_list_[space->identity()].Add(page); | 4083 swept_list_[space->identity()].Add(page); |
4084 } | 4084 } |
4085 | 4085 |
4086 void MarkCompactCollector::Evacuate() { | 4086 void MarkCompactCollector::Evacuate() { |
4087 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE); | 4087 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE); |
4088 Heap::RelocationLock relocation_lock(heap()); | 4088 base::LockGuard<base::Mutex> guard(heap()->relocation_mutex()); |
4089 | 4089 |
4090 { | 4090 { |
4091 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_PROLOGUE); | 4091 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_PROLOGUE); |
4092 EvacuatePrologue(); | 4092 EvacuatePrologue(); |
4093 } | 4093 } |
4094 | 4094 |
4095 { | 4095 { |
4096 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_COPY); | 4096 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_EVACUATE_COPY); |
4097 EvacuationScope evacuation_scope(this); | 4097 EvacuationScope evacuation_scope(this); |
4098 EvacuatePagesInParallel(); | 4098 EvacuatePagesInParallel(); |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4638 // The target is always in old space, we don't have to record the slot in | 4638 // The target is always in old space, we don't have to record the slot in |
4639 // the old-to-new remembered set. | 4639 // the old-to-new remembered set. |
4640 DCHECK(!heap()->InNewSpace(target)); | 4640 DCHECK(!heap()->InNewSpace(target)); |
4641 RecordRelocSlot(host, &rinfo, target); | 4641 RecordRelocSlot(host, &rinfo, target); |
4642 } | 4642 } |
4643 } | 4643 } |
4644 } | 4644 } |
4645 | 4645 |
4646 } // namespace internal | 4646 } // namespace internal |
4647 } // namespace v8 | 4647 } // namespace v8 |
OLD | NEW |