| Index: test/heap-unittests/heap-unittest.cc
|
| diff --git a/test/heap-unittests/heap-unittest.cc b/test/heap-unittests/heap-unittest.cc
|
| index ee1dcbca3d619397a83c19dfb75e5b3a0a07ee6f..ab8898c3f6eeb3bc6a5025ca254fd1fdec71e2e9 100644
|
| --- a/test/heap-unittests/heap-unittest.cc
|
| +++ b/test/heap-unittests/heap-unittest.cc
|
| @@ -1,15 +1,45 @@
|
| // Copyright 2014 the V8 project authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
| +#define __STDC_LIMIT_MACROS
|
| +#include <stdint.h>
|
| +
|
| +#include "src/allocation.h"
|
| +#include "src/heap/gc-idle-time-handler.h"
|
|
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace v8 {
|
| namespace internal {
|
|
|
| -TEST(HeapTest, Dummy) {
|
| - EXPECT_FALSE(false);
|
| - EXPECT_TRUE(true);
|
| +TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeInitial) {
|
| + intptr_t step_size = GCIdleTimeHandler::EstimateMarkingStepSize(1, 0);
|
| + EXPECT_EQ(step_size, static_cast<intptr_t>(
|
| + GCIdleTimeHandler::kInitialConservativeMarkingSpeed *
|
| + GCIdleTimeHandler::kConservativeTimeRatio));
|
| +}
|
| +
|
| +
|
| +TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeNonZero) {
|
| + intptr_t marking_speed_in_bytes_per_millisecond = 100;
|
| + intptr_t step_size = GCIdleTimeHandler::EstimateMarkingStepSize(
|
| + 1, marking_speed_in_bytes_per_millisecond);
|
| + EXPECT_EQ(step_size,
|
| + static_cast<intptr_t>(marking_speed_in_bytes_per_millisecond *
|
| + GCIdleTimeHandler::kConservativeTimeRatio));
|
| +}
|
| +
|
| +
|
| +TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeOverflow1) {
|
| + intptr_t step_size =
|
| + GCIdleTimeHandler::EstimateMarkingStepSize(10, INTPTR_MAX);
|
| + EXPECT_EQ(step_size, INTPTR_MAX);
|
| +}
|
| +
|
| +
|
| +TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeOverflow2) {
|
| + intptr_t step_size = GCIdleTimeHandler::EstimateMarkingStepSize(INT_MAX, 10);
|
| + EXPECT_EQ(step_size, INTPTR_MAX);
|
| }
|
|
|
| } // namespace internal
|
|
|