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

Side by Side Diff: test/unittests/heap/scavenge-job-unittest.cc

Issue 1841043002: Represent speed in GCTracer functions as double instead of int. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
« no previous file with comments | « test/unittests/heap/gc-tracer-unittest.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/globals.h" 7 #include "src/globals.h"
8 #include "src/heap/scavenge-job.h" 8 #include "src/heap/scavenge-job.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 TEST(ScavengeJob, AllocationLimitHighScavengeSpeed) { 64 TEST(ScavengeJob, AllocationLimitHighScavengeSpeed) {
65 size_t scavenge_speed = kNewSpaceCapacity; 65 size_t scavenge_speed = kNewSpaceCapacity;
66 size_t expected_size = 66 size_t expected_size =
67 static_cast<size_t>( 67 static_cast<size_t>(
68 kNewSpaceCapacity * 68 kNewSpaceCapacity *
69 ScavengeJob::kMaxAllocationLimitAsFractionOfNewSpace) - 69 ScavengeJob::kMaxAllocationLimitAsFractionOfNewSpace) -
70 ScavengeJob::kBytesAllocatedBeforeNextIdleTask; 70 ScavengeJob::kBytesAllocatedBeforeNextIdleTask;
71 EXPECT_FALSE(ScavengeJob::ReachedIdleAllocationLimit( 71 EXPECT_FALSE(ScavengeJob::ReachedIdleAllocationLimit(
72 scavenge_speed, expected_size - 1, kNewSpaceCapacity)); 72 scavenge_speed, expected_size - 1, kNewSpaceCapacity));
73 EXPECT_TRUE(ScavengeJob::ReachedIdleAllocationLimit( 73 EXPECT_TRUE(ScavengeJob::ReachedIdleAllocationLimit(
74 scavenge_speed, expected_size, kNewSpaceCapacity)); 74 scavenge_speed, expected_size + 1, kNewSpaceCapacity));
75 } 75 }
76 76
77 77
78 TEST(ScavengeJob, EnoughIdleTimeForScavengeUnknownScavengeSpeed) { 78 TEST(ScavengeJob, EnoughIdleTimeForScavengeUnknownScavengeSpeed) {
79 size_t scavenge_speed = ScavengeJob::kInitialScavengeSpeedInBytesPerMs; 79 size_t scavenge_speed = ScavengeJob::kInitialScavengeSpeedInBytesPerMs;
80 size_t new_space_size = 1 * MB; 80 size_t new_space_size = 1 * MB;
81 size_t expected_time = (new_space_size + scavenge_speed - 1) / scavenge_speed; 81 size_t expected_time = (new_space_size + scavenge_speed - 1) / scavenge_speed;
82 EXPECT_TRUE( 82 EXPECT_TRUE(
83 ScavengeJob::EnoughIdleTimeForScavenge(expected_time, 0, new_space_size)); 83 ScavengeJob::EnoughIdleTimeForScavenge(expected_time, 0, new_space_size));
84 EXPECT_FALSE(ScavengeJob::EnoughIdleTimeForScavenge(expected_time - 1, 0, 84 EXPECT_FALSE(ScavengeJob::EnoughIdleTimeForScavenge(expected_time - 1, 0,
(...skipping 17 matching lines...) Expand all
102 size_t new_space_size = 1 * MB; 102 size_t new_space_size = 1 * MB;
103 size_t expected_time = (new_space_size + scavenge_speed - 1) / scavenge_speed; 103 size_t expected_time = (new_space_size + scavenge_speed - 1) / scavenge_speed;
104 EXPECT_TRUE(ScavengeJob::EnoughIdleTimeForScavenge( 104 EXPECT_TRUE(ScavengeJob::EnoughIdleTimeForScavenge(
105 expected_time, scavenge_speed, new_space_size)); 105 expected_time, scavenge_speed, new_space_size));
106 EXPECT_FALSE(ScavengeJob::EnoughIdleTimeForScavenge( 106 EXPECT_FALSE(ScavengeJob::EnoughIdleTimeForScavenge(
107 expected_time - 1, scavenge_speed, new_space_size)); 107 expected_time - 1, scavenge_speed, new_space_size));
108 } 108 }
109 109
110 } // namespace internal 110 } // namespace internal
111 } // namespace v8 111 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/heap/gc-tracer-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698