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/concurrent-marking.h" | 10 #include "src/heap/concurrent-marking.h" |
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 | 1095 |
1096 size_t step_size = Max(initial_old_generation_size_ / kTargetStepCount, | 1096 size_t step_size = Max(initial_old_generation_size_ / kTargetStepCount, |
1097 IncrementalMarking::kAllocatedThreshold); | 1097 IncrementalMarking::kAllocatedThreshold); |
1098 double time_passed_ms = | 1098 double time_passed_ms = |
1099 heap_->MonotonicallyIncreasingTimeInMs() - start_time_ms_; | 1099 heap_->MonotonicallyIncreasingTimeInMs() - start_time_ms_; |
1100 double factor = Min(time_passed_ms / kRampUpIntervalMs, 1.0); | 1100 double factor = Min(time_passed_ms / kRampUpIntervalMs, 1.0); |
1101 return static_cast<size_t>(factor * step_size); | 1101 return static_cast<size_t>(factor * step_size); |
1102 } | 1102 } |
1103 | 1103 |
1104 void IncrementalMarking::AdvanceIncrementalMarkingOnAllocation() { | 1104 void IncrementalMarking::AdvanceIncrementalMarkingOnAllocation() { |
| 1105 // Code using an AlwaysAllocateScope assumes that the GC state does not |
| 1106 // change; that implies that no marking steps must be performed. |
1105 if (heap_->gc_state() != Heap::NOT_IN_GC || !FLAG_incremental_marking || | 1107 if (heap_->gc_state() != Heap::NOT_IN_GC || !FLAG_incremental_marking || |
1106 (state_ != SWEEPING && state_ != MARKING)) { | 1108 (state_ != SWEEPING && state_ != MARKING) || heap_->always_allocate()) { |
1107 return; | 1109 return; |
1108 } | 1110 } |
1109 | 1111 |
1110 size_t bytes_to_process = | 1112 size_t bytes_to_process = |
1111 StepSizeToKeepUpWithAllocations() + StepSizeToMakeProgress(); | 1113 StepSizeToKeepUpWithAllocations() + StepSizeToMakeProgress(); |
1112 | 1114 |
1113 if (bytes_to_process >= IncrementalMarking::kAllocatedThreshold) { | 1115 if (bytes_to_process >= IncrementalMarking::kAllocatedThreshold) { |
1114 // The first step after Scavenge will see many allocated bytes. | 1116 // The first step after Scavenge will see many allocated bytes. |
1115 // Cap the step size to distribute the marking work more uniformly. | 1117 // Cap the step size to distribute the marking work more uniformly. |
1116 size_t max_step_size = GCIdleTimeHandler::EstimateMarkingStepSize( | 1118 size_t max_step_size = GCIdleTimeHandler::EstimateMarkingStepSize( |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 idle_marking_delay_counter_++; | 1201 idle_marking_delay_counter_++; |
1200 } | 1202 } |
1201 | 1203 |
1202 | 1204 |
1203 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1205 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1204 idle_marking_delay_counter_ = 0; | 1206 idle_marking_delay_counter_ = 0; |
1205 } | 1207 } |
1206 | 1208 |
1207 } // namespace internal | 1209 } // namespace internal |
1208 } // namespace v8 | 1210 } // namespace v8 |
OLD | NEW |