| 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 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 heap()->memory_allocator()->unmapper()->WaitUntilCompleted(); | 850 heap()->memory_allocator()->unmapper()->WaitUntilCompleted(); |
| 851 | 851 |
| 852 // Clear marking bits if incremental marking is aborted. | 852 // Clear marking bits if incremental marking is aborted. |
| 853 if (was_marked_incrementally_ && heap_->ShouldAbortIncrementalMarking()) { | 853 if (was_marked_incrementally_ && heap_->ShouldAbortIncrementalMarking()) { |
| 854 heap()->incremental_marking()->Stop(); | 854 heap()->incremental_marking()->Stop(); |
| 855 ClearMarkbits(); | 855 ClearMarkbits(); |
| 856 AbortWeakCollections(); | 856 AbortWeakCollections(); |
| 857 AbortWeakCells(); | 857 AbortWeakCells(); |
| 858 AbortTransitionArrays(); | 858 AbortTransitionArrays(); |
| 859 AbortCompaction(); | 859 AbortCompaction(); |
| 860 if (heap_->UsingEmbedderHeapTracer()) { |
| 861 heap_->mark_compact_collector()->embedder_heap_tracer()->AbortTracing(); |
| 862 } |
| 860 was_marked_incrementally_ = false; | 863 was_marked_incrementally_ = false; |
| 861 } | 864 } |
| 862 | 865 |
| 866 if (!was_marked_incrementally_) { |
| 867 if (heap_->UsingEmbedderHeapTracer()) { |
| 868 heap_->mark_compact_collector()->embedder_heap_tracer()->TracePrologue(); |
| 869 } |
| 870 } |
| 871 |
| 863 // Don't start compaction if we are in the middle of incremental | 872 // Don't start compaction if we are in the middle of incremental |
| 864 // marking cycle. We did not collect any slots. | 873 // marking cycle. We did not collect any slots. |
| 865 if (!FLAG_never_compact && !was_marked_incrementally_) { | 874 if (!FLAG_never_compact && !was_marked_incrementally_) { |
| 866 StartCompaction(NON_INCREMENTAL_COMPACTION); | 875 StartCompaction(NON_INCREMENTAL_COMPACTION); |
| 867 } | 876 } |
| 868 | 877 |
| 869 PagedSpaces spaces(heap()); | 878 PagedSpaces spaces(heap()); |
| 870 for (PagedSpace* space = spaces.next(); space != NULL; | 879 for (PagedSpace* space = spaces.next(); space != NULL; |
| 871 space = spaces.next()) { | 880 space = spaces.next()) { |
| 872 space->PrepareForMarkCompact(); | 881 space->PrepareForMarkCompact(); |
| (...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2313 | 2322 |
| 2314 { | 2323 { |
| 2315 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WEAK_CLOSURE); | 2324 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WEAK_CLOSURE); |
| 2316 | 2325 |
| 2317 // The objects reachable from the roots are marked, yet unreachable | 2326 // The objects reachable from the roots are marked, yet unreachable |
| 2318 // objects are unmarked. Mark objects reachable due to host | 2327 // objects are unmarked. Mark objects reachable due to host |
| 2319 // application specific logic or through Harmony weak maps. | 2328 // application specific logic or through Harmony weak maps. |
| 2320 { | 2329 { |
| 2321 TRACE_GC(heap()->tracer(), | 2330 TRACE_GC(heap()->tracer(), |
| 2322 GCTracer::Scope::MC_MARK_WEAK_CLOSURE_EPHEMERAL); | 2331 GCTracer::Scope::MC_MARK_WEAK_CLOSURE_EPHEMERAL); |
| 2323 if (UsingEmbedderHeapTracer()) { | |
| 2324 embedder_heap_tracer()->TracePrologue(); | |
| 2325 ProcessMarkingDeque(); | |
| 2326 } | |
| 2327 ProcessEphemeralMarking(&root_visitor, false); | 2332 ProcessEphemeralMarking(&root_visitor, false); |
| 2328 } | 2333 } |
| 2329 | 2334 |
| 2330 // The objects reachable from the roots, weak maps or object groups | 2335 // The objects reachable from the roots, weak maps or object groups |
| 2331 // are marked. Objects pointed to only by weak global handles cannot be | 2336 // are marked. Objects pointed to only by weak global handles cannot be |
| 2332 // immediately reclaimed. Instead, we have to mark them as pending and mark | 2337 // immediately reclaimed. Instead, we have to mark them as pending and mark |
| 2333 // objects reachable from them. | 2338 // objects reachable from them. |
| 2334 // | 2339 // |
| 2335 // First we identify nonlive weak handles and mark them as pending | 2340 // First we identify nonlive weak handles and mark them as pending |
| 2336 // destruction. | 2341 // destruction. |
| (...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3992 MarkBit mark_bit = Marking::MarkBitFrom(host); | 3997 MarkBit mark_bit = Marking::MarkBitFrom(host); |
| 3993 if (Marking::IsBlack(mark_bit)) { | 3998 if (Marking::IsBlack(mark_bit)) { |
| 3994 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 3999 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
| 3995 RecordRelocSlot(host, &rinfo, target); | 4000 RecordRelocSlot(host, &rinfo, target); |
| 3996 } | 4001 } |
| 3997 } | 4002 } |
| 3998 } | 4003 } |
| 3999 | 4004 |
| 4000 } // namespace internal | 4005 } // namespace internal |
| 4001 } // namespace v8 | 4006 } // namespace v8 |
| OLD | NEW |