Chromium Code Reviews

Side by Side Diff: src/heap/gc-idle-time-handler.h

Issue 727323004: Distinguish beween final incremental mark-compact and full mark-compact event in IdleNotification. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | src/heap/gc-idle-time-handler.cc » ('j') | src/heap/gc-idle-time-handler.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 74 matching lines...)
85 static const size_t kMaximumMarkingStepSize = 700 * MB; 85 static const size_t kMaximumMarkingStepSize = 700 * MB;
86 86
87 // We have to make sure that we finish the IdleNotification before 87 // We have to make sure that we finish the IdleNotification before
88 // idle_time_in_ms. Hence, we conservatively prune our workload estimate. 88 // idle_time_in_ms. Hence, we conservatively prune our workload estimate.
89 static const double kConservativeTimeRatio; 89 static const double kConservativeTimeRatio;
90 90
91 // If we haven't recorded any mark-compact events yet, we use 91 // If we haven't recorded any mark-compact events yet, we use
92 // conservative lower bound for the mark-compact speed. 92 // conservative lower bound for the mark-compact speed.
93 static const size_t kInitialConservativeMarkCompactSpeed = 2 * MB; 93 static const size_t kInitialConservativeMarkCompactSpeed = 2 * MB;
94 94
95 // If we haven't recorded any final incremental mark-compact events yet, we
96 // use conservative lower bound for the mark-compact speed.
97 static const size_t kInitialConservativeFinalIncrementalMarkCompactSpeed =
98 2 * MB;
99
95 // Maximum mark-compact time returned by EstimateMarkCompactTime. 100 // Maximum mark-compact time returned by EstimateMarkCompactTime.
96 static const size_t kMaxMarkCompactTimeInMs; 101 static const size_t kMaxMarkCompactTimeInMs;
97 102
103 // Maximum final incremental mark-compact time returned by
104 // EstimateFinalIncrementalMarkCompactTime.
105 static const size_t kMaxFinalIncrementalMarkCompactTimeInMs;
106
98 // Minimum time to finalize sweeping phase. The main thread may wait for 107 // Minimum time to finalize sweeping phase. The main thread may wait for
99 // sweeper threads. 108 // sweeper threads.
100 static const size_t kMinTimeForFinalizeSweeping; 109 static const size_t kMinTimeForFinalizeSweeping;
101 110
102 // Number of idle mark-compact events, after which idle handler will finish 111 // Number of idle mark-compact events, after which idle handler will finish
103 // idle round. 112 // idle round.
104 static const int kMaxMarkCompactsInIdleRound; 113 static const int kMaxMarkCompactsInIdleRound;
105 114
106 // Number of scavenges that will trigger start of new idle round. 115 // Number of scavenges that will trigger start of new idle round.
107 static const int kIdleScavengeThreshold; 116 static const int kIdleScavengeThreshold;
(...skipping 13 matching lines...)
121 void Print(); 130 void Print();
122 131
123 int contexts_disposed; 132 int contexts_disposed;
124 double contexts_disposal_rate; 133 double contexts_disposal_rate;
125 size_t size_of_objects; 134 size_t size_of_objects;
126 bool incremental_marking_stopped; 135 bool incremental_marking_stopped;
127 bool can_start_incremental_marking; 136 bool can_start_incremental_marking;
128 bool sweeping_in_progress; 137 bool sweeping_in_progress;
129 size_t mark_compact_speed_in_bytes_per_ms; 138 size_t mark_compact_speed_in_bytes_per_ms;
130 size_t incremental_marking_speed_in_bytes_per_ms; 139 size_t incremental_marking_speed_in_bytes_per_ms;
140 size_t final_incremental_mark_compact_speed_in_bytes_per_ms;
131 size_t scavenge_speed_in_bytes_per_ms; 141 size_t scavenge_speed_in_bytes_per_ms;
132 size_t used_new_space_size; 142 size_t used_new_space_size;
133 size_t new_space_capacity; 143 size_t new_space_capacity;
134 size_t new_space_allocation_throughput_in_bytes_per_ms; 144 size_t new_space_allocation_throughput_in_bytes_per_ms;
135 }; 145 };
136 146
137 GCIdleTimeHandler() 147 GCIdleTimeHandler()
138 : mark_compacts_since_idle_round_started_(0), 148 : mark_compacts_since_idle_round_started_(0),
139 scavenges_since_last_idle_round_(0) {} 149 scavenges_since_last_idle_round_(0) {}
140 150
(...skipping 10 matching lines...)
151 } 161 }
152 162
153 void NotifyScavenge() { ++scavenges_since_last_idle_round_; } 163 void NotifyScavenge() { ++scavenges_since_last_idle_round_; }
154 164
155 static size_t EstimateMarkingStepSize(size_t idle_time_in_ms, 165 static size_t EstimateMarkingStepSize(size_t idle_time_in_ms,
156 size_t marking_speed_in_bytes_per_ms); 166 size_t marking_speed_in_bytes_per_ms);
157 167
158 static size_t EstimateMarkCompactTime( 168 static size_t EstimateMarkCompactTime(
159 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms); 169 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms);
160 170
171 static size_t EstimateFinalIncrementalMarkCompactTime(
172 size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms);
173
161 static bool ShouldDoMarkCompact(size_t idle_time_in_ms, 174 static bool ShouldDoMarkCompact(size_t idle_time_in_ms,
162 size_t size_of_objects, 175 size_t size_of_objects,
163 size_t mark_compact_speed_in_bytes_per_ms); 176 size_t mark_compact_speed_in_bytes_per_ms);
164 177
178 static bool ShouldDoFinalIncrementalMarkCompact(
179 size_t idle_time_in_ms, size_t size_of_objects,
180 size_t final_incremental_mark_compact_speed_in_bytes_per_ms);
181
165 static bool ShouldDoScavenge( 182 static bool ShouldDoScavenge(
166 size_t idle_time_in_ms, size_t new_space_size, size_t used_new_space_size, 183 size_t idle_time_in_ms, size_t new_space_size, size_t used_new_space_size,
167 size_t scavenger_speed_in_bytes_per_ms, 184 size_t scavenger_speed_in_bytes_per_ms,
168 size_t new_space_allocation_throughput_in_bytes_per_ms); 185 size_t new_space_allocation_throughput_in_bytes_per_ms);
169 186
170 private: 187 private:
171 void StartIdleRound() { mark_compacts_since_idle_round_started_ = 0; } 188 void StartIdleRound() { mark_compacts_since_idle_round_started_ = 0; }
172 bool IsMarkCompactIdleRoundFinished() { 189 bool IsMarkCompactIdleRoundFinished() {
173 return mark_compacts_since_idle_round_started_ == 190 return mark_compacts_since_idle_round_started_ ==
174 kMaxMarkCompactsInIdleRound; 191 kMaxMarkCompactsInIdleRound;
175 } 192 }
176 bool EnoughGarbageSinceLastIdleRound() { 193 bool EnoughGarbageSinceLastIdleRound() {
177 return scavenges_since_last_idle_round_ >= kIdleScavengeThreshold; 194 return scavenges_since_last_idle_round_ >= kIdleScavengeThreshold;
178 } 195 }
179 196
180 int mark_compacts_since_idle_round_started_; 197 int mark_compacts_since_idle_round_started_;
181 int scavenges_since_last_idle_round_; 198 int scavenges_since_last_idle_round_;
182 199
183 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); 200 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler);
184 }; 201 };
185 202
186 } // namespace internal 203 } // namespace internal
187 } // namespace v8 204 } // namespace v8
188 205
189 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ 206 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap/gc-idle-time-handler.cc » ('j') | src/heap/gc-idle-time-handler.cc » ('J')

Powered by Google App Engine