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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // Number of times we will return a Nothing action in the current mode | 118 // Number of times we will return a Nothing action in the current mode |
119 // despite having idle time available before we returning a Done action to | 119 // despite having idle time available before we returning a Done action to |
120 // ensure we don't keep scheduling idle tasks and making no progress. | 120 // ensure we don't keep scheduling idle tasks and making no progress. |
121 static const int kMaxNoProgressIdleTimes = 10; | 121 static const int kMaxNoProgressIdleTimes = 10; |
122 | 122 |
123 GCIdleTimeHandler() : idle_times_which_made_no_progress_(0) {} | 123 GCIdleTimeHandler() : idle_times_which_made_no_progress_(0) {} |
124 | 124 |
125 GCIdleTimeAction Compute(double idle_time_in_ms, | 125 GCIdleTimeAction Compute(double idle_time_in_ms, |
126 GCIdleTimeHeapState heap_state); | 126 GCIdleTimeHeapState heap_state); |
127 | 127 |
| 128 bool Enabled(); |
| 129 |
128 void ResetNoProgressCounter() { idle_times_which_made_no_progress_ = 0; } | 130 void ResetNoProgressCounter() { idle_times_which_made_no_progress_ = 0; } |
129 | 131 |
130 static size_t EstimateMarkingStepSize(double idle_time_in_ms, | 132 static size_t EstimateMarkingStepSize(double idle_time_in_ms, |
131 double marking_speed_in_bytes_per_ms); | 133 double marking_speed_in_bytes_per_ms); |
132 | 134 |
133 static double EstimateFinalIncrementalMarkCompactTime( | 135 static double EstimateFinalIncrementalMarkCompactTime( |
134 size_t size_of_objects, double mark_compact_speed_in_bytes_per_ms); | 136 size_t size_of_objects, double mark_compact_speed_in_bytes_per_ms); |
135 | 137 |
136 static bool ShouldDoContextDisposalMarkCompact(int context_disposed, | 138 static bool ShouldDoContextDisposalMarkCompact(int context_disposed, |
137 double contexts_disposal_rate); | 139 double contexts_disposal_rate); |
138 | 140 |
139 static bool ShouldDoFinalIncrementalMarkCompact( | 141 static bool ShouldDoFinalIncrementalMarkCompact( |
140 double idle_time_in_ms, size_t size_of_objects, | 142 double idle_time_in_ms, size_t size_of_objects, |
141 double final_incremental_mark_compact_speed_in_bytes_per_ms); | 143 double final_incremental_mark_compact_speed_in_bytes_per_ms); |
142 | 144 |
143 static bool ShouldDoOverApproximateWeakClosure(double idle_time_in_ms); | 145 static bool ShouldDoOverApproximateWeakClosure(double idle_time_in_ms); |
144 | 146 |
| 147 |
145 private: | 148 private: |
146 GCIdleTimeAction NothingOrDone(double idle_time_in_ms); | 149 GCIdleTimeAction NothingOrDone(double idle_time_in_ms); |
147 | 150 |
148 // Idle notifications with no progress. | 151 // Idle notifications with no progress. |
149 int idle_times_which_made_no_progress_; | 152 int idle_times_which_made_no_progress_; |
150 | 153 |
151 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); | 154 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); |
152 }; | 155 }; |
153 | 156 |
154 } // namespace internal | 157 } // namespace internal |
155 } // namespace v8 | 158 } // namespace v8 |
156 | 159 |
157 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ | 160 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ |
OLD | NEW |