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

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

Issue 583593006: Force scavenge in idle notification if we estimate that it will take long. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 size_t size = std::numeric_limits<size_t>::max(); 105 size_t size = std::numeric_limits<size_t>::max();
106 size_t speed = 1; 106 size_t speed = 1;
107 size_t time = GCIdleTimeHandler::EstimateMarkCompactTime(size, speed); 107 size_t time = GCIdleTimeHandler::EstimateMarkCompactTime(size, speed);
108 EXPECT_EQ(GCIdleTimeHandler::kMaxMarkCompactTimeInMs, time); 108 EXPECT_EQ(GCIdleTimeHandler::kMaxMarkCompactTimeInMs, time);
109 } 109 }
110 110
111 111
112 TEST(GCIdleTimeHandler, EstimateScavengeTimeInitial) { 112 TEST(GCIdleTimeHandler, EstimateScavengeTimeInitial) {
113 size_t size = 1 * MB; 113 size_t size = 1 * MB;
114 size_t time = GCIdleTimeHandler::EstimateScavengeTime(size, 0); 114 size_t time = GCIdleTimeHandler::EstimateScavengeTime(size, 0);
115 EXPECT_EQ(size / GCIdleTimeHandler::kInitialConservativeScavengeSpeed, time); 115 EXPECT_EQ(GCIdleTimeHandler::kLargeIdleTime, time);
116 } 116 }
117 117
118 118
119 TEST(GCIdleTimeHandler, EstimateScavengeTimeNonZero) { 119 TEST(GCIdleTimeHandler, EstimateScavengeTimeNonZero) {
120 size_t size = 1 * MB; 120 size_t size = 1 * MB;
121 size_t speed = 1 * MB; 121 size_t speed = 1 * MB;
122 size_t time = GCIdleTimeHandler::EstimateScavengeTime(size, speed); 122 size_t time = GCIdleTimeHandler::EstimateScavengeTime(size, speed);
123 EXPECT_EQ(size / speed, time); 123 EXPECT_EQ(size / speed, time);
124 } 124 }
125 125
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // Emulate mutator work. 339 // Emulate mutator work.
340 for (int i = 0; i < GCIdleTimeHandler::kIdleScavengeThreshold; i++) { 340 for (int i = 0; i < GCIdleTimeHandler::kIdleScavengeThreshold; i++) {
341 handler()->NotifyScavenge(); 341 handler()->NotifyScavenge();
342 } 342 }
343 action = handler()->Compute(0, heap_state); 343 action = handler()->Compute(0, heap_state);
344 EXPECT_EQ(DO_NOTHING, action.type); 344 EXPECT_EQ(DO_NOTHING, action.type);
345 } 345 }
346 346
347 } // namespace internal 347 } // namespace internal
348 } // namespace v8 348 } // namespace v8
OLDNEW
« src/heap/gc-idle-time-handler.cc ('K') | « 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