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 #include <limits> | 5 #include <limits> |
6 | 6 |
7 #include "src/flags.h" | 7 #include "src/flags.h" |
8 #include "src/heap/memory-reducer.h" | 8 #include "src/heap/memory-reducer.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 MemoryReducer::State DoneState() { | 14 MemoryReducer::State DoneState() { |
15 return MemoryReducer::State(MemoryReducer::kDone, 0, 0.0); | 15 return MemoryReducer::State(MemoryReducer::kDone, 0, 0.0, 1.0); |
16 } | 16 } |
17 | 17 |
18 | 18 |
19 MemoryReducer::State WaitState(int started_gcs, double next_gc_start_ms) { | 19 MemoryReducer::State WaitState(int started_gcs, double next_gc_start_ms) { |
20 return MemoryReducer::State(MemoryReducer::kWait, started_gcs, | 20 return MemoryReducer::State(MemoryReducer::kWait, started_gcs, |
21 next_gc_start_ms); | 21 next_gc_start_ms, 1.0); |
22 } | 22 } |
23 | 23 |
24 | 24 |
25 MemoryReducer::State RunState(int started_gcs, double next_gc_start_ms) { | 25 MemoryReducer::State RunState(int started_gcs, double next_gc_start_ms) { |
26 return MemoryReducer::State(MemoryReducer::kRun, started_gcs, | 26 return MemoryReducer::State(MemoryReducer::kRun, started_gcs, |
27 next_gc_start_ms); | 27 next_gc_start_ms, 1.0); |
28 } | 28 } |
29 | 29 |
30 | 30 |
31 MemoryReducer::Event MarkCompactEvent(double time_ms, | 31 MemoryReducer::Event MarkCompactEvent(double time_ms, |
32 bool next_gc_likely_to_collect_more) { | 32 bool next_gc_likely_to_collect_more) { |
33 MemoryReducer::Event event; | 33 MemoryReducer::Event event; |
34 event.type = MemoryReducer::kMarkCompact; | 34 event.type = MemoryReducer::kMarkCompact; |
35 event.time_ms = time_ms; | 35 event.time_ms = time_ms; |
36 event.next_gc_likely_to_collect_more = next_gc_likely_to_collect_more; | 36 event.next_gc_likely_to_collect_more = next_gc_likely_to_collect_more; |
37 return event; | 37 return event; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 state1 = MemoryReducer::Step(state0, BackgroundIdleNotificationEvent(0)); | 107 state1 = MemoryReducer::Step(state0, BackgroundIdleNotificationEvent(0)); |
108 EXPECT_EQ(MemoryReducer::kDone, state1.action); | 108 EXPECT_EQ(MemoryReducer::kDone, state1.action); |
109 } | 109 } |
110 | 110 |
111 | 111 |
112 TEST(MemoryReducer, FromDoneToWait) { | 112 TEST(MemoryReducer, FromDoneToWait) { |
113 if (!FLAG_incremental_marking) return; | 113 if (!FLAG_incremental_marking) return; |
114 | 114 |
115 MemoryReducer::State state0(DoneState()), state1(DoneState()); | 115 MemoryReducer::State state0(DoneState()), state1(DoneState()); |
116 | 116 |
117 state1 = MemoryReducer::Step(state0, MarkCompactEventGarbageLeft(0)); | 117 state1 = MemoryReducer::Step(state0, MarkCompactEventGarbageLeft(2)); |
118 EXPECT_EQ(MemoryReducer::kWait, state1.action); | 118 EXPECT_EQ(MemoryReducer::kWait, state1.action); |
119 EXPECT_EQ(MemoryReducer::kLongDelayMs, state1.next_gc_start_ms); | 119 EXPECT_EQ(MemoryReducer::kLongDelayMs + 2, state1.next_gc_start_ms); |
120 EXPECT_EQ(0, state1.started_gcs); | 120 EXPECT_EQ(0, state1.started_gcs); |
| 121 EXPECT_EQ(2, state1.last_gc_time_ms); |
121 | 122 |
122 state1 = MemoryReducer::Step(state0, MarkCompactEventNoGarbageLeft(0)); | 123 state1 = MemoryReducer::Step(state0, MarkCompactEventNoGarbageLeft(2)); |
123 EXPECT_EQ(MemoryReducer::kWait, state1.action); | 124 EXPECT_EQ(MemoryReducer::kWait, state1.action); |
124 EXPECT_EQ(MemoryReducer::kLongDelayMs, state1.next_gc_start_ms); | 125 EXPECT_EQ(MemoryReducer::kLongDelayMs + 2, state1.next_gc_start_ms); |
125 EXPECT_EQ(0, state1.started_gcs); | 126 EXPECT_EQ(0, state1.started_gcs); |
| 127 EXPECT_EQ(2, state1.last_gc_time_ms); |
126 | 128 |
127 state1 = MemoryReducer::Step(state0, ContextDisposedEvent(0)); | 129 state1 = MemoryReducer::Step(state0, ContextDisposedEvent(0)); |
128 EXPECT_EQ(MemoryReducer::kWait, state1.action); | 130 EXPECT_EQ(MemoryReducer::kWait, state1.action); |
129 EXPECT_EQ(MemoryReducer::kLongDelayMs, state1.next_gc_start_ms); | 131 EXPECT_EQ(MemoryReducer::kLongDelayMs, state1.next_gc_start_ms); |
130 EXPECT_EQ(0, state1.started_gcs); | 132 EXPECT_EQ(0, state1.started_gcs); |
| 133 EXPECT_EQ(state0.last_gc_time_ms, state1.last_gc_time_ms); |
131 } | 134 } |
132 | 135 |
133 | 136 |
134 TEST(MemoryReducer, FromWaitToWait) { | 137 TEST(MemoryReducer, FromWaitToWait) { |
135 if (!FLAG_incremental_marking) return; | 138 if (!FLAG_incremental_marking) return; |
136 | 139 |
137 MemoryReducer::State state0(WaitState(2, 1000.0)), state1(DoneState()); | 140 MemoryReducer::State state0(WaitState(2, 1000.0)), state1(DoneState()); |
138 | 141 |
139 state1 = MemoryReducer::Step(state0, ContextDisposedEvent(2000)); | 142 state1 = MemoryReducer::Step(state0, ContextDisposedEvent(2000)); |
140 EXPECT_EQ(MemoryReducer::kWait, state1.action); | 143 EXPECT_EQ(MemoryReducer::kWait, state1.action); |
(...skipping 13 matching lines...) Expand all Loading... |
154 | 157 |
155 state1 = MemoryReducer::Step(state0, TimerEventPendingGC(2000)); | 158 state1 = MemoryReducer::Step(state0, TimerEventPendingGC(2000)); |
156 EXPECT_EQ(MemoryReducer::kWait, state1.action); | 159 EXPECT_EQ(MemoryReducer::kWait, state1.action); |
157 EXPECT_EQ(2000 + MemoryReducer::kLongDelayMs, state1.next_gc_start_ms); | 160 EXPECT_EQ(2000 + MemoryReducer::kLongDelayMs, state1.next_gc_start_ms); |
158 EXPECT_EQ(state0.started_gcs, state1.started_gcs); | 161 EXPECT_EQ(state0.started_gcs, state1.started_gcs); |
159 | 162 |
160 state1 = MemoryReducer::Step(state0, MarkCompactEventGarbageLeft(2000)); | 163 state1 = MemoryReducer::Step(state0, MarkCompactEventGarbageLeft(2000)); |
161 EXPECT_EQ(MemoryReducer::kWait, state1.action); | 164 EXPECT_EQ(MemoryReducer::kWait, state1.action); |
162 EXPECT_EQ(2000 + MemoryReducer::kLongDelayMs, state1.next_gc_start_ms); | 165 EXPECT_EQ(2000 + MemoryReducer::kLongDelayMs, state1.next_gc_start_ms); |
163 EXPECT_EQ(state0.started_gcs, state1.started_gcs); | 166 EXPECT_EQ(state0.started_gcs, state1.started_gcs); |
| 167 EXPECT_EQ(2000, state1.last_gc_time_ms); |
164 | 168 |
165 state1 = MemoryReducer::Step(state0, MarkCompactEventNoGarbageLeft(2000)); | 169 state1 = MemoryReducer::Step(state0, MarkCompactEventNoGarbageLeft(2000)); |
166 EXPECT_EQ(MemoryReducer::kWait, state1.action); | 170 EXPECT_EQ(MemoryReducer::kWait, state1.action); |
167 EXPECT_EQ(2000 + MemoryReducer::kLongDelayMs, state1.next_gc_start_ms); | 171 EXPECT_EQ(2000 + MemoryReducer::kLongDelayMs, state1.next_gc_start_ms); |
168 EXPECT_EQ(state0.started_gcs, state1.started_gcs); | 172 EXPECT_EQ(state0.started_gcs, state1.started_gcs); |
| 173 EXPECT_EQ(2000, state1.last_gc_time_ms); |
169 | 174 |
170 state1 = MemoryReducer::Step(state0, BackgroundIdleNotificationEvent(2000)); | 175 state1 = MemoryReducer::Step(state0, BackgroundIdleNotificationEvent(2000)); |
171 EXPECT_EQ(MemoryReducer::kWait, state1.action); | 176 EXPECT_EQ(MemoryReducer::kWait, state1.action); |
172 EXPECT_EQ(2000 + MemoryReducer::kLongDelayMs, state1.next_gc_start_ms); | 177 EXPECT_EQ(2000 + MemoryReducer::kLongDelayMs, state1.next_gc_start_ms); |
173 EXPECT_EQ(state0.started_gcs + 1, state1.started_gcs); | 178 EXPECT_EQ(state0.started_gcs + 1, state1.started_gcs); |
174 | 179 |
175 state1 = | 180 state1 = |
176 MemoryReducer::Step(state0, BackgroundIdleNotificationEvent(2000, false)); | 181 MemoryReducer::Step(state0, BackgroundIdleNotificationEvent(2000, false)); |
177 EXPECT_EQ(MemoryReducer::kWait, state1.action); | 182 EXPECT_EQ(MemoryReducer::kWait, state1.action); |
178 EXPECT_EQ(state0.next_gc_start_ms, state1.next_gc_start_ms); | 183 EXPECT_EQ(state0.next_gc_start_ms, state1.next_gc_start_ms); |
179 EXPECT_EQ(state0.started_gcs, state1.started_gcs); | 184 EXPECT_EQ(state0.started_gcs, state1.started_gcs); |
180 | 185 |
| 186 state0.last_gc_time_ms = 0; |
| 187 state1 = MemoryReducer::Step( |
| 188 state0, |
| 189 TimerEventHighAllocationRate(MemoryReducer::kWatchdogDelayMs + 1)); |
| 190 EXPECT_EQ(MemoryReducer::kWait, state1.action); |
| 191 EXPECT_EQ(MemoryReducer::kWatchdogDelayMs + 1 + MemoryReducer::kLongDelayMs, |
| 192 state1.next_gc_start_ms); |
| 193 EXPECT_EQ(state0.started_gcs, state1.started_gcs); |
| 194 EXPECT_EQ(state0.last_gc_time_ms, state1.last_gc_time_ms); |
| 195 |
| 196 state0.last_gc_time_ms = 1; |
| 197 state1 = MemoryReducer::Step(state0, TimerEventHighAllocationRate(2000)); |
| 198 EXPECT_EQ(MemoryReducer::kWait, state1.action); |
| 199 EXPECT_EQ(2000 + MemoryReducer::kLongDelayMs, state1.next_gc_start_ms); |
| 200 EXPECT_EQ(state0.started_gcs, state1.started_gcs); |
| 201 EXPECT_EQ(state0.last_gc_time_ms, state1.last_gc_time_ms); |
| 202 |
181 state0.started_gcs = MemoryReducer::kMaxNumberOfGCs; | 203 state0.started_gcs = MemoryReducer::kMaxNumberOfGCs; |
182 state1 = MemoryReducer::Step(state0, BackgroundIdleNotificationEvent(2000)); | 204 state1 = MemoryReducer::Step(state0, BackgroundIdleNotificationEvent(2000)); |
183 EXPECT_EQ(MemoryReducer::kWait, state1.action); | 205 EXPECT_EQ(MemoryReducer::kWait, state1.action); |
184 EXPECT_EQ(state0.next_gc_start_ms, state1.next_gc_start_ms); | 206 EXPECT_EQ(state0.next_gc_start_ms, state1.next_gc_start_ms); |
185 EXPECT_EQ(state0.started_gcs, state1.started_gcs); | 207 EXPECT_EQ(state0.started_gcs, state1.started_gcs); |
186 } | 208 } |
187 | 209 |
188 | 210 |
189 TEST(MemoryReducer, FromWaitToRun) { | 211 TEST(MemoryReducer, FromWaitToRun) { |
190 if (!FLAG_incremental_marking) return; | 212 if (!FLAG_incremental_marking) return; |
191 | 213 |
192 MemoryReducer::State state0(WaitState(0, 1000.0)), state1(DoneState()); | 214 MemoryReducer::State state0(WaitState(0, 1000.0)), state1(DoneState()); |
193 | 215 |
194 state1 = MemoryReducer::Step( | 216 state1 = MemoryReducer::Step( |
195 state0, TimerEventLowAllocationRate(state0.next_gc_start_ms + 1)); | 217 state0, TimerEventLowAllocationRate(state0.next_gc_start_ms + 1)); |
196 EXPECT_EQ(MemoryReducer::kRun, state1.action); | 218 EXPECT_EQ(MemoryReducer::kRun, state1.action); |
197 EXPECT_EQ(0, state1.next_gc_start_ms); | 219 EXPECT_EQ(0, state1.next_gc_start_ms); |
198 EXPECT_EQ(state0.started_gcs + 1, state1.started_gcs); | 220 EXPECT_EQ(state0.started_gcs + 1, state1.started_gcs); |
| 221 |
| 222 state1 = MemoryReducer::Step( |
| 223 state0, |
| 224 TimerEventHighAllocationRate(MemoryReducer::kWatchdogDelayMs + 2)); |
| 225 EXPECT_EQ(MemoryReducer::kRun, state1.action); |
| 226 EXPECT_EQ(0, state1.next_gc_start_ms); |
| 227 EXPECT_EQ(state0.started_gcs + 1, state1.started_gcs); |
| 228 EXPECT_EQ(state0.last_gc_time_ms, state1.last_gc_time_ms); |
199 } | 229 } |
200 | 230 |
201 | 231 |
202 TEST(MemoryReducer, FromWaitToDone) { | 232 TEST(MemoryReducer, FromWaitToDone) { |
203 if (!FLAG_incremental_marking) return; | 233 if (!FLAG_incremental_marking) return; |
204 | 234 |
205 MemoryReducer::State state0(WaitState(2, 0.0)), state1(DoneState()); | 235 MemoryReducer::State state0(WaitState(2, 0.0)), state1(DoneState()); |
206 | 236 |
207 state0.started_gcs = MemoryReducer::kMaxNumberOfGCs; | 237 state0.started_gcs = MemoryReducer::kMaxNumberOfGCs; |
208 | 238 |
209 state1 = MemoryReducer::Step(state0, TimerEventLowAllocationRate(2000)); | 239 state1 = MemoryReducer::Step(state0, TimerEventLowAllocationRate(2000)); |
210 EXPECT_EQ(MemoryReducer::kDone, state1.action); | 240 EXPECT_EQ(MemoryReducer::kDone, state1.action); |
211 EXPECT_EQ(0, state1.next_gc_start_ms); | 241 EXPECT_EQ(0, state1.next_gc_start_ms); |
212 EXPECT_EQ(0, state1.started_gcs); | 242 EXPECT_EQ(0, state1.started_gcs); |
| 243 EXPECT_EQ(state0.last_gc_time_ms, state1.last_gc_time_ms); |
213 | 244 |
214 state1 = MemoryReducer::Step(state0, TimerEventHighAllocationRate(2000)); | 245 state1 = MemoryReducer::Step(state0, TimerEventHighAllocationRate(2000)); |
215 EXPECT_EQ(MemoryReducer::kDone, state1.action); | 246 EXPECT_EQ(MemoryReducer::kDone, state1.action); |
216 EXPECT_EQ(0, state1.next_gc_start_ms); | 247 EXPECT_EQ(0, state1.next_gc_start_ms); |
217 EXPECT_EQ(0, state1.started_gcs); | 248 EXPECT_EQ(0, state1.started_gcs); |
| 249 EXPECT_EQ(state0.last_gc_time_ms, state1.last_gc_time_ms); |
218 | 250 |
219 state1 = MemoryReducer::Step(state0, TimerEventPendingGC(2000)); | 251 state1 = MemoryReducer::Step(state0, TimerEventPendingGC(2000)); |
220 EXPECT_EQ(MemoryReducer::kDone, state1.action); | 252 EXPECT_EQ(MemoryReducer::kDone, state1.action); |
221 EXPECT_EQ(0, state1.next_gc_start_ms); | 253 EXPECT_EQ(0, state1.next_gc_start_ms); |
222 EXPECT_EQ(0, state1.started_gcs); | 254 EXPECT_EQ(0, state1.started_gcs); |
| 255 EXPECT_EQ(state0.last_gc_time_ms, state1.last_gc_time_ms); |
223 } | 256 } |
224 | 257 |
225 | 258 |
226 TEST(MemoryReducer, FromRunToRun) { | 259 TEST(MemoryReducer, FromRunToRun) { |
227 if (!FLAG_incremental_marking) return; | 260 if (!FLAG_incremental_marking) return; |
228 | 261 |
229 MemoryReducer::State state0(RunState(1, 0.0)), state1(DoneState()); | 262 MemoryReducer::State state0(RunState(1, 0.0)), state1(DoneState()); |
230 | 263 |
231 state1 = MemoryReducer::Step(state0, TimerEventLowAllocationRate(2000)); | 264 state1 = MemoryReducer::Step(state0, TimerEventLowAllocationRate(2000)); |
232 EXPECT_EQ(MemoryReducer::kRun, state1.action); | 265 EXPECT_EQ(MemoryReducer::kRun, state1.action); |
233 EXPECT_EQ(state0.next_gc_start_ms, state1.next_gc_start_ms); | 266 EXPECT_EQ(state0.next_gc_start_ms, state1.next_gc_start_ms); |
234 EXPECT_EQ(state0.started_gcs, state1.started_gcs); | 267 EXPECT_EQ(state0.started_gcs, state1.started_gcs); |
| 268 EXPECT_EQ(state0.last_gc_time_ms, state1.last_gc_time_ms); |
235 | 269 |
236 state1 = MemoryReducer::Step(state0, TimerEventHighAllocationRate(2000)); | 270 state1 = MemoryReducer::Step(state0, TimerEventHighAllocationRate(2000)); |
237 EXPECT_EQ(MemoryReducer::kRun, state1.action); | 271 EXPECT_EQ(MemoryReducer::kRun, state1.action); |
238 EXPECT_EQ(state0.next_gc_start_ms, state1.next_gc_start_ms); | 272 EXPECT_EQ(state0.next_gc_start_ms, state1.next_gc_start_ms); |
239 EXPECT_EQ(state0.started_gcs, state1.started_gcs); | 273 EXPECT_EQ(state0.started_gcs, state1.started_gcs); |
| 274 EXPECT_EQ(state0.last_gc_time_ms, state1.last_gc_time_ms); |
240 | 275 |
241 state1 = MemoryReducer::Step(state0, TimerEventPendingGC(2000)); | 276 state1 = MemoryReducer::Step(state0, TimerEventPendingGC(2000)); |
242 EXPECT_EQ(MemoryReducer::kRun, state1.action); | 277 EXPECT_EQ(MemoryReducer::kRun, state1.action); |
243 EXPECT_EQ(state0.next_gc_start_ms, state1.next_gc_start_ms); | 278 EXPECT_EQ(state0.next_gc_start_ms, state1.next_gc_start_ms); |
244 EXPECT_EQ(state0.started_gcs, state1.started_gcs); | 279 EXPECT_EQ(state0.started_gcs, state1.started_gcs); |
| 280 EXPECT_EQ(state0.last_gc_time_ms, state1.last_gc_time_ms); |
245 | 281 |
246 state1 = MemoryReducer::Step(state0, ContextDisposedEvent(2000)); | 282 state1 = MemoryReducer::Step(state0, ContextDisposedEvent(2000)); |
247 EXPECT_EQ(MemoryReducer::kRun, state1.action); | 283 EXPECT_EQ(MemoryReducer::kRun, state1.action); |
248 EXPECT_EQ(state0.next_gc_start_ms, state1.next_gc_start_ms); | 284 EXPECT_EQ(state0.next_gc_start_ms, state1.next_gc_start_ms); |
249 EXPECT_EQ(state0.started_gcs, state1.started_gcs); | 285 EXPECT_EQ(state0.started_gcs, state1.started_gcs); |
| 286 EXPECT_EQ(state0.last_gc_time_ms, state1.last_gc_time_ms); |
250 } | 287 } |
251 | 288 |
252 | 289 |
253 TEST(MemoryReducer, FromRunToDone) { | 290 TEST(MemoryReducer, FromRunToDone) { |
254 if (!FLAG_incremental_marking) return; | 291 if (!FLAG_incremental_marking) return; |
255 | 292 |
256 MemoryReducer::State state0(RunState(2, 0.0)), state1(DoneState()); | 293 MemoryReducer::State state0(RunState(2, 0.0)), state1(DoneState()); |
257 | 294 |
258 state1 = MemoryReducer::Step(state0, MarkCompactEventNoGarbageLeft(2000)); | 295 state1 = MemoryReducer::Step(state0, MarkCompactEventNoGarbageLeft(2000)); |
259 EXPECT_EQ(MemoryReducer::kDone, state1.action); | 296 EXPECT_EQ(MemoryReducer::kDone, state1.action); |
260 EXPECT_EQ(0, state1.next_gc_start_ms); | 297 EXPECT_EQ(0, state1.next_gc_start_ms); |
261 EXPECT_EQ(0, state1.started_gcs); | 298 EXPECT_EQ(0, state1.started_gcs); |
| 299 EXPECT_EQ(2000, state1.last_gc_time_ms); |
262 | 300 |
263 state0.started_gcs = MemoryReducer::kMaxNumberOfGCs; | 301 state0.started_gcs = MemoryReducer::kMaxNumberOfGCs; |
264 | 302 |
265 state1 = MemoryReducer::Step(state0, MarkCompactEventGarbageLeft(2000)); | 303 state1 = MemoryReducer::Step(state0, MarkCompactEventGarbageLeft(2000)); |
266 EXPECT_EQ(MemoryReducer::kDone, state1.action); | 304 EXPECT_EQ(MemoryReducer::kDone, state1.action); |
267 EXPECT_EQ(0, state1.next_gc_start_ms); | 305 EXPECT_EQ(0, state1.next_gc_start_ms); |
268 EXPECT_EQ(0, state1.started_gcs); | 306 EXPECT_EQ(2000, state1.last_gc_time_ms); |
269 } | 307 } |
270 | 308 |
271 | 309 |
272 TEST(MemoryReducer, FromRunToWait) { | 310 TEST(MemoryReducer, FromRunToWait) { |
273 if (!FLAG_incremental_marking) return; | 311 if (!FLAG_incremental_marking) return; |
274 | 312 |
275 MemoryReducer::State state0(RunState(2, 0.0)), state1(DoneState()); | 313 MemoryReducer::State state0(RunState(2, 0.0)), state1(DoneState()); |
276 | 314 |
277 state1 = MemoryReducer::Step(state0, MarkCompactEventGarbageLeft(2000)); | 315 state1 = MemoryReducer::Step(state0, MarkCompactEventGarbageLeft(2000)); |
278 EXPECT_EQ(MemoryReducer::kWait, state1.action); | 316 EXPECT_EQ(MemoryReducer::kWait, state1.action); |
279 EXPECT_EQ(2000 + MemoryReducer::kShortDelayMs, state1.next_gc_start_ms); | 317 EXPECT_EQ(2000 + MemoryReducer::kShortDelayMs, state1.next_gc_start_ms); |
280 EXPECT_EQ(state0.started_gcs, state1.started_gcs); | 318 EXPECT_EQ(state0.started_gcs, state1.started_gcs); |
| 319 EXPECT_EQ(2000, state1.last_gc_time_ms); |
281 | 320 |
282 state0.started_gcs = 1; | 321 state0.started_gcs = 1; |
283 | 322 |
284 state1 = MemoryReducer::Step(state0, MarkCompactEventNoGarbageLeft(2000)); | 323 state1 = MemoryReducer::Step(state0, MarkCompactEventNoGarbageLeft(2000)); |
285 EXPECT_EQ(MemoryReducer::kWait, state1.action); | 324 EXPECT_EQ(MemoryReducer::kWait, state1.action); |
286 EXPECT_EQ(2000 + MemoryReducer::kShortDelayMs, state1.next_gc_start_ms); | 325 EXPECT_EQ(2000 + MemoryReducer::kShortDelayMs, state1.next_gc_start_ms); |
287 EXPECT_EQ(state0.started_gcs, state1.started_gcs); | 326 EXPECT_EQ(state0.started_gcs, state1.started_gcs); |
| 327 EXPECT_EQ(2000, state1.last_gc_time_ms); |
288 } | 328 } |
289 | 329 |
290 } // namespace internal | 330 } // namespace internal |
291 } // namespace v8 | 331 } // namespace v8 |
OLD | NEW |