| 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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 void IncrementalMarking::MarkRoots() { | 591 void IncrementalMarking::MarkRoots() { |
| 592 DCHECK(!finalize_marking_completed_); | 592 DCHECK(!finalize_marking_completed_); |
| 593 DCHECK(IsMarking()); | 593 DCHECK(IsMarking()); |
| 594 | 594 |
| 595 IncrementalMarkingRootMarkingVisitor visitor(this); | 595 IncrementalMarkingRootMarkingVisitor visitor(this); |
| 596 heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); | 596 heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); |
| 597 } | 597 } |
| 598 | 598 |
| 599 | 599 |
| 600 void IncrementalMarking::MarkObjectGroups() { | 600 void IncrementalMarking::MarkObjectGroups() { |
| 601 DCHECK(!heap_->UsingEmbedderHeapTracer()); |
| 601 DCHECK(!finalize_marking_completed_); | 602 DCHECK(!finalize_marking_completed_); |
| 602 DCHECK(IsMarking()); | 603 DCHECK(IsMarking()); |
| 603 | 604 |
| 604 IncrementalMarkingRootMarkingVisitor visitor(this); | 605 IncrementalMarkingRootMarkingVisitor visitor(this); |
| 605 heap_->mark_compact_collector()->MarkImplicitRefGroups(&MarkObject); | 606 heap_->mark_compact_collector()->MarkImplicitRefGroups(&MarkObject); |
| 606 heap_->isolate()->global_handles()->IterateObjectGroups( | 607 heap_->isolate()->global_handles()->IterateObjectGroups( |
| 607 &visitor, &MarkCompactCollector::IsUnmarkedHeapObjectWithHeap); | 608 &visitor, &MarkCompactCollector::IsUnmarkedHeapObjectWithHeap); |
| 608 heap_->isolate()->global_handles()->RemoveImplicitRefGroups(); | 609 heap_->isolate()->global_handles()->RemoveImplicitRefGroups(); |
| 609 heap_->isolate()->global_handles()->RemoveObjectGroups(); | 610 heap_->isolate()->global_handles()->RemoveObjectGroups(); |
| 610 } | 611 } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 heap_->mark_compact_collector()->marking_deque()->top(); | 722 heap_->mark_compact_collector()->marking_deque()->top(); |
| 722 | 723 |
| 723 // After finishing incremental marking, we try to discover all unmarked | 724 // After finishing incremental marking, we try to discover all unmarked |
| 724 // objects to reduce the marking load in the final pause. | 725 // objects to reduce the marking load in the final pause. |
| 725 // 1) We scan and mark the roots again to find all changes to the root set. | 726 // 1) We scan and mark the roots again to find all changes to the root set. |
| 726 // 2) We mark the object groups. | 727 // 2) We mark the object groups. |
| 727 // 3) Age and retain maps embedded in optimized code. | 728 // 3) Age and retain maps embedded in optimized code. |
| 728 // 4) Remove weak cell with live values from the list of weak cells, they | 729 // 4) Remove weak cell with live values from the list of weak cells, they |
| 729 // do not need processing during GC. | 730 // do not need processing during GC. |
| 730 MarkRoots(); | 731 MarkRoots(); |
| 731 MarkObjectGroups(); | 732 if (!heap_->UsingEmbedderHeapTracer()) { |
| 733 MarkObjectGroups(); |
| 734 } |
| 732 if (incremental_marking_finalization_rounds_ == 0) { | 735 if (incremental_marking_finalization_rounds_ == 0) { |
| 733 // Map retaining is needed for perfromance, not correctness, | 736 // Map retaining is needed for perfromance, not correctness, |
| 734 // so we can do it only once at the beginning of the finalization. | 737 // so we can do it only once at the beginning of the finalization. |
| 735 RetainMaps(); | 738 RetainMaps(); |
| 736 } | 739 } |
| 737 ProcessWeakCells(); | 740 ProcessWeakCells(); |
| 738 | 741 |
| 739 int marking_progress = | 742 int marking_progress = |
| 740 abs(old_marking_deque_top - | 743 abs(old_marking_deque_top - |
| 741 heap_->mark_compact_collector()->marking_deque()->top()); | 744 heap_->mark_compact_collector()->marking_deque()->top()); |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1243 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
| 1241 idle_marking_delay_counter_++; | 1244 idle_marking_delay_counter_++; |
| 1242 } | 1245 } |
| 1243 | 1246 |
| 1244 | 1247 |
| 1245 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1248 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
| 1246 idle_marking_delay_counter_ = 0; | 1249 idle_marking_delay_counter_ = 0; |
| 1247 } | 1250 } |
| 1248 } // namespace internal | 1251 } // namespace internal |
| 1249 } // namespace v8 | 1252 } // namespace v8 |
| OLD | NEW |