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 DoMarkCompact(size_t idle_time_in_ms, size_t size_of_objects, | |
Erik Corry Chromium.org
2014/10/06 14:56:47
I would prefer "ShouldDoMarkCompact" to make it cl
Hannes Payer (out of office)
2014/10/07 13:41:11
Done.
| |
159 size_t mark_compact_speed_in_bytes_per_ms); | |
160 | |
158 static bool DoScavenge( | 161 static bool DoScavenge( |
159 size_t idle_time_in_ms, size_t new_space_size, size_t used_new_space_size, | 162 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, | 163 size_t scavenger_speed_in_bytes_per_ms, |
161 size_t new_space_allocation_throughput_in_bytes_per_ms); | 164 size_t new_space_allocation_throughput_in_bytes_per_ms); |
162 | 165 |
163 private: | 166 private: |
164 void StartIdleRound() { mark_compacts_since_idle_round_started_ = 0; } | 167 void StartIdleRound() { mark_compacts_since_idle_round_started_ = 0; } |
165 bool IsMarkCompactIdleRoundFinished() { | 168 bool IsMarkCompactIdleRoundFinished() { |
166 return mark_compacts_since_idle_round_started_ == | 169 return mark_compacts_since_idle_round_started_ == |
167 kMaxMarkCompactsInIdleRound; | 170 kMaxMarkCompactsInIdleRound; |
168 } | 171 } |
169 bool EnoughGarbageSinceLastIdleRound() { | 172 bool EnoughGarbageSinceLastIdleRound() { |
170 return scavenges_since_last_idle_round_ >= kIdleScavengeThreshold; | 173 return scavenges_since_last_idle_round_ >= kIdleScavengeThreshold; |
171 } | 174 } |
172 | 175 |
173 int mark_compacts_since_idle_round_started_; | 176 int mark_compacts_since_idle_round_started_; |
174 int scavenges_since_last_idle_round_; | 177 int scavenges_since_last_idle_round_; |
175 | 178 |
176 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); | 179 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); |
177 }; | 180 }; |
178 | 181 |
179 } // namespace internal | 182 } // namespace internal |
180 } // namespace v8 | 183 } // namespace v8 |
181 | 184 |
182 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ | 185 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ |
OLD | NEW |