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

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

Issue 1072363002: Make full GC reduce memory footprint an explicit event in the idle notification handler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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
« src/heap/gc-idle-time-handler.h ('K') | « src/heap/heap.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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 for (int i = 0; i < GCIdleTimeHandler::kMaxNoProgressIdleTimesPerIdleRound; 509 for (int i = 0; i < GCIdleTimeHandler::kMaxNoProgressIdleTimesPerIdleRound;
510 i++) { 510 i++) {
511 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state); 511 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
512 EXPECT_EQ(DO_NOTHING, action.type); 512 EXPECT_EQ(DO_NOTHING, action.type);
513 } 513 }
514 // We should return DONE after not making progress for some time. 514 // We should return DONE after not making progress for some time.
515 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state); 515 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
516 EXPECT_EQ(DONE, action.type); 516 EXPECT_EQ(DONE, action.type);
517 } 517 }
518 518
519
520 TEST_F(GCIdleTimeHandlerTest, ReduceMemory) {
521 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
522 double idle_time = GCIdleTimeHandler::kMinTimeForReduceMemory;
523 for (int i = 0; i < GCIdleTimeHandler::kMaxMarkCompactsInIdleRound; i++) {
524 GCIdleTimeAction action = handler()->Compute(idle_time, heap_state);
525 EXPECT_EQ(DO_FULL_GC_COMPACT, action.type);
526 handler()->NotifyIdleMarkCompact();
527 }
528 GCIdleTimeAction action = handler()->Compute(idle_time, heap_state);
529 EXPECT_EQ(DONE, action.type);
530 }
531
519 } // namespace internal 532 } // namespace internal
520 } // namespace v8 533 } // namespace v8
OLDNEW
« src/heap/gc-idle-time-handler.h ('K') | « src/heap/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698