| 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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 } | 737 } |
| 738 // Compact the array and update the age. | 738 // Compact the array and update the age. |
| 739 if (new_age != age) { | 739 if (new_age != age) { |
| 740 retained_maps->Set(i + 1, Smi::FromInt(new_age)); | 740 retained_maps->Set(i + 1, Smi::FromInt(new_age)); |
| 741 } | 741 } |
| 742 } | 742 } |
| 743 } | 743 } |
| 744 | 744 |
| 745 | 745 |
| 746 void IncrementalMarking::FinalizeIncrementally() { | 746 void IncrementalMarking::FinalizeIncrementally() { |
| 747 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_INCREMENTAL_FINALIZE_BODY); |
| 747 DCHECK(!finalize_marking_completed_); | 748 DCHECK(!finalize_marking_completed_); |
| 748 DCHECK(IsMarking()); | 749 DCHECK(IsMarking()); |
| 749 | 750 |
| 750 double start = heap_->MonotonicallyIncreasingTimeInMs(); | 751 double start = heap_->MonotonicallyIncreasingTimeInMs(); |
| 751 | 752 |
| 752 int old_marking_deque_top = | 753 int old_marking_deque_top = |
| 753 heap_->mark_compact_collector()->marking_deque()->top(); | 754 heap_->mark_compact_collector()->marking_deque()->top(); |
| 754 | 755 |
| 755 // After finishing incremental marking, we try to discover all unmarked | 756 // After finishing incremental marking, we try to discover all unmarked |
| 756 // objects to reduce the marking load in the final pause. | 757 // objects to reduce the marking load in the final pause. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 770 } | 771 } |
| 771 ProcessWeakCells(); | 772 ProcessWeakCells(); |
| 772 | 773 |
| 773 int marking_progress = | 774 int marking_progress = |
| 774 abs(old_marking_deque_top - | 775 abs(old_marking_deque_top - |
| 775 heap_->mark_compact_collector()->marking_deque()->top()); | 776 heap_->mark_compact_collector()->marking_deque()->top()); |
| 776 | 777 |
| 777 double end = heap_->MonotonicallyIncreasingTimeInMs(); | 778 double end = heap_->MonotonicallyIncreasingTimeInMs(); |
| 778 double delta = end - start; | 779 double delta = end - start; |
| 779 heap_->tracer()->AddMarkingTime(delta); | 780 heap_->tracer()->AddMarkingTime(delta); |
| 780 heap_->tracer()->AddIncrementalMarkingFinalizationStep(delta); | |
| 781 if (FLAG_trace_incremental_marking) { | 781 if (FLAG_trace_incremental_marking) { |
| 782 PrintF( | 782 PrintF( |
| 783 "[IncrementalMarking] Finalize incrementally round %d, " | 783 "[IncrementalMarking] Finalize incrementally round %d, " |
| 784 "spent %d ms, marking progress %d.\n", | 784 "spent %d ms, marking progress %d.\n", |
| 785 static_cast<int>(delta), incremental_marking_finalization_rounds_, | 785 static_cast<int>(delta), incremental_marking_finalization_rounds_, |
| 786 marking_progress); | 786 marking_progress); |
| 787 } | 787 } |
| 788 | 788 |
| 789 ++incremental_marking_finalization_rounds_; | 789 ++incremental_marking_finalization_rounds_; |
| 790 if ((incremental_marking_finalization_rounds_ >= | 790 if ((incremental_marking_finalization_rounds_ >= |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 if (marking == DO_NOT_FORCE_MARKING && | 1174 if (marking == DO_NOT_FORCE_MARKING && |
| 1175 heap_->RecentIdleNotificationHappened()) { | 1175 heap_->RecentIdleNotificationHappened()) { |
| 1176 return 0; | 1176 return 0; |
| 1177 } | 1177 } |
| 1178 | 1178 |
| 1179 intptr_t bytes_processed = 0; | 1179 intptr_t bytes_processed = 0; |
| 1180 { | 1180 { |
| 1181 HistogramTimerScope incremental_marking_scope( | 1181 HistogramTimerScope incremental_marking_scope( |
| 1182 heap_->isolate()->counters()->gc_incremental_marking()); | 1182 heap_->isolate()->counters()->gc_incremental_marking()); |
| 1183 TRACE_EVENT0("v8", "V8.GCIncrementalMarking"); | 1183 TRACE_EVENT0("v8", "V8.GCIncrementalMarking"); |
| 1184 TRACE_GC(heap_->tracer(), GCTracer::Scope::MC_INCREMENTAL); |
| 1184 double start = heap_->MonotonicallyIncreasingTimeInMs(); | 1185 double start = heap_->MonotonicallyIncreasingTimeInMs(); |
| 1185 | 1186 |
| 1186 // The marking speed is driven either by the allocation rate or by the rate | 1187 // The marking speed is driven either by the allocation rate or by the rate |
| 1187 // at which we are having to check the color of objects in the write | 1188 // at which we are having to check the color of objects in the write |
| 1188 // barrier. | 1189 // barrier. |
| 1189 // It is possible for a tight non-allocating loop to run a lot of write | 1190 // It is possible for a tight non-allocating loop to run a lot of write |
| 1190 // barriers before we get here and check them (marking can only take place | 1191 // barriers before we get here and check them (marking can only take place |
| 1191 // on | 1192 // on |
| 1192 // allocation), so to reduce the lumpiness we don't use the write barriers | 1193 // allocation), so to reduce the lumpiness we don't use the write barriers |
| 1193 // invoked since last step directly to determine the amount of work to do. | 1194 // invoked since last step directly to determine the amount of work to do. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1279 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
| 1279 idle_marking_delay_counter_++; | 1280 idle_marking_delay_counter_++; |
| 1280 } | 1281 } |
| 1281 | 1282 |
| 1282 | 1283 |
| 1283 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1284 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
| 1284 idle_marking_delay_counter_ = 0; | 1285 idle_marking_delay_counter_ = 0; |
| 1285 } | 1286 } |
| 1286 } // namespace internal | 1287 } // namespace internal |
| 1287 } // namespace v8 | 1288 } // namespace v8 |
| OLD | NEW |