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