| 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 if (FLAG_cleanup_code_caches_at_gc) { | 561 if (FLAG_cleanup_code_caches_at_gc) { |
| 562 // We will mark cache black with a separate pass | 562 // We will mark cache black with a separate pass |
| 563 // when we finish marking. | 563 // when we finish marking. |
| 564 MarkObjectGreyDoNotEnqueue(heap_->polymorphic_code_cache()); | 564 MarkObjectGreyDoNotEnqueue(heap_->polymorphic_code_cache()); |
| 565 } | 565 } |
| 566 | 566 |
| 567 // Mark strong roots grey. | 567 // Mark strong roots grey. |
| 568 IncrementalMarkingRootMarkingVisitor visitor(this); | 568 IncrementalMarkingRootMarkingVisitor visitor(this); |
| 569 heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); | 569 heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); |
| 570 | 570 |
| 571 if (FLAG_black_allocation && !heap()->ShouldReduceMemory()) { | |
| 572 StartBlackAllocation(); | |
| 573 } | |
| 574 | |
| 575 // Ready to start incremental marking. | 571 // Ready to start incremental marking. |
| 576 if (FLAG_trace_incremental_marking) { | 572 if (FLAG_trace_incremental_marking) { |
| 577 PrintF("[IncrementalMarking] Running\n"); | 573 PrintF("[IncrementalMarking] Running\n"); |
| 578 } | 574 } |
| 579 } | 575 } |
| 580 | 576 |
| 581 void IncrementalMarking::StartBlackAllocation() { | 577 void IncrementalMarking::StartBlackAllocation() { |
| 582 DCHECK(FLAG_black_allocation); | 578 DCHECK(FLAG_black_allocation); |
| 583 DCHECK(IsMarking()); | 579 DCHECK(IsMarking()); |
| 584 black_allocation_ = true; | 580 black_allocation_ = true; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 static_cast<int>(delta), incremental_marking_finalization_rounds_, | 758 static_cast<int>(delta), incremental_marking_finalization_rounds_, |
| 763 marking_progress); | 759 marking_progress); |
| 764 } | 760 } |
| 765 | 761 |
| 766 ++incremental_marking_finalization_rounds_; | 762 ++incremental_marking_finalization_rounds_; |
| 767 if ((incremental_marking_finalization_rounds_ >= | 763 if ((incremental_marking_finalization_rounds_ >= |
| 768 FLAG_max_incremental_marking_finalization_rounds) || | 764 FLAG_max_incremental_marking_finalization_rounds) || |
| 769 (marking_progress < | 765 (marking_progress < |
| 770 FLAG_min_progress_during_incremental_marking_finalization)) { | 766 FLAG_min_progress_during_incremental_marking_finalization)) { |
| 771 finalize_marking_completed_ = true; | 767 finalize_marking_completed_ = true; |
| 768 } |
| 772 | 769 |
| 773 // If black allocation was not enabled earlier, start black allocation | 770 if (FLAG_black_allocation && !heap()->ShouldReduceMemory() && |
| 774 // here. | 771 !black_allocation_) { |
| 775 if (FLAG_black_allocation && !black_allocation_) { | 772 // TODO(hpayer): Move to an earlier point as soon as we make faster marking |
| 776 StartBlackAllocation(); | 773 // progress. |
| 777 } | 774 StartBlackAllocation(); |
| 778 } | 775 } |
| 779 } | 776 } |
| 780 | 777 |
| 781 | 778 |
| 782 void IncrementalMarking::UpdateMarkingDequeAfterScavenge() { | 779 void IncrementalMarking::UpdateMarkingDequeAfterScavenge() { |
| 783 if (!IsMarking()) return; | 780 if (!IsMarking()) return; |
| 784 | 781 |
| 785 MarkingDeque* marking_deque = | 782 MarkingDeque* marking_deque = |
| 786 heap_->mark_compact_collector()->marking_deque(); | 783 heap_->mark_compact_collector()->marking_deque(); |
| 787 int current = marking_deque->bottom(); | 784 int current = marking_deque->bottom(); |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1249 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
| 1253 idle_marking_delay_counter_++; | 1250 idle_marking_delay_counter_++; |
| 1254 } | 1251 } |
| 1255 | 1252 |
| 1256 | 1253 |
| 1257 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1254 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
| 1258 idle_marking_delay_counter_ = 0; | 1255 idle_marking_delay_counter_ = 0; |
| 1259 } | 1256 } |
| 1260 } // namespace internal | 1257 } // namespace internal |
| 1261 } // namespace v8 | 1258 } // namespace v8 |
| OLD | NEW |