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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // conservative lower bound for the mark-compact speed. | 82 // conservative lower bound for the mark-compact speed. |
83 static const size_t kInitialConservativeMarkCompactSpeed = 2 * MB; | 83 static const size_t kInitialConservativeMarkCompactSpeed = 2 * MB; |
84 | 84 |
85 // Maximum mark-compact time returned by EstimateMarkCompactTime. | 85 // Maximum mark-compact time returned by EstimateMarkCompactTime. |
86 static const size_t kMaxMarkCompactTimeInMs; | 86 static const size_t kMaxMarkCompactTimeInMs; |
87 | 87 |
88 // Minimum time to finalize sweeping phase. The main thread may wait for | 88 // Minimum time to finalize sweeping phase. The main thread may wait for |
89 // sweeper threads. | 89 // sweeper threads. |
90 static const size_t kMinTimeForFinalizeSweeping; | 90 static const size_t kMinTimeForFinalizeSweeping; |
91 | 91 |
| 92 // Number of idle mark-compact events, after which idle handler will finish |
| 93 // idle round. |
| 94 static const int kMaxMarkCompactsInIdleRound; |
| 95 |
| 96 // Number of scavenges that will trigger start of new idle round. |
| 97 static const int kIdleScavengeThreshold; |
| 98 |
92 struct HeapState { | 99 struct HeapState { |
93 int contexts_disposed; | 100 int contexts_disposed; |
94 size_t size_of_objects; | 101 size_t size_of_objects; |
95 bool incremental_marking_stopped; | 102 bool incremental_marking_stopped; |
96 bool can_start_incremental_marking; | 103 bool can_start_incremental_marking; |
97 bool sweeping_in_progress; | 104 bool sweeping_in_progress; |
98 size_t mark_compact_speed_in_bytes_per_ms; | 105 size_t mark_compact_speed_in_bytes_per_ms; |
99 size_t incremental_marking_speed_in_bytes_per_ms; | 106 size_t incremental_marking_speed_in_bytes_per_ms; |
100 }; | 107 }; |
101 | 108 |
(...skipping 24 matching lines...) Expand all Loading... |
126 private: | 133 private: |
127 void StartIdleRound() { mark_compacts_since_idle_round_started_ = 0; } | 134 void StartIdleRound() { mark_compacts_since_idle_round_started_ = 0; } |
128 bool IsIdleRoundFinished() { | 135 bool IsIdleRoundFinished() { |
129 return mark_compacts_since_idle_round_started_ == | 136 return mark_compacts_since_idle_round_started_ == |
130 kMaxMarkCompactsInIdleRound; | 137 kMaxMarkCompactsInIdleRound; |
131 } | 138 } |
132 bool EnoughGarbageSinceLastIdleRound() { | 139 bool EnoughGarbageSinceLastIdleRound() { |
133 return scavenges_since_last_idle_round_ >= kIdleScavengeThreshold; | 140 return scavenges_since_last_idle_round_ >= kIdleScavengeThreshold; |
134 } | 141 } |
135 | 142 |
136 static const int kMaxMarkCompactsInIdleRound = 7; | |
137 static const int kIdleScavengeThreshold = 5; | |
138 int mark_compacts_since_idle_round_started_; | 143 int mark_compacts_since_idle_round_started_; |
139 int scavenges_since_last_idle_round_; | 144 int scavenges_since_last_idle_round_; |
140 | 145 |
141 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); | 146 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); |
142 }; | 147 }; |
143 | 148 |
144 } // namespace internal | 149 } // namespace internal |
145 } // namespace v8 | 150 } // namespace v8 |
146 | 151 |
147 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ | 152 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ |
OLD | NEW |