OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef V8_HEAP_GC_IDLE_TIME_HANDLER_H_ | 5 #ifndef V8_HEAP_GC_IDLE_TIME_HANDLER_H_ |
6 #define V8_HEAP_GC_IDLE_TIME_HANDLER_H_ | 6 #define V8_HEAP_GC_IDLE_TIME_HANDLER_H_ |
7 | 7 |
8 #include "src/globals.h" | 8 #include "src/globals.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 148 } |
149 | 149 |
150 void NotifyScavenge() { ++scavenges_since_last_idle_round_; } | 150 void NotifyScavenge() { ++scavenges_since_last_idle_round_; } |
151 | 151 |
152 static size_t EstimateMarkingStepSize(size_t idle_time_in_ms, | 152 static size_t EstimateMarkingStepSize(size_t idle_time_in_ms, |
153 size_t marking_speed_in_bytes_per_ms); | 153 size_t marking_speed_in_bytes_per_ms); |
154 | 154 |
155 static size_t EstimateMarkCompactTime( | 155 static size_t EstimateMarkCompactTime( |
156 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms); | 156 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms); |
157 | 157 |
158 static bool DoScavenge( | 158 static bool ShouldDoMarkCompact(size_t idle_time_in_ms, |
| 159 size_t size_of_objects, |
| 160 size_t mark_compact_speed_in_bytes_per_ms); |
| 161 |
| 162 static bool ShouldDoScavenge( |
159 size_t idle_time_in_ms, size_t new_space_size, size_t used_new_space_size, | 163 size_t idle_time_in_ms, size_t new_space_size, size_t used_new_space_size, |
160 size_t scavenger_speed_in_bytes_per_ms, | 164 size_t scavenger_speed_in_bytes_per_ms, |
161 size_t new_space_allocation_throughput_in_bytes_per_ms); | 165 size_t new_space_allocation_throughput_in_bytes_per_ms); |
162 | 166 |
163 private: | 167 private: |
164 void StartIdleRound() { mark_compacts_since_idle_round_started_ = 0; } | 168 void StartIdleRound() { mark_compacts_since_idle_round_started_ = 0; } |
165 bool IsMarkCompactIdleRoundFinished() { | 169 bool IsMarkCompactIdleRoundFinished() { |
166 return mark_compacts_since_idle_round_started_ == | 170 return mark_compacts_since_idle_round_started_ == |
167 kMaxMarkCompactsInIdleRound; | 171 kMaxMarkCompactsInIdleRound; |
168 } | 172 } |
169 bool EnoughGarbageSinceLastIdleRound() { | 173 bool EnoughGarbageSinceLastIdleRound() { |
170 return scavenges_since_last_idle_round_ >= kIdleScavengeThreshold; | 174 return scavenges_since_last_idle_round_ >= kIdleScavengeThreshold; |
171 } | 175 } |
172 | 176 |
173 int mark_compacts_since_idle_round_started_; | 177 int mark_compacts_since_idle_round_started_; |
174 int scavenges_since_last_idle_round_; | 178 int scavenges_since_last_idle_round_; |
175 | 179 |
176 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); | 180 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); |
177 }; | 181 }; |
178 | 182 |
179 } // namespace internal | 183 } // namespace internal |
180 } // namespace v8 | 184 } // namespace v8 |
181 | 185 |
182 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ | 186 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ |
OLD | NEW |