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 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 AbortTransitionArrays(); | 807 AbortTransitionArrays(); |
808 AbortCompaction(); | 808 AbortCompaction(); |
809 if (heap_->UsingEmbedderHeapTracer()) { | 809 if (heap_->UsingEmbedderHeapTracer()) { |
810 heap_->mark_compact_collector()->embedder_heap_tracer()->AbortTracing(); | 810 heap_->mark_compact_collector()->embedder_heap_tracer()->AbortTracing(); |
811 } | 811 } |
812 was_marked_incrementally_ = false; | 812 was_marked_incrementally_ = false; |
813 } | 813 } |
814 | 814 |
815 if (!was_marked_incrementally_) { | 815 if (!was_marked_incrementally_) { |
816 if (heap_->UsingEmbedderHeapTracer()) { | 816 if (heap_->UsingEmbedderHeapTracer()) { |
| 817 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WRAPPER_PROLOGUE); |
817 heap_->mark_compact_collector()->embedder_heap_tracer()->TracePrologue(); | 818 heap_->mark_compact_collector()->embedder_heap_tracer()->TracePrologue(); |
818 } | 819 } |
819 } | 820 } |
820 | 821 |
821 if (UsingEmbedderHeapTracer()) { | 822 if (UsingEmbedderHeapTracer()) { |
822 embedder_heap_tracer()->EnterFinalPause(); | 823 embedder_heap_tracer()->EnterFinalPause(); |
823 } | 824 } |
824 | 825 |
825 // Don't start compaction if we are in the middle of incremental | 826 // Don't start compaction if we are in the middle of incremental |
826 // marking cycle. We did not collect any slots. | 827 // marking cycle. We did not collect any slots. |
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2074 } | 2075 } |
2075 | 2076 |
2076 // Mark all objects reachable (transitively) from objects on the marking | 2077 // Mark all objects reachable (transitively) from objects on the marking |
2077 // stack including references only considered in the atomic marking pause. | 2078 // stack including references only considered in the atomic marking pause. |
2078 void MarkCompactCollector::ProcessEphemeralMarking( | 2079 void MarkCompactCollector::ProcessEphemeralMarking( |
2079 ObjectVisitor* visitor, bool only_process_harmony_weak_collections) { | 2080 ObjectVisitor* visitor, bool only_process_harmony_weak_collections) { |
2080 DCHECK(marking_deque_.IsEmpty() && !marking_deque_.overflowed()); | 2081 DCHECK(marking_deque_.IsEmpty() && !marking_deque_.overflowed()); |
2081 bool work_to_do = true; | 2082 bool work_to_do = true; |
2082 while (work_to_do) { | 2083 while (work_to_do) { |
2083 if (UsingEmbedderHeapTracer()) { | 2084 if (UsingEmbedderHeapTracer()) { |
| 2085 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WRAPPER_TRACING); |
2084 RegisterWrappersWithEmbedderHeapTracer(); | 2086 RegisterWrappersWithEmbedderHeapTracer(); |
2085 embedder_heap_tracer()->AdvanceTracing( | 2087 embedder_heap_tracer()->AdvanceTracing( |
2086 0, EmbedderHeapTracer::AdvanceTracingActions( | 2088 0, EmbedderHeapTracer::AdvanceTracingActions( |
2087 EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION)); | 2089 EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION)); |
2088 } | 2090 } |
2089 if (!only_process_harmony_weak_collections) { | 2091 if (!only_process_harmony_weak_collections) { |
| 2092 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_OBJECT_GROUPING); |
2090 isolate()->global_handles()->IterateObjectGroups( | 2093 isolate()->global_handles()->IterateObjectGroups( |
2091 visitor, &IsUnmarkedHeapObjectWithHeap); | 2094 visitor, &IsUnmarkedHeapObjectWithHeap); |
2092 MarkImplicitRefGroups(&MarkCompactMarkingVisitor::MarkObject); | 2095 MarkImplicitRefGroups(&MarkCompactMarkingVisitor::MarkObject); |
2093 } | 2096 } |
2094 ProcessWeakCollections(); | 2097 ProcessWeakCollections(); |
2095 work_to_do = !marking_deque_.IsEmpty(); | 2098 work_to_do = !marking_deque_.IsEmpty(); |
2096 ProcessMarkingDeque(); | 2099 ProcessMarkingDeque(); |
2097 } | 2100 } |
2098 } | 2101 } |
2099 | 2102 |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2358 | 2361 |
2359 // Repeat Harmony weak maps marking to mark unmarked objects reachable from | 2362 // Repeat Harmony weak maps marking to mark unmarked objects reachable from |
2360 // the weak roots we just marked as pending destruction. | 2363 // the weak roots we just marked as pending destruction. |
2361 // | 2364 // |
2362 // We only process harmony collections, as all object groups have been fully | 2365 // We only process harmony collections, as all object groups have been fully |
2363 // processed and no weakly reachable node can discover new objects groups. | 2366 // processed and no weakly reachable node can discover new objects groups. |
2364 { | 2367 { |
2365 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WEAK_CLOSURE_HARMONY); | 2368 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WEAK_CLOSURE_HARMONY); |
2366 ProcessEphemeralMarking(&root_visitor, true); | 2369 ProcessEphemeralMarking(&root_visitor, true); |
2367 if (UsingEmbedderHeapTracer()) { | 2370 if (UsingEmbedderHeapTracer()) { |
| 2371 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WRAPPER_EPILOGUE); |
2368 embedder_heap_tracer()->TraceEpilogue(); | 2372 embedder_heap_tracer()->TraceEpilogue(); |
2369 } | 2373 } |
2370 } | 2374 } |
2371 } | 2375 } |
2372 | 2376 |
2373 if (FLAG_print_cumulative_gc_stat) { | 2377 if (FLAG_print_cumulative_gc_stat) { |
2374 heap_->tracer()->AddMarkingTime(heap_->MonotonicallyIncreasingTimeInMs() - | 2378 heap_->tracer()->AddMarkingTime(heap_->MonotonicallyIncreasingTimeInMs() - |
2375 start_time); | 2379 start_time); |
2376 } | 2380 } |
2377 } | 2381 } |
(...skipping 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4029 // The target is always in old space, we don't have to record the slot in | 4033 // The target is always in old space, we don't have to record the slot in |
4030 // the old-to-new remembered set. | 4034 // the old-to-new remembered set. |
4031 DCHECK(!heap()->InNewSpace(target)); | 4035 DCHECK(!heap()->InNewSpace(target)); |
4032 RecordRelocSlot(host, &rinfo, target); | 4036 RecordRelocSlot(host, &rinfo, target); |
4033 } | 4037 } |
4034 } | 4038 } |
4035 } | 4039 } |
4036 | 4040 |
4037 } // namespace internal | 4041 } // namespace internal |
4038 } // namespace v8 | 4042 } // namespace v8 |
OLD | NEW |