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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // If we haven't recorded any scavenger events yet, we use a conservative | 128 // If we haven't recorded any scavenger events yet, we use a conservative |
129 // lower bound for the scavenger speed. | 129 // lower bound for the scavenger speed. |
130 static const size_t kInitialConservativeScavengeSpeed = 100 * KB; | 130 static const size_t kInitialConservativeScavengeSpeed = 100 * KB; |
131 | 131 |
132 // If contexts are disposed at a higher rate a full gc is triggered. | 132 // If contexts are disposed at a higher rate a full gc is triggered. |
133 static const double kHighContextDisposalRate; | 133 static const double kHighContextDisposalRate; |
134 | 134 |
135 // Incremental marking step time. | 135 // Incremental marking step time. |
136 static const size_t kIncrementalMarkingStepTimeInMs = 1; | 136 static const size_t kIncrementalMarkingStepTimeInMs = 1; |
137 | 137 |
| 138 static const size_t kMinTimeForOverApproximatingWeakClosureInMs; |
| 139 |
138 class HeapState { | 140 class HeapState { |
139 public: | 141 public: |
140 void Print(); | 142 void Print(); |
141 | 143 |
142 int contexts_disposed; | 144 int contexts_disposed; |
143 double contexts_disposal_rate; | 145 double contexts_disposal_rate; |
144 size_t size_of_objects; | 146 size_t size_of_objects; |
145 bool incremental_marking_stopped; | 147 bool incremental_marking_stopped; |
146 bool can_start_incremental_marking; | 148 bool can_start_incremental_marking; |
147 bool sweeping_in_progress; | 149 bool sweeping_in_progress; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 size_t size_of_objects, | 187 size_t size_of_objects, |
186 size_t mark_compact_speed_in_bytes_per_ms); | 188 size_t mark_compact_speed_in_bytes_per_ms); |
187 | 189 |
188 static bool ShouldDoContextDisposalMarkCompact(int context_disposed, | 190 static bool ShouldDoContextDisposalMarkCompact(int context_disposed, |
189 double contexts_disposal_rate); | 191 double contexts_disposal_rate); |
190 | 192 |
191 static bool ShouldDoFinalIncrementalMarkCompact( | 193 static bool ShouldDoFinalIncrementalMarkCompact( |
192 size_t idle_time_in_ms, size_t size_of_objects, | 194 size_t idle_time_in_ms, size_t size_of_objects, |
193 size_t final_incremental_mark_compact_speed_in_bytes_per_ms); | 195 size_t final_incremental_mark_compact_speed_in_bytes_per_ms); |
194 | 196 |
| 197 static bool ShouldDoOverApproximateWeakClosure(size_t idle_time_in_ms); |
| 198 |
195 static bool ShouldDoScavenge( | 199 static bool ShouldDoScavenge( |
196 size_t idle_time_in_ms, size_t new_space_size, size_t used_new_space_size, | 200 size_t idle_time_in_ms, size_t new_space_size, size_t used_new_space_size, |
197 size_t scavenger_speed_in_bytes_per_ms, | 201 size_t scavenger_speed_in_bytes_per_ms, |
198 size_t new_space_allocation_throughput_in_bytes_per_ms); | 202 size_t new_space_allocation_throughput_in_bytes_per_ms); |
199 | 203 |
200 private: | 204 private: |
201 void StartIdleRound() { mark_compacts_since_idle_round_started_ = 0; } | 205 void StartIdleRound() { mark_compacts_since_idle_round_started_ = 0; } |
202 bool IsMarkCompactIdleRoundFinished() { | 206 bool IsMarkCompactIdleRoundFinished() { |
203 return mark_compacts_since_idle_round_started_ == | 207 return mark_compacts_since_idle_round_started_ == |
204 kMaxMarkCompactsInIdleRound; | 208 kMaxMarkCompactsInIdleRound; |
205 } | 209 } |
206 bool EnoughGarbageSinceLastIdleRound() { | 210 bool EnoughGarbageSinceLastIdleRound() { |
207 return scavenges_since_last_idle_round_ >= kIdleScavengeThreshold; | 211 return scavenges_since_last_idle_round_ >= kIdleScavengeThreshold; |
208 } | 212 } |
209 | 213 |
210 int mark_compacts_since_idle_round_started_; | 214 int mark_compacts_since_idle_round_started_; |
211 int scavenges_since_last_idle_round_; | 215 int scavenges_since_last_idle_round_; |
212 | 216 |
213 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); | 217 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); |
214 }; | 218 }; |
215 | 219 |
216 } // namespace internal | 220 } // namespace internal |
217 } // namespace v8 | 221 } // namespace v8 |
218 | 222 |
219 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ | 223 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ |
OLD | NEW |