| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 return result; | 56 return result; |
| 57 } | 57 } |
| 58 | 58 |
| 59 void Print(); | 59 void Print(); |
| 60 | 60 |
| 61 GCIdleTimeActionType type; | 61 GCIdleTimeActionType type; |
| 62 bool additional_work; | 62 bool additional_work; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 | 65 |
| 66 class GCTracer; | 66 class GCIdleTimeHeapState { |
| 67 public: |
| 68 void Print(); |
| 69 |
| 70 int contexts_disposed; |
| 71 double contexts_disposal_rate; |
| 72 size_t size_of_objects; |
| 73 bool incremental_marking_stopped; |
| 74 bool sweeping_in_progress; |
| 75 bool sweeping_completed; |
| 76 bool has_low_allocation_rate; |
| 77 size_t mark_compact_speed_in_bytes_per_ms; |
| 78 size_t incremental_marking_speed_in_bytes_per_ms; |
| 79 size_t final_incremental_mark_compact_speed_in_bytes_per_ms; |
| 80 size_t scavenge_speed_in_bytes_per_ms; |
| 81 size_t used_new_space_size; |
| 82 size_t new_space_capacity; |
| 83 size_t new_space_allocation_throughput_in_bytes_per_ms; |
| 84 }; |
| 85 |
| 67 | 86 |
| 68 // The idle time handler makes decisions about which garbage collection | 87 // The idle time handler makes decisions about which garbage collection |
| 69 // operations are executing during IdleNotification. | 88 // operations are executing during IdleNotification. |
| 70 class GCIdleTimeHandler { | 89 class GCIdleTimeHandler { |
| 71 public: | 90 public: |
| 72 // If we haven't recorded any incremental marking events yet, we carefully | 91 // If we haven't recorded any incremental marking events yet, we carefully |
| 73 // mark with a conservative lower bound for the marking speed. | 92 // mark with a conservative lower bound for the marking speed. |
| 74 static const size_t kInitialConservativeMarkingSpeed = 100 * KB; | 93 static const size_t kInitialConservativeMarkingSpeed = 100 * KB; |
| 75 | 94 |
| 76 // Maximum marking step size returned by EstimateMarkingStepSize. | 95 // Maximum marking step size returned by EstimateMarkingStepSize. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // Incremental marking step time. | 145 // Incremental marking step time. |
| 127 static const size_t kIncrementalMarkingStepTimeInMs = 1; | 146 static const size_t kIncrementalMarkingStepTimeInMs = 1; |
| 128 | 147 |
| 129 static const size_t kMinTimeForOverApproximatingWeakClosureInMs; | 148 static const size_t kMinTimeForOverApproximatingWeakClosureInMs; |
| 130 | 149 |
| 131 // Number of times we will return a Nothing action in the current mode | 150 // Number of times we will return a Nothing action in the current mode |
| 132 // despite having idle time available before we returning a Done action to | 151 // despite having idle time available before we returning a Done action to |
| 133 // ensure we don't keep scheduling idle tasks and making no progress. | 152 // ensure we don't keep scheduling idle tasks and making no progress. |
| 134 static const int kMaxNoProgressIdleTimes = 10; | 153 static const int kMaxNoProgressIdleTimes = 10; |
| 135 | 154 |
| 136 class HeapState { | |
| 137 public: | |
| 138 void Print(); | |
| 139 | |
| 140 int contexts_disposed; | |
| 141 double contexts_disposal_rate; | |
| 142 size_t size_of_objects; | |
| 143 bool incremental_marking_stopped; | |
| 144 bool sweeping_in_progress; | |
| 145 bool sweeping_completed; | |
| 146 bool has_low_allocation_rate; | |
| 147 size_t mark_compact_speed_in_bytes_per_ms; | |
| 148 size_t incremental_marking_speed_in_bytes_per_ms; | |
| 149 size_t final_incremental_mark_compact_speed_in_bytes_per_ms; | |
| 150 size_t scavenge_speed_in_bytes_per_ms; | |
| 151 size_t used_new_space_size; | |
| 152 size_t new_space_capacity; | |
| 153 size_t new_space_allocation_throughput_in_bytes_per_ms; | |
| 154 }; | |
| 155 | |
| 156 GCIdleTimeHandler() : idle_times_which_made_no_progress_(0) {} | 155 GCIdleTimeHandler() : idle_times_which_made_no_progress_(0) {} |
| 157 | 156 |
| 158 GCIdleTimeAction Compute(double idle_time_in_ms, HeapState heap_state); | 157 GCIdleTimeAction Compute(double idle_time_in_ms, |
| 158 GCIdleTimeHeapState heap_state); |
| 159 | 159 |
| 160 void ResetNoProgressCounter() { idle_times_which_made_no_progress_ = 0; } | 160 void ResetNoProgressCounter() { idle_times_which_made_no_progress_ = 0; } |
| 161 | 161 |
| 162 static size_t EstimateMarkingStepSize(size_t idle_time_in_ms, | 162 static size_t EstimateMarkingStepSize(size_t idle_time_in_ms, |
| 163 size_t marking_speed_in_bytes_per_ms); | 163 size_t marking_speed_in_bytes_per_ms); |
| 164 | 164 |
| 165 static size_t EstimateMarkCompactTime( | 165 static size_t EstimateMarkCompactTime( |
| 166 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms); | 166 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms); |
| 167 | 167 |
| 168 static size_t EstimateFinalIncrementalMarkCompactTime( | 168 static size_t EstimateFinalIncrementalMarkCompactTime( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 192 // Idle notifications with no progress. | 192 // Idle notifications with no progress. |
| 193 int idle_times_which_made_no_progress_; | 193 int idle_times_which_made_no_progress_; |
| 194 | 194 |
| 195 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); | 195 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 } // namespace internal | 198 } // namespace internal |
| 199 } // namespace v8 | 199 } // namespace v8 |
| 200 | 200 |
| 201 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ | 201 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ |
| OLD | NEW |