| 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" |
| 11 #include "src/heap/gc-tracer.h" | 11 #include "src/heap/gc-tracer.h" |
| 12 #include "src/heap/mark-compact-inl.h" | 12 #include "src/heap/mark-compact-inl.h" |
| 13 #include "src/heap/objects-visiting.h" | 13 #include "src/heap/objects-visiting.h" |
| 14 #include "src/heap/objects-visiting-inl.h" | 14 #include "src/heap/objects-visiting-inl.h" |
| 15 #include "src/tracing/trace-event.h" |
| 15 #include "src/v8.h" | 16 #include "src/v8.h" |
| 16 | 17 |
| 17 namespace v8 { | 18 namespace v8 { |
| 18 namespace internal { | 19 namespace internal { |
| 19 | 20 |
| 20 IncrementalMarking::StepActions IncrementalMarking::IdleStepActions() { | 21 IncrementalMarking::StepActions IncrementalMarking::IdleStepActions() { |
| 21 return StepActions(IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 22 return StepActions(IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 22 IncrementalMarking::FORCE_MARKING, | 23 IncrementalMarking::FORCE_MARKING, |
| 23 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | 24 IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
| 24 } | 25 } |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 PrintF("[IncrementalMarking] Start (%s)\n", | 528 PrintF("[IncrementalMarking] Start (%s)\n", |
| 528 (reason == nullptr) ? "unknown reason" : reason); | 529 (reason == nullptr) ? "unknown reason" : reason); |
| 529 } | 530 } |
| 530 DCHECK(FLAG_incremental_marking); | 531 DCHECK(FLAG_incremental_marking); |
| 531 DCHECK(state_ == STOPPED); | 532 DCHECK(state_ == STOPPED); |
| 532 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC); | 533 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC); |
| 533 DCHECK(!heap_->isolate()->serializer_enabled()); | 534 DCHECK(!heap_->isolate()->serializer_enabled()); |
| 534 | 535 |
| 535 HistogramTimerScope incremental_marking_scope( | 536 HistogramTimerScope incremental_marking_scope( |
| 536 heap_->isolate()->counters()->gc_incremental_marking_start()); | 537 heap_->isolate()->counters()->gc_incremental_marking_start()); |
| 538 TRACE_EVENT0("v8", "V8.GCIncrementalMarkingStart"); |
| 537 ResetStepCounters(); | 539 ResetStepCounters(); |
| 538 | 540 |
| 539 was_activated_ = true; | 541 was_activated_ = true; |
| 540 | 542 |
| 541 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { | 543 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { |
| 542 StartMarking(); | 544 StartMarking(); |
| 543 } else { | 545 } else { |
| 544 if (FLAG_trace_incremental_marking) { | 546 if (FLAG_trace_incremental_marking) { |
| 545 PrintF("[IncrementalMarking] Start sweeping.\n"); | 547 PrintF("[IncrementalMarking] Start sweeping.\n"); |
| 546 } | 548 } |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 heap_->RecentIdleNotificationHappened()) { | 1146 heap_->RecentIdleNotificationHappened()) { |
| 1145 return 0; | 1147 return 0; |
| 1146 } | 1148 } |
| 1147 | 1149 |
| 1148 if (state_ == MARKING && no_marking_scope_depth_ > 0) return 0; | 1150 if (state_ == MARKING && no_marking_scope_depth_ > 0) return 0; |
| 1149 | 1151 |
| 1150 intptr_t bytes_processed = 0; | 1152 intptr_t bytes_processed = 0; |
| 1151 { | 1153 { |
| 1152 HistogramTimerScope incremental_marking_scope( | 1154 HistogramTimerScope incremental_marking_scope( |
| 1153 heap_->isolate()->counters()->gc_incremental_marking()); | 1155 heap_->isolate()->counters()->gc_incremental_marking()); |
| 1156 TRACE_EVENT0("v8", "V8.GCIncrementalMarking"); |
| 1154 double start = heap_->MonotonicallyIncreasingTimeInMs(); | 1157 double start = heap_->MonotonicallyIncreasingTimeInMs(); |
| 1155 | 1158 |
| 1156 // The marking speed is driven either by the allocation rate or by the rate | 1159 // The marking speed is driven either by the allocation rate or by the rate |
| 1157 // at which we are having to check the color of objects in the write | 1160 // at which we are having to check the color of objects in the write |
| 1158 // barrier. | 1161 // barrier. |
| 1159 // It is possible for a tight non-allocating loop to run a lot of write | 1162 // It is possible for a tight non-allocating loop to run a lot of write |
| 1160 // barriers before we get here and check them (marking can only take place | 1163 // barriers before we get here and check them (marking can only take place |
| 1161 // on | 1164 // on |
| 1162 // allocation), so to reduce the lumpiness we don't use the write barriers | 1165 // allocation), so to reduce the lumpiness we don't use the write barriers |
| 1163 // invoked since last step directly to determine the amount of work to do. | 1166 // invoked since last step directly to determine the amount of work to do. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1241 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
| 1239 idle_marking_delay_counter_++; | 1242 idle_marking_delay_counter_++; |
| 1240 } | 1243 } |
| 1241 | 1244 |
| 1242 | 1245 |
| 1243 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1246 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
| 1244 idle_marking_delay_counter_ = 0; | 1247 idle_marking_delay_counter_ = 0; |
| 1245 } | 1248 } |
| 1246 } // namespace internal | 1249 } // namespace internal |
| 1247 } // namespace v8 | 1250 } // namespace v8 |
| OLD | NEW |