| 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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 heap_->local_embedder_heap_tracer()->AbortTracing(); | 799 heap_->local_embedder_heap_tracer()->AbortTracing(); |
| 800 marking_deque()->Clear(); | 800 marking_deque()->Clear(); |
| 801 was_marked_incrementally_ = false; | 801 was_marked_incrementally_ = false; |
| 802 } | 802 } |
| 803 | 803 |
| 804 if (!was_marked_incrementally_) { | 804 if (!was_marked_incrementally_) { |
| 805 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WRAPPER_PROLOGUE); | 805 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WRAPPER_PROLOGUE); |
| 806 heap_->local_embedder_heap_tracer()->TracePrologue(); | 806 heap_->local_embedder_heap_tracer()->TracePrologue(); |
| 807 } | 807 } |
| 808 | 808 |
| 809 heap_->local_embedder_heap_tracer()->EnterFinalPause(); | |
| 810 | |
| 811 // Don't start compaction if we are in the middle of incremental | 809 // Don't start compaction if we are in the middle of incremental |
| 812 // marking cycle. We did not collect any slots. | 810 // marking cycle. We did not collect any slots. |
| 813 if (!FLAG_never_compact && !was_marked_incrementally_) { | 811 if (!FLAG_never_compact && !was_marked_incrementally_) { |
| 814 StartCompaction(); | 812 StartCompaction(); |
| 815 } | 813 } |
| 816 | 814 |
| 817 PagedSpaces spaces(heap()); | 815 PagedSpaces spaces(heap()); |
| 818 for (PagedSpace* space = spaces.next(); space != NULL; | 816 for (PagedSpace* space = spaces.next(); space != NULL; |
| 819 space = spaces.next()) { | 817 space = spaces.next()) { |
| 820 space->PrepareForMarkCompact(); | 818 space->PrepareForMarkCompact(); |
| (...skipping 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2433 } | 2431 } |
| 2434 } | 2432 } |
| 2435 | 2433 |
| 2436 #ifdef DEBUG | 2434 #ifdef DEBUG |
| 2437 DCHECK(state_ == PREPARE_GC); | 2435 DCHECK(state_ == PREPARE_GC); |
| 2438 state_ = MARK_LIVE_OBJECTS; | 2436 state_ = MARK_LIVE_OBJECTS; |
| 2439 #endif | 2437 #endif |
| 2440 | 2438 |
| 2441 marking_deque()->StartUsing(); | 2439 marking_deque()->StartUsing(); |
| 2442 | 2440 |
| 2441 heap_->local_embedder_heap_tracer()->EnterFinalPause(); |
| 2442 |
| 2443 { | 2443 { |
| 2444 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_PREPARE_CODE_FLUSH); | 2444 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_PREPARE_CODE_FLUSH); |
| 2445 PrepareForCodeFlushing(); | 2445 PrepareForCodeFlushing(); |
| 2446 } | 2446 } |
| 2447 | 2447 |
| 2448 RootMarkingVisitor<MarkCompactMode::FULL> root_visitor(heap()); | 2448 RootMarkingVisitor<MarkCompactMode::FULL> root_visitor(heap()); |
| 2449 | 2449 |
| 2450 { | 2450 { |
| 2451 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_ROOTS); | 2451 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_ROOTS); |
| 2452 MarkRoots(&root_visitor); | 2452 MarkRoots(&root_visitor); |
| (...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4082 // The target is always in old space, we don't have to record the slot in | 4082 // The target is always in old space, we don't have to record the slot in |
| 4083 // the old-to-new remembered set. | 4083 // the old-to-new remembered set. |
| 4084 DCHECK(!heap()->InNewSpace(target)); | 4084 DCHECK(!heap()->InNewSpace(target)); |
| 4085 RecordRelocSlot(host, &rinfo, target); | 4085 RecordRelocSlot(host, &rinfo, target); |
| 4086 } | 4086 } |
| 4087 } | 4087 } |
| 4088 } | 4088 } |
| 4089 | 4089 |
| 4090 } // namespace internal | 4090 } // namespace internal |
| 4091 } // namespace v8 | 4091 } // namespace v8 |
| OLD | NEW |