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

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

Issue 1138643003: Make sure that idle scavenges are just performed when enough objects are allocated in new space. (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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 heap_state.used_new_space_size = kNewSpaceCapacity; 212 heap_state.used_new_space_size = kNewSpaceCapacity;
213 heap_state.scavenge_speed_in_bytes_per_ms = kNewSpaceCapacity; 213 heap_state.scavenge_speed_in_bytes_per_ms = kNewSpaceCapacity;
214 int idle_time_ms = 16; 214 int idle_time_ms = 16;
215 EXPECT_TRUE(GCIdleTimeHandler::ShouldDoScavenge( 215 EXPECT_TRUE(GCIdleTimeHandler::ShouldDoScavenge(
216 idle_time_ms, heap_state.new_space_capacity, 216 idle_time_ms, heap_state.new_space_capacity,
217 heap_state.used_new_space_size, heap_state.scavenge_speed_in_bytes_per_ms, 217 heap_state.used_new_space_size, heap_state.scavenge_speed_in_bytes_per_ms,
218 heap_state.new_space_allocation_throughput_in_bytes_per_ms)); 218 heap_state.new_space_allocation_throughput_in_bytes_per_ms));
219 } 219 }
220 220
221 221
222 TEST_F(GCIdleTimeHandlerTest, DoNotScavengeSmallNewSpaceSize) {
223 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
224 heap_state.used_new_space_size = (MB / 2) - 1;
225 heap_state.scavenge_speed_in_bytes_per_ms = kNewSpaceCapacity;
226 int idle_time_ms = 16;
227 EXPECT_FALSE(GCIdleTimeHandler::ShouldDoScavenge(
228 idle_time_ms, heap_state.new_space_capacity,
229 heap_state.used_new_space_size, heap_state.scavenge_speed_in_bytes_per_ms,
230 heap_state.new_space_allocation_throughput_in_bytes_per_ms));
231 }
232
233
222 TEST_F(GCIdleTimeHandlerTest, ShouldDoMarkCompact) { 234 TEST_F(GCIdleTimeHandlerTest, ShouldDoMarkCompact) {
223 size_t idle_time_ms = GCIdleTimeHandler::kMaxScheduledIdleTime; 235 size_t idle_time_ms = GCIdleTimeHandler::kMaxScheduledIdleTime;
224 EXPECT_TRUE(GCIdleTimeHandler::ShouldDoMarkCompact(idle_time_ms, 0, 0)); 236 EXPECT_TRUE(GCIdleTimeHandler::ShouldDoMarkCompact(idle_time_ms, 0, 0));
225 } 237 }
226 238
227 239
228 TEST_F(GCIdleTimeHandlerTest, DontDoMarkCompact) { 240 TEST_F(GCIdleTimeHandlerTest, DontDoMarkCompact) {
229 size_t idle_time_ms = 1; 241 size_t idle_time_ms = 1;
230 EXPECT_FALSE(GCIdleTimeHandler::ShouldDoMarkCompact( 242 EXPECT_FALSE(GCIdleTimeHandler::ShouldDoMarkCompact(
231 idle_time_ms, kSizeOfObjects, kMarkingSpeed)); 243 idle_time_ms, kSizeOfObjects, kMarkingSpeed));
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 handler()->NotifyMarkCompact(); 638 handler()->NotifyMarkCompact();
627 handler()->NotifyIdleMarkCompact(); 639 handler()->NotifyIdleMarkCompact();
628 } 640 }
629 action = handler()->Compute(idle_time_ms, heap_state); 641 action = handler()->Compute(idle_time_ms, heap_state);
630 EXPECT_EQ(DONE, action.type); 642 EXPECT_EQ(DONE, action.type);
631 } 643 }
632 644
633 645
634 } // namespace internal 646 } // namespace internal
635 } // namespace v8 647 } // 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