OLD | NEW |
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 | 8 |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 | 40 |
41 TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeOverflow2) { | 41 TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeOverflow2) { |
42 size_t step_size = GCIdleTimeHandler::EstimateMarkingStepSize( | 42 size_t step_size = GCIdleTimeHandler::EstimateMarkingStepSize( |
43 std::numeric_limits<size_t>::max(), 10); | 43 std::numeric_limits<size_t>::max(), 10); |
44 EXPECT_EQ(static_cast<size_t>(GCIdleTimeHandler::kMaximumMarkingStepSize), | 44 EXPECT_EQ(static_cast<size_t>(GCIdleTimeHandler::kMaximumMarkingStepSize), |
45 step_size); | 45 step_size); |
46 } | 46 } |
47 | 47 |
| 48 |
| 49 TEST(EstimateMarkCompactTimeTest, EstimateMarkCompactTimeInitial) { |
| 50 size_t size = 100 * MB; |
| 51 size_t time = GCIdleTimeHandler::EstimateMarkCompactTime(size, 0); |
| 52 EXPECT_EQ(size / GCIdleTimeHandler::kInitialConservativeMarkCompactSpeed, |
| 53 time); |
| 54 } |
| 55 |
| 56 |
| 57 TEST(EstimateMarkCompactTimeTest, EstimateMarkCompactTimeNonZero) { |
| 58 size_t size = 100 * MB; |
| 59 size_t speed = 10 * KB; |
| 60 size_t time = GCIdleTimeHandler::EstimateMarkCompactTime(size, speed); |
| 61 EXPECT_EQ(size / speed, time); |
| 62 } |
| 63 |
| 64 |
| 65 TEST(EstimateMarkCompactTimeTest, EstimateMarkCompactTimeMax) { |
| 66 size_t size = std::numeric_limits<size_t>::max(); |
| 67 size_t speed = 1; |
| 68 size_t time = GCIdleTimeHandler::EstimateMarkCompactTime(size, speed); |
| 69 EXPECT_EQ(GCIdleTimeHandler::kMaxMarkCompactTimeInMs, time); |
| 70 } |
| 71 |
48 } // namespace internal | 72 } // namespace internal |
49 } // namespace v8 | 73 } // namespace v8 |
OLD | NEW |