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 { |
11 namespace internal { | 11 namespace internal { |
12 | 12 |
13 enum GCIdleTimeActionType { | 13 enum GCIdleTimeActionType { |
14 DONE, | 14 DONE, |
15 DO_NOTHING, | 15 DO_NOTHING, |
16 DO_INCREMENTAL_MARKING, | 16 DO_INCREMENTAL_MARKING, |
17 DO_SCAVENGE, | 17 DO_SCAVENGE, |
18 DO_FULL_GC, | 18 DO_FULL_GC, |
19 DO_FULL_GC_COMPACT, | |
19 DO_FINALIZE_SWEEPING | 20 DO_FINALIZE_SWEEPING |
20 }; | 21 }; |
21 | 22 |
22 | 23 |
23 class GCIdleTimeAction { | 24 class GCIdleTimeAction { |
24 public: | 25 public: |
25 static GCIdleTimeAction Done() { | 26 static GCIdleTimeAction Done() { |
26 GCIdleTimeAction result; | 27 GCIdleTimeAction result; |
27 result.type = DONE; | 28 result.type = DONE; |
28 result.parameter = 0; | 29 result.parameter = 0; |
(...skipping 26 matching lines...) Expand all Loading... | |
55 } | 56 } |
56 | 57 |
57 static GCIdleTimeAction FullGC() { | 58 static GCIdleTimeAction FullGC() { |
58 GCIdleTimeAction result; | 59 GCIdleTimeAction result; |
59 result.type = DO_FULL_GC; | 60 result.type = DO_FULL_GC; |
60 result.parameter = 0; | 61 result.parameter = 0; |
61 result.additional_work = false; | 62 result.additional_work = false; |
62 return result; | 63 return result; |
63 } | 64 } |
64 | 65 |
66 static GCIdleTimeAction FullGCCompact() { | |
67 GCIdleTimeAction result; | |
68 result.type = DO_FULL_GC_COMPACT; | |
69 result.parameter = 0; | |
70 result.additional_work = false; | |
71 return result; | |
72 } | |
73 | |
65 static GCIdleTimeAction FinalizeSweeping() { | 74 static GCIdleTimeAction FinalizeSweeping() { |
66 GCIdleTimeAction result; | 75 GCIdleTimeAction result; |
67 result.type = DO_FINALIZE_SWEEPING; | 76 result.type = DO_FINALIZE_SWEEPING; |
68 result.parameter = 0; | 77 result.parameter = 0; |
69 result.additional_work = false; | 78 result.additional_work = false; |
70 return result; | 79 return result; |
71 } | 80 } |
72 | 81 |
73 void Print(); | 82 void Print(); |
74 | 83 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 // idle round. | 124 // idle round. |
116 static const int kMaxMarkCompactsInIdleRound; | 125 static const int kMaxMarkCompactsInIdleRound; |
117 | 126 |
118 // Number of scavenges that will trigger start of new idle round. | 127 // Number of scavenges that will trigger start of new idle round. |
119 static const int kIdleScavengeThreshold; | 128 static const int kIdleScavengeThreshold; |
120 | 129 |
121 // This is the maximum scheduled idle time. Note that it can be more than | 130 // This is the maximum scheduled idle time. Note that it can be more than |
122 // 16 ms when there is currently no rendering going on. | 131 // 16 ms when there is currently no rendering going on. |
123 static const size_t kMaxScheduledIdleTime = 50; | 132 static const size_t kMaxScheduledIdleTime = 50; |
124 | 133 |
134 // This is the minimum time needed to trigger a full garbage collection which | |
135 // tries to reduce memory footprint. | |
136 static const size_t kMinTimeForReduceMemory = 600; | |
rmcilroy
2015/04/10 11:14:35
I'm guessing you are relying on the 1000ms IdleHan
Hannes Payer (out of office)
2015/04/10 13:06:57
Yes, exactly.
| |
137 | |
125 // We conservatively assume that in the next kTimeUntilNextIdleEvent ms | 138 // We conservatively assume that in the next kTimeUntilNextIdleEvent ms |
126 // no idle notification happens. | 139 // no idle notification happens. |
127 static const size_t kTimeUntilNextIdleEvent = 100; | 140 static const size_t kTimeUntilNextIdleEvent = 100; |
128 | 141 |
129 // If we haven't recorded any scavenger events yet, we use a conservative | 142 // If we haven't recorded any scavenger events yet, we use a conservative |
130 // lower bound for the scavenger speed. | 143 // lower bound for the scavenger speed. |
131 static const size_t kInitialConservativeScavengeSpeed = 100 * KB; | 144 static const size_t kInitialConservativeScavengeSpeed = 100 * KB; |
132 | 145 |
133 // If contexts are disposed at a higher rate a full gc is triggered. | 146 // If contexts are disposed at a higher rate a full gc is triggered. |
134 static const double kHighContextDisposalRate; | 147 static const double kHighContextDisposalRate; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 static size_t EstimateMarkCompactTime( | 201 static size_t EstimateMarkCompactTime( |
189 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms); | 202 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms); |
190 | 203 |
191 static size_t EstimateFinalIncrementalMarkCompactTime( | 204 static size_t EstimateFinalIncrementalMarkCompactTime( |
192 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms); | 205 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms); |
193 | 206 |
194 static bool ShouldDoMarkCompact(size_t idle_time_in_ms, | 207 static bool ShouldDoMarkCompact(size_t idle_time_in_ms, |
195 size_t size_of_objects, | 208 size_t size_of_objects, |
196 size_t mark_compact_speed_in_bytes_per_ms); | 209 size_t mark_compact_speed_in_bytes_per_ms); |
197 | 210 |
211 static bool ShouldDoReduceMemoryMarkCompact(size_t idle_time_in_ms); | |
212 | |
198 static bool ShouldDoContextDisposalMarkCompact(int context_disposed, | 213 static bool ShouldDoContextDisposalMarkCompact(int context_disposed, |
199 double contexts_disposal_rate); | 214 double contexts_disposal_rate); |
200 | 215 |
201 static bool ShouldDoFinalIncrementalMarkCompact( | 216 static bool ShouldDoFinalIncrementalMarkCompact( |
202 size_t idle_time_in_ms, size_t size_of_objects, | 217 size_t idle_time_in_ms, size_t size_of_objects, |
203 size_t final_incremental_mark_compact_speed_in_bytes_per_ms); | 218 size_t final_incremental_mark_compact_speed_in_bytes_per_ms); |
204 | 219 |
205 static bool ShouldDoOverApproximateWeakClosure(size_t idle_time_in_ms); | 220 static bool ShouldDoOverApproximateWeakClosure(size_t idle_time_in_ms); |
206 | 221 |
207 static bool ShouldDoScavenge( | 222 static bool ShouldDoScavenge( |
(...skipping 20 matching lines...) Expand all Loading... | |
228 int scavenges_since_last_idle_round_; | 243 int scavenges_since_last_idle_round_; |
229 int idle_times_which_made_no_progress_since_last_idle_round_; | 244 int idle_times_which_made_no_progress_since_last_idle_round_; |
230 | 245 |
231 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); | 246 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); |
232 }; | 247 }; |
233 | 248 |
234 } // namespace internal | 249 } // namespace internal |
235 } // namespace v8 | 250 } // namespace v8 |
236 | 251 |
237 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ | 252 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ |
OLD | NEW |