Index: src/heap/gc-idle-time-handler-unittest.cc |
diff --git a/src/heap/gc-idle-time-handler-unittest.cc b/src/heap/gc-idle-time-handler-unittest.cc |
index b9989a8c46a1d689b977a7d80a7dfba4f71b8a30..80d120faf0d9d34dff8938763f7a2d3ae77a3e25 100644 |
--- a/src/heap/gc-idle-time-handler-unittest.cc |
+++ b/src/heap/gc-idle-time-handler-unittest.cc |
@@ -28,12 +28,17 @@ class GCIdleTimeHandlerTest : public ::testing::Test { |
result.sweeping_in_progress = false; |
result.mark_compact_speed_in_bytes_per_ms = kMarkCompactSpeed; |
result.incremental_marking_speed_in_bytes_per_ms = kMarkingSpeed; |
+ result.scavenge_speed_in_bytes_per_ms = kScavengeSpeed; |
+ result.available_new_space_memory = kNewSpaceCapacity; |
+ result.new_space_capacity = kNewSpaceCapacity; |
return result; |
} |
static const size_t kSizeOfObjects = 100 * MB; |
static const size_t kMarkCompactSpeed = 100 * KB; |
static const size_t kMarkingSpeed = 100 * KB; |
+ static const size_t kScavengeSpeed = 100 * KB; |
+ static const size_t kNewSpaceCapacity = 1 * MB; |
private: |
GCIdleTimeHandler handler_; |
@@ -101,6 +106,21 @@ TEST(GCIdleTimeHandler, EstimateMarkCompactTimeMax) { |
} |
+TEST(GCIdleTimeHandler, EstimateScavengeTimeInitial) { |
+ size_t size = 1 * MB; |
+ size_t time = GCIdleTimeHandler::EstimateScavengeTime(size, 0); |
+ EXPECT_EQ(size / GCIdleTimeHandler::kInitialConservativeScavengeSpeed, time); |
+} |
+ |
+ |
+TEST(GCIdleTimeHandler, EstimateScavengeTimeNonZero) { |
+ size_t size = 1 * MB; |
+ size_t speed = 1 * MB; |
+ size_t time = GCIdleTimeHandler::EstimateScavengeTime(size, speed); |
+ EXPECT_EQ(size / speed, time); |
+} |
+ |
+ |
TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeLargeIdleTime) { |
GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); |
heap_state.contexts_disposed = 1; |