| 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/incremental-marking.h" | 5 #include "src/heap/incremental-marking.h" |
| 6 | 6 |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/compilation-cache.h" | 8 #include "src/compilation-cache.h" |
| 9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
| 10 #include "src/heap/gc-idle-time-handler.h" | 10 #include "src/heap/gc-idle-time-handler.h" |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 void IncrementalMarking::MarkRoots() { | 589 void IncrementalMarking::MarkRoots() { |
| 590 DCHECK(!finalize_marking_completed_); | 590 DCHECK(!finalize_marking_completed_); |
| 591 DCHECK(IsMarking()); | 591 DCHECK(IsMarking()); |
| 592 | 592 |
| 593 IncrementalMarkingRootMarkingVisitor visitor(this); | 593 IncrementalMarkingRootMarkingVisitor visitor(this); |
| 594 heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); | 594 heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); |
| 595 } | 595 } |
| 596 | 596 |
| 597 | 597 |
| 598 void IncrementalMarking::MarkObjectGroups() { | 598 void IncrementalMarking::MarkObjectGroups() { |
| 599 DCHECK(!heap_->UsingEmbedderHeapTracer()); |
| 599 DCHECK(!finalize_marking_completed_); | 600 DCHECK(!finalize_marking_completed_); |
| 600 DCHECK(IsMarking()); | 601 DCHECK(IsMarking()); |
| 601 | 602 |
| 602 IncrementalMarkingRootMarkingVisitor visitor(this); | 603 IncrementalMarkingRootMarkingVisitor visitor(this); |
| 603 heap_->mark_compact_collector()->MarkImplicitRefGroups(&MarkObject); | 604 heap_->mark_compact_collector()->MarkImplicitRefGroups(&MarkObject); |
| 604 heap_->isolate()->global_handles()->IterateObjectGroups( | 605 heap_->isolate()->global_handles()->IterateObjectGroups( |
| 605 &visitor, &MarkCompactCollector::IsUnmarkedHeapObjectWithHeap); | 606 &visitor, &MarkCompactCollector::IsUnmarkedHeapObjectWithHeap); |
| 606 heap_->isolate()->global_handles()->RemoveImplicitRefGroups(); | 607 heap_->isolate()->global_handles()->RemoveImplicitRefGroups(); |
| 607 heap_->isolate()->global_handles()->RemoveObjectGroups(); | 608 heap_->isolate()->global_handles()->RemoveObjectGroups(); |
| 608 } | 609 } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 heap_->mark_compact_collector()->marking_deque()->top(); | 720 heap_->mark_compact_collector()->marking_deque()->top(); |
| 720 | 721 |
| 721 // After finishing incremental marking, we try to discover all unmarked | 722 // After finishing incremental marking, we try to discover all unmarked |
| 722 // objects to reduce the marking load in the final pause. | 723 // objects to reduce the marking load in the final pause. |
| 723 // 1) We scan and mark the roots again to find all changes to the root set. | 724 // 1) We scan and mark the roots again to find all changes to the root set. |
| 724 // 2) We mark the object groups. | 725 // 2) We mark the object groups. |
| 725 // 3) Age and retain maps embedded in optimized code. | 726 // 3) Age and retain maps embedded in optimized code. |
| 726 // 4) Remove weak cell with live values from the list of weak cells, they | 727 // 4) Remove weak cell with live values from the list of weak cells, they |
| 727 // do not need processing during GC. | 728 // do not need processing during GC. |
| 728 MarkRoots(); | 729 MarkRoots(); |
| 729 MarkObjectGroups(); | 730 if (!heap_->UsingEmbedderHeapTracer()) { |
| 731 MarkObjectGroups(); |
| 732 } |
| 730 if (incremental_marking_finalization_rounds_ == 0) { | 733 if (incremental_marking_finalization_rounds_ == 0) { |
| 731 // Map retaining is needed for perfromance, not correctness, | 734 // Map retaining is needed for perfromance, not correctness, |
| 732 // so we can do it only once at the beginning of the finalization. | 735 // so we can do it only once at the beginning of the finalization. |
| 733 RetainMaps(); | 736 RetainMaps(); |
| 734 } | 737 } |
| 735 ProcessWeakCells(); | 738 ProcessWeakCells(); |
| 736 | 739 |
| 737 int marking_progress = | 740 int marking_progress = |
| 738 abs(old_marking_deque_top - | 741 abs(old_marking_deque_top - |
| 739 heap_->mark_compact_collector()->marking_deque()->top()); | 742 heap_->mark_compact_collector()->marking_deque()->top()); |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1226 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
| 1224 idle_marking_delay_counter_++; | 1227 idle_marking_delay_counter_++; |
| 1225 } | 1228 } |
| 1226 | 1229 |
| 1227 | 1230 |
| 1228 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1231 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
| 1229 idle_marking_delay_counter_ = 0; | 1232 idle_marking_delay_counter_ = 0; |
| 1230 } | 1233 } |
| 1231 } // namespace internal | 1234 } // namespace internal |
| 1232 } // namespace v8 | 1235 } // namespace v8 |
| OLD | NEW |