Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(781)

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

Issue 765743002: Re-land: Distinguish beween final incremental mark-compact and full mark-compact event in IdleNotif… (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. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/heap/gc-idle-time-handler.cc » ('j') | no next file with comments »
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...) Expand 10 before | Expand all | Expand 10 after
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...) Expand all
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...) Expand all
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
165 static bool ShouldDoContextDisposalMarkCompact(bool context_disposed, 178 static bool ShouldDoContextDisposalMarkCompact(bool context_disposed,
166 double contexts_disposal_rate); 179 double contexts_disposal_rate);
167 180
181 static bool ShouldDoFinalIncrementalMarkCompact(
182 size_t idle_time_in_ms, size_t size_of_objects,
183 size_t final_incremental_mark_compact_speed_in_bytes_per_ms);
184
168 static bool ShouldDoScavenge( 185 static bool ShouldDoScavenge(
169 size_t idle_time_in_ms, size_t new_space_size, size_t used_new_space_size, 186 size_t idle_time_in_ms, size_t new_space_size, size_t used_new_space_size,
170 size_t scavenger_speed_in_bytes_per_ms, 187 size_t scavenger_speed_in_bytes_per_ms,
171 size_t new_space_allocation_throughput_in_bytes_per_ms); 188 size_t new_space_allocation_throughput_in_bytes_per_ms);
172 189
173 private: 190 private:
174 void StartIdleRound() { mark_compacts_since_idle_round_started_ = 0; } 191 void StartIdleRound() { mark_compacts_since_idle_round_started_ = 0; }
175 bool IsMarkCompactIdleRoundFinished() { 192 bool IsMarkCompactIdleRoundFinished() {
176 return mark_compacts_since_idle_round_started_ == 193 return mark_compacts_since_idle_round_started_ ==
177 kMaxMarkCompactsInIdleRound; 194 kMaxMarkCompactsInIdleRound;
178 } 195 }
179 bool EnoughGarbageSinceLastIdleRound() { 196 bool EnoughGarbageSinceLastIdleRound() {
180 return scavenges_since_last_idle_round_ >= kIdleScavengeThreshold; 197 return scavenges_since_last_idle_round_ >= kIdleScavengeThreshold;
181 } 198 }
182 199
183 int mark_compacts_since_idle_round_started_; 200 int mark_compacts_since_idle_round_started_;
184 int scavenges_since_last_idle_round_; 201 int scavenges_since_last_idle_round_;
185 202
186 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); 203 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler);
187 }; 204 };
188 205
189 } // namespace internal 206 } // namespace internal
190 } // namespace v8 207 } // namespace v8
191 208
192 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ 209 #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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698