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

Side by Side Diff: test/unittests/heap/gc-idle-time-handler-unittest.cc

Issue 1118303004: When context disposal rate is high and we cannot perform a full GC, we do nothing until the context… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months 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 | « src/heap/gc-idle-time-handler.cc ('k') | no next file » | 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 #include <limits> 5 #include <limits>
6 6
7 #include "src/heap/gc-idle-time-handler.h" 7 #include "src/heap/gc-idle-time-handler.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 TEST_F(GCIdleTimeHandlerTest, ContextDisposeHighRate) { 262 TEST_F(GCIdleTimeHandlerTest, ContextDisposeHighRate) {
263 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); 263 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
264 heap_state.contexts_disposed = 1; 264 heap_state.contexts_disposed = 1;
265 heap_state.contexts_disposal_rate = 265 heap_state.contexts_disposal_rate =
266 GCIdleTimeHandler::kHighContextDisposalRate - 1; 266 GCIdleTimeHandler::kHighContextDisposalRate - 1;
267 heap_state.incremental_marking_stopped = true; 267 heap_state.incremental_marking_stopped = true;
268 double idle_time_ms = 0; 268 double idle_time_ms = 0;
269 for (int mode = 0; mode < 1; mode++) { 269 for (int mode = 0; mode < 1; mode++) {
270 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state); 270 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
271 EXPECT_EQ(DO_FULL_GC, action.type); 271 EXPECT_EQ(DO_FULL_GC, action.type);
272 heap_state.contexts_disposal_rate = 0.0;
272 TransitionToReduceMemoryMode(heap_state); 273 TransitionToReduceMemoryMode(heap_state);
273 } 274 }
274 } 275 }
275 276
276 277
277 TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeZeroIdleTime) { 278 TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeZeroIdleTime) {
278 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); 279 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
279 heap_state.contexts_disposed = 1; 280 heap_state.contexts_disposed = 1;
280 heap_state.contexts_disposal_rate = 1.0; 281 heap_state.contexts_disposal_rate = 1.0;
281 heap_state.incremental_marking_stopped = true; 282 heap_state.incremental_marking_stopped = true;
282 double idle_time_ms = 0; 283 double idle_time_ms = 0;
283 for (int mode = 0; mode < 1; mode++) { 284 for (int mode = 0; mode < 1; mode++) {
284 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state); 285 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
285 EXPECT_EQ(DO_FULL_GC, action.type); 286 EXPECT_EQ(DO_FULL_GC, action.type);
287 heap_state.contexts_disposal_rate = 0.0;
286 TransitionToReduceMemoryMode(heap_state); 288 TransitionToReduceMemoryMode(heap_state);
287 } 289 }
288 } 290 }
289 291
290 292
291 TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeSmallIdleTime1) { 293 TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeSmallIdleTime1) {
292 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); 294 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
293 heap_state.contexts_disposed = 1; 295 heap_state.contexts_disposed = 1;
294 heap_state.contexts_disposal_rate = 1.0; 296 heap_state.contexts_disposal_rate =
297 GCIdleTimeHandler::kHighContextDisposalRate;
295 heap_state.incremental_marking_stopped = true; 298 heap_state.incremental_marking_stopped = true;
296 size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms; 299 size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
297 double idle_time_ms = 300 double idle_time_ms =
298 static_cast<double>(heap_state.size_of_objects / speed - 1); 301 static_cast<double>(heap_state.size_of_objects / speed - 1);
299 for (int mode = 0; mode < 1; mode++) { 302 for (int mode = 0; mode < 1; mode++) {
300 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state); 303 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
301 EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type); 304 EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
305 heap_state.contexts_disposal_rate = 0.0;
302 TransitionToReduceMemoryMode(heap_state); 306 TransitionToReduceMemoryMode(heap_state);
303 } 307 }
304 } 308 }
305 309
306 310
307 TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeSmallIdleTime2) { 311 TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeSmallIdleTime2) {
308 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); 312 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
309 heap_state.contexts_disposed = 1; 313 heap_state.contexts_disposed = 1;
310 heap_state.contexts_disposal_rate = 1.0; 314 heap_state.contexts_disposal_rate =
315 GCIdleTimeHandler::kHighContextDisposalRate;
311 size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms; 316 size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
312 double idle_time_ms = 317 double idle_time_ms =
313 static_cast<double>(heap_state.size_of_objects / speed - 1); 318 static_cast<double>(heap_state.size_of_objects / speed - 1);
314 for (int mode = 0; mode < 1; mode++) { 319 for (int mode = 0; mode < 1; mode++) {
315 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state); 320 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
316 EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type); 321 EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
322 heap_state.contexts_disposal_rate = 0.0;
317 TransitionToReduceMemoryMode(heap_state); 323 TransitionToReduceMemoryMode(heap_state);
318 } 324 }
319 } 325 }
320 326
321 327
322 TEST_F(GCIdleTimeHandlerTest, IncrementalMarking1) { 328 TEST_F(GCIdleTimeHandlerTest, IncrementalMarking1) {
323 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); 329 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
324 size_t speed = heap_state.incremental_marking_speed_in_bytes_per_ms; 330 size_t speed = heap_state.incremental_marking_speed_in_bytes_per_ms;
325 double idle_time_ms = 10; 331 double idle_time_ms = 10;
326 for (int mode = 0; mode < 1; mode++) { 332 for (int mode = 0; mode < 1; mode++) {
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 handler()->NotifyMarkCompact(); 626 handler()->NotifyMarkCompact();
621 handler()->NotifyIdleMarkCompact(); 627 handler()->NotifyIdleMarkCompact();
622 } 628 }
623 action = handler()->Compute(idle_time_ms, heap_state); 629 action = handler()->Compute(idle_time_ms, heap_state);
624 EXPECT_EQ(DONE, action.type); 630 EXPECT_EQ(DONE, action.type);
625 } 631 }
626 632
627 633
628 } // namespace internal 634 } // namespace internal
629 } // namespace v8 635 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/gc-idle-time-handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698