| 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 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 old_generation_allocation_counter_ = current_counter; | 1062 old_generation_allocation_counter_ = current_counter; |
| 1063 return bytes_allocated_; | 1063 return bytes_allocated_; |
| 1064 } | 1064 } |
| 1065 | 1065 |
| 1066 size_t IncrementalMarking::StepSizeToMakeProgress() { | 1066 size_t IncrementalMarking::StepSizeToMakeProgress() { |
| 1067 // We increase step size gradually based on the time passed in order to | 1067 // We increase step size gradually based on the time passed in order to |
| 1068 // leave marking work to standalone tasks. The ramp up duration and the | 1068 // leave marking work to standalone tasks. The ramp up duration and the |
| 1069 // target step count are chosen based on benchmarks. | 1069 // target step count are chosen based on benchmarks. |
| 1070 const int kRampUpIntervalMs = 300; | 1070 const int kRampUpIntervalMs = 300; |
| 1071 const size_t kTargetStepCount = 128; | 1071 const size_t kTargetStepCount = 128; |
| 1072 const size_t kTargetStepCountAtOOM = 16; |
| 1073 size_t oom_slack = heap()->new_space()->Capacity() + 64 * MB; |
| 1074 |
| 1075 if (heap()->IsCloseToOutOfMemory(oom_slack)) { |
| 1076 return heap()->PromotedSpaceSizeOfObjects() / kTargetStepCountAtOOM; |
| 1077 } |
| 1078 |
| 1072 size_t step_size = Max(initial_old_generation_size_ / kTargetStepCount, | 1079 size_t step_size = Max(initial_old_generation_size_ / kTargetStepCount, |
| 1073 IncrementalMarking::kAllocatedThreshold); | 1080 IncrementalMarking::kAllocatedThreshold); |
| 1074 double time_passed_ms = | 1081 double time_passed_ms = |
| 1075 heap_->MonotonicallyIncreasingTimeInMs() - start_time_ms_; | 1082 heap_->MonotonicallyIncreasingTimeInMs() - start_time_ms_; |
| 1076 double factor = Min(time_passed_ms / kRampUpIntervalMs, 1.0); | 1083 double factor = Min(time_passed_ms / kRampUpIntervalMs, 1.0); |
| 1077 return static_cast<size_t>(factor * step_size); | 1084 return static_cast<size_t>(factor * step_size); |
| 1078 } | 1085 } |
| 1079 | 1086 |
| 1080 void IncrementalMarking::AdvanceIncrementalMarkingOnAllocation() { | 1087 void IncrementalMarking::AdvanceIncrementalMarkingOnAllocation() { |
| 1081 if (heap_->gc_state() != Heap::NOT_IN_GC || !FLAG_incremental_marking || | 1088 if (heap_->gc_state() != Heap::NOT_IN_GC || !FLAG_incremental_marking || |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 idle_marking_delay_counter_++; | 1197 idle_marking_delay_counter_++; |
| 1191 } | 1198 } |
| 1192 | 1199 |
| 1193 | 1200 |
| 1194 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1201 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
| 1195 idle_marking_delay_counter_ = 0; | 1202 idle_marking_delay_counter_ = 0; |
| 1196 } | 1203 } |
| 1197 | 1204 |
| 1198 } // namespace internal | 1205 } // namespace internal |
| 1199 } // namespace v8 | 1206 } // namespace v8 |
| OLD | NEW |