| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 static size_t EstimateMarkingStepSize(size_t idle_time_in_ms, | 155 static size_t EstimateMarkingStepSize(size_t idle_time_in_ms, |
| 156 size_t marking_speed_in_bytes_per_ms); | 156 size_t marking_speed_in_bytes_per_ms); |
| 157 | 157 |
| 158 static size_t EstimateMarkCompactTime( | 158 static size_t EstimateMarkCompactTime( |
| 159 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms); | 159 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms); |
| 160 | 160 |
| 161 static bool ShouldDoMarkCompact(size_t idle_time_in_ms, | 161 static bool ShouldDoMarkCompact(size_t idle_time_in_ms, |
| 162 size_t size_of_objects, | 162 size_t size_of_objects, |
| 163 size_t mark_compact_speed_in_bytes_per_ms); | 163 size_t mark_compact_speed_in_bytes_per_ms); |
| 164 | 164 |
| 165 static bool ShouldDoContextDisposalMarkCompact(bool context_disposed, |
| 166 double contexts_disposal_rate); |
| 167 |
| 165 static bool ShouldDoScavenge( | 168 static bool ShouldDoScavenge( |
| 166 size_t idle_time_in_ms, size_t new_space_size, size_t used_new_space_size, | 169 size_t idle_time_in_ms, size_t new_space_size, size_t used_new_space_size, |
| 167 size_t scavenger_speed_in_bytes_per_ms, | 170 size_t scavenger_speed_in_bytes_per_ms, |
| 168 size_t new_space_allocation_throughput_in_bytes_per_ms); | 171 size_t new_space_allocation_throughput_in_bytes_per_ms); |
| 169 | 172 |
| 170 private: | 173 private: |
| 171 void StartIdleRound() { mark_compacts_since_idle_round_started_ = 0; } | 174 void StartIdleRound() { mark_compacts_since_idle_round_started_ = 0; } |
| 172 bool IsMarkCompactIdleRoundFinished() { | 175 bool IsMarkCompactIdleRoundFinished() { |
| 173 return mark_compacts_since_idle_round_started_ == | 176 return mark_compacts_since_idle_round_started_ == |
| 174 kMaxMarkCompactsInIdleRound; | 177 kMaxMarkCompactsInIdleRound; |
| 175 } | 178 } |
| 176 bool EnoughGarbageSinceLastIdleRound() { | 179 bool EnoughGarbageSinceLastIdleRound() { |
| 177 return scavenges_since_last_idle_round_ >= kIdleScavengeThreshold; | 180 return scavenges_since_last_idle_round_ >= kIdleScavengeThreshold; |
| 178 } | 181 } |
| 179 | 182 |
| 180 int mark_compacts_since_idle_round_started_; | 183 int mark_compacts_since_idle_round_started_; |
| 181 int scavenges_since_last_idle_round_; | 184 int scavenges_since_last_idle_round_; |
| 182 | 185 |
| 183 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); | 186 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); |
| 184 }; | 187 }; |
| 185 | 188 |
| 186 } // namespace internal | 189 } // namespace internal |
| 187 } // namespace v8 | 190 } // namespace v8 |
| 188 | 191 |
| 189 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ | 192 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ |
| OLD | NEW |