Chromium Code Reviews| 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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 was_marked_incrementally_ = false; | 860 was_marked_incrementally_ = false; |
| 861 } | 861 } |
| 862 | 862 |
| 863 if (!was_marked_incrementally_) { | |
| 864 if (heap_->UsingEmbedderHeapTracer()) { | |
| 865 heap_->mark_compact_collector()->embedder_heap_tracer()->TracePrologue(); | |
|
Michael Lippautz
2016/06/09 14:18:13
Since we might abort incremental marking (just abo
| |
| 866 } | |
| 867 } | |
| 868 | |
| 863 // Don't start compaction if we are in the middle of incremental | 869 // Don't start compaction if we are in the middle of incremental |
| 864 // marking cycle. We did not collect any slots. | 870 // marking cycle. We did not collect any slots. |
| 865 if (!FLAG_never_compact && !was_marked_incrementally_) { | 871 if (!FLAG_never_compact && !was_marked_incrementally_) { |
| 866 StartCompaction(NON_INCREMENTAL_COMPACTION); | 872 StartCompaction(NON_INCREMENTAL_COMPACTION); |
| 867 } | 873 } |
| 868 | 874 |
| 869 PagedSpaces spaces(heap()); | 875 PagedSpaces spaces(heap()); |
| 870 for (PagedSpace* space = spaces.next(); space != NULL; | 876 for (PagedSpace* space = spaces.next(); space != NULL; |
| 871 space = spaces.next()) { | 877 space = spaces.next()) { |
| 872 space->PrepareForMarkCompact(); | 878 space->PrepareForMarkCompact(); |
| (...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2313 | 2319 |
| 2314 { | 2320 { |
| 2315 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WEAK_CLOSURE); | 2321 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WEAK_CLOSURE); |
| 2316 | 2322 |
| 2317 // The objects reachable from the roots are marked, yet unreachable | 2323 // The objects reachable from the roots are marked, yet unreachable |
| 2318 // objects are unmarked. Mark objects reachable due to host | 2324 // objects are unmarked. Mark objects reachable due to host |
| 2319 // application specific logic or through Harmony weak maps. | 2325 // application specific logic or through Harmony weak maps. |
| 2320 { | 2326 { |
| 2321 TRACE_GC(heap()->tracer(), | 2327 TRACE_GC(heap()->tracer(), |
| 2322 GCTracer::Scope::MC_MARK_WEAK_CLOSURE_EPHEMERAL); | 2328 GCTracer::Scope::MC_MARK_WEAK_CLOSURE_EPHEMERAL); |
| 2323 if (UsingEmbedderHeapTracer()) { | |
| 2324 embedder_heap_tracer()->TracePrologue(); | |
| 2325 ProcessMarkingDeque(); | |
| 2326 } | |
| 2327 ProcessEphemeralMarking(&root_visitor, false); | 2329 ProcessEphemeralMarking(&root_visitor, false); |
| 2328 } | 2330 } |
| 2329 | 2331 |
| 2330 // The objects reachable from the roots, weak maps or object groups | 2332 // The objects reachable from the roots, weak maps or object groups |
| 2331 // are marked. Objects pointed to only by weak global handles cannot be | 2333 // 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 | 2334 // immediately reclaimed. Instead, we have to mark them as pending and mark |
| 2333 // objects reachable from them. | 2335 // objects reachable from them. |
| 2334 // | 2336 // |
| 2335 // First we identify nonlive weak handles and mark them as pending | 2337 // First we identify nonlive weak handles and mark them as pending |
| 2336 // destruction. | 2338 // destruction. |
| (...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3992 MarkBit mark_bit = Marking::MarkBitFrom(host); | 3994 MarkBit mark_bit = Marking::MarkBitFrom(host); |
| 3993 if (Marking::IsBlack(mark_bit)) { | 3995 if (Marking::IsBlack(mark_bit)) { |
| 3994 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 3996 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
| 3995 RecordRelocSlot(host, &rinfo, target); | 3997 RecordRelocSlot(host, &rinfo, target); |
| 3996 } | 3998 } |
| 3997 } | 3999 } |
| 3998 } | 4000 } |
| 3999 | 4001 |
| 4000 } // namespace internal | 4002 } // namespace internal |
| 4001 } // namespace v8 | 4003 } // namespace v8 |
| OLD | NEW |