Revision: 23545
Author: [email protected]
Date: Mon Sep 1 09:12:50 2014 UTC
Log: Merge heap unit tests into src.
Also rip out the unused runtime-unittests; will be added back on-demand.
BUG=v8:3489
LOG=n
[email protected], [email protected]
Review URL: https://codereview.chromium.org/525193004
https://code.google.com/p/v8/source/detail?r=23545
Added:
/branches/bleeding_edge/src/heap/gc-idle-time-handler-unittest.cc
/branches/bleeding_edge/src/heap/heap.gyp
Deleted:
/branches/bleeding_edge/test/heap-unittests/DEPS
/branches/bleeding_edge/test/heap-unittests/heap-unittest.cc
/branches/bleeding_edge/test/heap-unittests/heap-unittest.h
/branches/bleeding_edge/test/heap-unittests/heap-unittests.cc
/branches/bleeding_edge/test/heap-unittests/heap-unittests.gyp
/branches/bleeding_edge/test/heap-unittests/heap-unittests.h
/branches/bleeding_edge/test/runtime-unittests
Modified:
/branches/bleeding_edge/build/all.gyp
/branches/bleeding_edge/tools/presubmit.py
/branches/bleeding_edge/tools/run-tests.py
=======================================
--- /dev/null
+++ /branches/bleeding_edge/src/heap/gc-idle-time-handler-unittest.cc Mon
Sep 1 09:12:50 2014 UTC
@@ -0,0 +1,244 @@
+// 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.
+
+#include <limits>
+
+#include "src/heap/gc-idle-time-handler.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace v8 {
+namespace internal {
+
+namespace {
+
+class GCIdleTimeHandlerTest : public ::testing::Test {
+ public:
+ GCIdleTimeHandlerTest() {}
+ virtual ~GCIdleTimeHandlerTest() {}
+
+ GCIdleTimeHandler* handler() { return &handler_; }
+
+ GCIdleTimeHandler::HeapState DefaultHeapState() {
+ GCIdleTimeHandler::HeapState result;
+ result.contexts_disposed = 0;
+ result.size_of_objects = kSizeOfObjects;
+ result.incremental_marking_stopped = false;
+ result.can_start_incremental_marking = true;
+ result.sweeping_in_progress = false;
+ result.mark_compact_speed_in_bytes_per_ms = kMarkCompactSpeed;
+ result.incremental_marking_speed_in_bytes_per_ms = kMarkingSpeed;
+ return result;
+ }
+
+ static const size_t kSizeOfObjects = 100 * MB;
+ static const size_t kMarkCompactSpeed = 100 * KB;
+ static const size_t kMarkingSpeed = 100 * KB;
+
+ private:
+ GCIdleTimeHandler handler_;
+};
+
+} // namespace
+
+
+TEST(GCIdleTimeHandler, EstimateMarkingStepSizeInitial) {
+ size_t step_size = GCIdleTimeHandler::EstimateMarkingStepSize(1, 0);
+ EXPECT_EQ(
+
static_cast<size_t>(GCIdleTimeHandler::kInitialConservativeMarkingSpeed *
+ GCIdleTimeHandler::kConservativeTimeRatio),
+ step_size);
+}
+
+
+TEST(GCIdleTimeHandler, EstimateMarkingStepSizeNonZero) {
+ size_t marking_speed_in_bytes_per_millisecond = 100;
+ size_t step_size = GCIdleTimeHandler::EstimateMarkingStepSize(
+ 1, marking_speed_in_bytes_per_millisecond);
+ EXPECT_EQ(static_cast<size_t>(marking_speed_in_bytes_per_millisecond *
+ GCIdleTimeHandler::kConservativeTimeRatio),
+ step_size);
+}
+
+
+TEST(GCIdleTimeHandler, EstimateMarkingStepSizeOverflow1) {
+ size_t step_size = GCIdleTimeHandler::EstimateMarkingStepSize(
+ 10, std::numeric_limits<size_t>::max());
+
EXPECT_EQ(static_cast<size_t>(GCIdleTimeHandler::kMaximumMarkingStepSize),
+ step_size);
+}
+
+
+TEST(GCIdleTimeHandler, EstimateMarkingStepSizeOverflow2) {
+ size_t step_size = GCIdleTimeHandler::EstimateMarkingStepSize(
+ std::numeric_limits<size_t>::max(), 10);
+
EXPECT_EQ(static_cast<size_t>(GCIdleTimeHandler::kMaximumMarkingStepSize),
+ step_size);
+}
+
+
+TEST(GCIdleTimeHandler, EstimateMarkCompactTimeInitial) {
+ size_t size = 100 * MB;
+ size_t time = GCIdleTimeHandler::EstimateMarkCompactTime(size, 0);
+ EXPECT_EQ(size / GCIdleTimeHandler::kInitialConservativeMarkCompactSpeed,
+ time);
+}
+
+
+TEST(GCIdleTimeHandler, EstimateMarkCompactTimeNonZero) {
+ size_t size = 100 * MB;
+ size_t speed = 10 * KB;
+ size_t time = GCIdleTimeHandler::EstimateMarkCompactTime(size, speed);
+ EXPECT_EQ(size / speed, time);
+}
+
+
+TEST(GCIdleTimeHandler, EstimateMarkCompactTimeMax) {
+ size_t size = std::numeric_limits<size_t>::max();
+ size_t speed = 1;
+ size_t time = GCIdleTimeHandler::EstimateMarkCompactTime(size, speed);
+ EXPECT_EQ(GCIdleTimeHandler::kMaxMarkCompactTimeInMs, time);
+}
+
+
+TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeLargeIdleTime) {
+ GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
+ heap_state.contexts_disposed = 1;
+ heap_state.incremental_marking_stopped = true;
+ size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
+ int idle_time_ms =
+ static_cast<int>((heap_state.size_of_objects + speed - 1) / speed);
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_FULL_GC, action.type);
+}
+
+
+TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeSmallIdleTime1) {
+ GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
+ heap_state.contexts_disposed = 1;
+ heap_state.incremental_marking_stopped = true;
+ size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
+ int idle_time_ms = static_cast<int>(heap_state.size_of_objects / speed -
1);
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
+}
+
+
+TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeSmallIdleTime2) {
+ GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
+ heap_state.contexts_disposed = 1;
+ size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
+ int idle_time_ms = static_cast<int>(heap_state.size_of_objects / speed -
1);
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
+}
+
+
+TEST_F(GCIdleTimeHandlerTest, IncrementalMarking1) {
+ GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
+ size_t speed = heap_state.incremental_marking_speed_in_bytes_per_ms;
+ int idle_time_ms = 10;
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
+ EXPECT_GT(speed * static_cast<size_t>(idle_time_ms),
+ static_cast<size_t>(action.parameter));
+ EXPECT_LT(0, action.parameter);
+}
+
+
+TEST_F(GCIdleTimeHandlerTest, IncrementalMarking2) {
+ GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
+ heap_state.incremental_marking_stopped = true;
+ size_t speed = heap_state.incremental_marking_speed_in_bytes_per_ms;
+ int idle_time_ms = 10;
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
+ EXPECT_GT(speed * static_cast<size_t>(idle_time_ms),
+ static_cast<size_t>(action.parameter));
+ EXPECT_LT(0, action.parameter);
+}
+
+
+TEST_F(GCIdleTimeHandlerTest, NotEnoughTime) {
+ GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
+ heap_state.incremental_marking_stopped = true;
+ heap_state.can_start_incremental_marking = false;
+ size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
+ int idle_time_ms = static_cast<int>(heap_state.size_of_objects / speed -
1);
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_NOTHING, action.type);
+}
+
+
+TEST_F(GCIdleTimeHandlerTest, StopEventually1) {
+ GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
+ heap_state.incremental_marking_stopped = true;
+ heap_state.can_start_incremental_marking = false;
+ size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
+ int idle_time_ms = static_cast<int>(heap_state.size_of_objects / speed +
1);
+ for (int i = 0; i < GCIdleTimeHandler::kMaxMarkCompactsInIdleRound; i++)
{
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_FULL_GC, action.type);
+ handler()->NotifyIdleMarkCompact();
+ }
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_NOTHING, action.type);
+}
+
+
+TEST_F(GCIdleTimeHandlerTest, StopEventually2) {
+ GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
+ int idle_time_ms = 10;
+ for (int i = 0; i < GCIdleTimeHandler::kMaxMarkCompactsInIdleRound; i++)
{
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
+ handler()->NotifyIdleMarkCompact();
+ }
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_NOTHING, action.type);
+}
+
+
+TEST_F(GCIdleTimeHandlerTest, ContinueAfterStop1) {
+ GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
+ heap_state.incremental_marking_stopped = true;
+ heap_state.can_start_incremental_marking = false;
+ size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
+ int idle_time_ms = static_cast<int>(heap_state.size_of_objects / speed +
1);
+ for (int i = 0; i < GCIdleTimeHandler::kMaxMarkCompactsInIdleRound; i++)
{
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_FULL_GC, action.type);
+ handler()->NotifyIdleMarkCompact();
+ }
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_NOTHING, action.type);
+ // Emulate mutator work.
+ for (int i = 0; i < GCIdleTimeHandler::kIdleScavengeThreshold; i++) {
+ handler()->NotifyScavenge();
+ }
+ action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_FULL_GC, action.type);
+}
+
+
+TEST_F(GCIdleTimeHandlerTest, ContinueAfterStop2) {
+ GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
+ int idle_time_ms = 10;
+ for (int i = 0; i < GCIdleTimeHandler::kMaxMarkCompactsInIdleRound; i++)
{
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ if (action.type == DO_NOTHING) break;
+ EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
+ handler()->NotifyIdleMarkCompact();
+ }
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_NOTHING, action.type);
+ // Emulate mutator work.
+ for (int i = 0; i < GCIdleTimeHandler::kIdleScavengeThreshold; i++) {
+ handler()->NotifyScavenge();
+ }
+ action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
+}
+
+} // namespace internal
+} // namespace v8
=======================================
--- /dev/null
+++ /branches/bleeding_edge/src/heap/heap.gyp Mon Sep 1 09:12:50 2014 UTC
@@ -0,0 +1,52 @@
+# 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.
+
+{
+ 'variables': {
+ 'v8_code': 1,
+ },
+ 'includes': ['../../build/toolchain.gypi', '../../build/features.gypi'],
+ 'targets': [
+ {
+ 'target_name': 'heap-unittests',
+ 'type': 'executable',
+ 'dependencies': [
+ '../../testing/gtest.gyp:gtest',
+ '../../testing/gtest.gyp:gtest_main',
+ '../../tools/gyp/v8.gyp:v8_libplatform',
+ ],
+ 'include_dirs': [
+ '../..',
+ ],
+ 'sources': [ ### gcmole(all) ###
+ 'gc-idle-time-handler-unittest.cc',
+ ],
+ 'conditions': [
+ ['component=="shared_library"', {
+ # heap-unittests can't be built against a shared library, so we
+ # need to depend on the underlying static target in that case.
+ 'conditions': [
+ ['v8_use_snapshot=="true"', {
+ 'dependencies': ['../../tools/gyp/v8.gyp:v8_snapshot'],
+ },
+ {
+ 'dependencies': [
+ '../../tools/gyp/v8.gyp:v8_nosnapshot',
+ ],
+ }],
+ ],
+ }, {
+ 'dependencies': ['../../tools/gyp/v8.gyp:v8'],
+ }],
+ ['os_posix == 1', {
+ # TODO(svenpanne): This is a temporary work-around to fix the
warnings
+ # that show up because we use -std=gnu++0x instead of -std=c++11.
+ 'cflags!': [
+ '-pedantic',
+ ],
+ }],
+ ],
+ },
+ ],
+}
=======================================
--- /branches/bleeding_edge/test/heap-unittests/DEPS Tue Aug 19 10:54:54
2014 UTC
+++ /dev/null
@@ -1,7 +0,0 @@
-include_rules = [
- "+src",
- "+testing/gmock",
- "+testing/gmock-support.h",
- "+testing/gtest",
- "+testing/gtest-support.h",
-]
=======================================
--- /branches/bleeding_edge/test/heap-unittests/heap-unittest.cc Fri Aug 22
14:12:47 2014 UTC
+++ /dev/null
@@ -1,213 +0,0 @@
-// 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.
-
-#include "test/heap-unittests/heap-unittest.h"
-
-#include <limits>
-
-
-namespace v8 {
-namespace internal {
-
-TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeInitial) {
- size_t step_size = GCIdleTimeHandler::EstimateMarkingStepSize(1, 0);
- EXPECT_EQ(
-
static_cast<size_t>(GCIdleTimeHandler::kInitialConservativeMarkingSpeed *
- GCIdleTimeHandler::kConservativeTimeRatio),
- step_size);
-}
-
-
-TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeNonZero) {
- size_t marking_speed_in_bytes_per_millisecond = 100;
- size_t step_size = GCIdleTimeHandler::EstimateMarkingStepSize(
- 1, marking_speed_in_bytes_per_millisecond);
- EXPECT_EQ(static_cast<size_t>(marking_speed_in_bytes_per_millisecond *
- GCIdleTimeHandler::kConservativeTimeRatio),
- step_size);
-}
-
-
-TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeOverflow1) {
- size_t step_size = GCIdleTimeHandler::EstimateMarkingStepSize(
- 10, std::numeric_limits<size_t>::max());
-
EXPECT_EQ(static_cast<size_t>(GCIdleTimeHandler::kMaximumMarkingStepSize),
- step_size);
-}
-
-
-TEST(EstimateMarkingStepSizeTest, EstimateMarkingStepSizeOverflow2) {
- size_t step_size = GCIdleTimeHandler::EstimateMarkingStepSize(
- std::numeric_limits<size_t>::max(), 10);
-
EXPECT_EQ(static_cast<size_t>(GCIdleTimeHandler::kMaximumMarkingStepSize),
- step_size);
-}
-
-
-TEST(EstimateMarkCompactTimeTest, EstimateMarkCompactTimeInitial) {
- size_t size = 100 * MB;
- size_t time = GCIdleTimeHandler::EstimateMarkCompactTime(size, 0);
- EXPECT_EQ(size / GCIdleTimeHandler::kInitialConservativeMarkCompactSpeed,
- time);
-}
-
-
-TEST(EstimateMarkCompactTimeTest, EstimateMarkCompactTimeNonZero) {
- size_t size = 100 * MB;
- size_t speed = 10 * KB;
- size_t time = GCIdleTimeHandler::EstimateMarkCompactTime(size, speed);
- EXPECT_EQ(size / speed, time);
-}
-
-
-TEST(EstimateMarkCompactTimeTest, EstimateMarkCompactTimeMax) {
- size_t size = std::numeric_limits<size_t>::max();
- size_t speed = 1;
- size_t time = GCIdleTimeHandler::EstimateMarkCompactTime(size, speed);
- EXPECT_EQ(GCIdleTimeHandler::kMaxMarkCompactTimeInMs, time);
-}
-
-
-TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeLargeIdleTime) {
- GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
- heap_state.contexts_disposed = 1;
- heap_state.incremental_marking_stopped = true;
- size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
- int idle_time_ms =
- static_cast<int>((heap_state.size_of_objects + speed - 1) / speed);
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_FULL_GC, action.type);
-}
-
-
-TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeSmallIdleTime1) {
- GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
- heap_state.contexts_disposed = 1;
- heap_state.incremental_marking_stopped = true;
- size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
- int idle_time_ms = static_cast<int>(heap_state.size_of_objects / speed -
1);
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
-}
-
-
-TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeSmallIdleTime2) {
- GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
- heap_state.contexts_disposed = 1;
- size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
- int idle_time_ms = static_cast<int>(heap_state.size_of_objects / speed -
1);
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
-}
-
-
-TEST_F(GCIdleTimeHandlerTest, IncrementalMarking1) {
- GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
- size_t speed = heap_state.incremental_marking_speed_in_bytes_per_ms;
- int idle_time_ms = 10;
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
- EXPECT_GT(speed * static_cast<size_t>(idle_time_ms),
- static_cast<size_t>(action.parameter));
- EXPECT_LT(0, action.parameter);
-}
-
-
-TEST_F(GCIdleTimeHandlerTest, IncrementalMarking2) {
- GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
- heap_state.incremental_marking_stopped = true;
- size_t speed = heap_state.incremental_marking_speed_in_bytes_per_ms;
- int idle_time_ms = 10;
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
- EXPECT_GT(speed * static_cast<size_t>(idle_time_ms),
- static_cast<size_t>(action.parameter));
- EXPECT_LT(0, action.parameter);
-}
-
-
-TEST_F(GCIdleTimeHandlerTest, NotEnoughTime) {
- GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
- heap_state.incremental_marking_stopped = true;
- heap_state.can_start_incremental_marking = false;
- size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
- int idle_time_ms = static_cast<int>(heap_state.size_of_objects / speed -
1);
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_NOTHING, action.type);
-}
-
-
-TEST_F(GCIdleTimeHandlerTest, StopEventually1) {
- GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
- heap_state.incremental_marking_stopped = true;
- heap_state.can_start_incremental_marking = false;
- size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
- int idle_time_ms = static_cast<int>(heap_state.size_of_objects / speed +
1);
- for (int i = 0; i < GCIdleTimeHandler::kMaxMarkCompactsInIdleRound; i++)
{
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_FULL_GC, action.type);
- handler()->NotifyIdleMarkCompact();
- }
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_NOTHING, action.type);
-}
-
-
-TEST_F(GCIdleTimeHandlerTest, StopEventually2) {
- GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
- int idle_time_ms = 10;
- for (int i = 0; i < GCIdleTimeHandler::kMaxMarkCompactsInIdleRound; i++)
{
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
- handler()->NotifyIdleMarkCompact();
- }
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_NOTHING, action.type);
-}
-
-
-TEST_F(GCIdleTimeHandlerTest, ContinueAfterStop1) {
- GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
- heap_state.incremental_marking_stopped = true;
- heap_state.can_start_incremental_marking = false;
- size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
- int idle_time_ms = static_cast<int>(heap_state.size_of_objects / speed +
1);
- for (int i = 0; i < GCIdleTimeHandler::kMaxMarkCompactsInIdleRound; i++)
{
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_FULL_GC, action.type);
- handler()->NotifyIdleMarkCompact();
- }
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_NOTHING, action.type);
- // Emulate mutator work.
- for (int i = 0; i < GCIdleTimeHandler::kIdleScavengeThreshold; i++) {
- handler()->NotifyScavenge();
- }
- action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_FULL_GC, action.type);
-}
-
-
-TEST_F(GCIdleTimeHandlerTest, ContinueAfterStop2) {
- GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
- int idle_time_ms = 10;
- for (int i = 0; i < GCIdleTimeHandler::kMaxMarkCompactsInIdleRound; i++)
{
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- if (action.type == DO_NOTHING) break;
- EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
- handler()->NotifyIdleMarkCompact();
- }
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_NOTHING, action.type);
- // Emulate mutator work.
- for (int i = 0; i < GCIdleTimeHandler::kIdleScavengeThreshold; i++) {
- handler()->NotifyScavenge();
- }
- action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
-}
-
-
-} // namespace internal
-} // namespace v8
=======================================
--- /branches/bleeding_edge/test/heap-unittests/heap-unittest.h Fri Aug 22
13:26:29 2014 UTC
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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.
-
-#ifndef V8_HEAP_UNITTESTS_HEAP_UNITTEST_H_
-#define V8_HEAP_UNITTESTS_HEAP_UNITTEST_H_
-
-#include "src/heap/gc-idle-time-handler.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace v8 {
-namespace internal {
-
-class GCIdleTimeHandlerTest : public ::testing::Test {
- public:
- GCIdleTimeHandlerTest() {}
- virtual ~GCIdleTimeHandlerTest() {}
-
- GCIdleTimeHandler* handler() { return &handler_; }
-
- GCIdleTimeHandler::HeapState DefaultHeapState() {
- GCIdleTimeHandler::HeapState result;
- result.contexts_disposed = 0;
- result.size_of_objects = kSizeOfObjects;
- result.incremental_marking_stopped = false;
- result.can_start_incremental_marking = true;
- result.sweeping_in_progress = false;
- result.mark_compact_speed_in_bytes_per_ms = kMarkCompactSpeed;
- result.incremental_marking_speed_in_bytes_per_ms = kMarkingSpeed;
- return result;
- }
-
- static const size_t kSizeOfObjects = 100 * MB;
- static const size_t kMarkCompactSpeed = 100 * KB;
- static const size_t kMarkingSpeed = 100 * KB;
-
- private:
- GCIdleTimeHandler handler_;
-};
-}
-}
-#endif // V8_HEAP_UNITTESTS_HEAP_UNITTEST_H_
=======================================
--- /branches/bleeding_edge/test/heap-unittests/heap-unittests.cc Tue Aug
19 10:54:54 2014 UTC
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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.
-
-#include "include/libplatform/libplatform.h"
-#include "include/v8.h"
-#include "testing/gmock/include/gmock/gmock.h"
-
-using testing::IsNull;
-using testing::NotNull;
-
-namespace {
-
-class HeapTestEnvironment V8_FINAL : public ::testing::Environment {
- public:
- HeapTestEnvironment() : platform_(NULL) {}
- virtual ~HeapTestEnvironment() {}
-
- virtual void SetUp() V8_OVERRIDE {
- EXPECT_THAT(platform_, IsNull());
- platform_ = v8::platform::CreateDefaultPlatform();
- v8::V8::InitializePlatform(platform_);
- ASSERT_TRUE(v8::V8::Initialize());
- }
-
- virtual void TearDown() V8_OVERRIDE {
- ASSERT_THAT(platform_, NotNull());
- v8::V8::Dispose();
- v8::V8::ShutdownPlatform();
- delete platform_;
- platform_ = NULL;
- }
-
- private:
- v8::Platform* platform_;
-};
-
-} // namespace
-
-
-int main(int argc, char** argv) {
- testing::InitGoogleMock(&argc, argv);
- testing::AddGlobalTestEnvironment(new HeapTestEnvironment);
- v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
- return RUN_ALL_TESTS();
-}
=======================================
--- /branches/bleeding_edge/test/heap-unittests/heap-unittests.gyp Tue Aug
19 10:54:54 2014 UTC
+++ /dev/null
@@ -1,53 +0,0 @@
-# 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.
-
-{
- 'variables': {
- 'v8_code': 1,
- },
- 'includes': ['../../build/toolchain.gypi', '../../build/features.gypi'],
- 'targets': [
- {
- 'target_name': 'heap-unittests',
- 'type': 'executable',
- 'dependencies': [
- '../../testing/gmock.gyp:gmock',
- '../../testing/gtest.gyp:gtest',
- '../../tools/gyp/v8.gyp:v8_libplatform',
- ],
- 'include_dirs': [
- '../..',
- ],
- 'sources': [ ### gcmole(all) ###
- 'heap-unittest.cc',
- 'heap-unittests.cc',
- ],
- 'conditions': [
- ['component=="shared_library"', {
- # heap-unittests can't be built against a shared library, so we
- # need to depend on the underlying static target in that case.
- 'conditions': [
- ['v8_use_snapshot=="true"', {
- 'dependencies': ['../../tools/gyp/v8.gyp:v8_snapshot'],
- },
- {
- 'dependencies': [
- '../../tools/gyp/v8.gyp:v8_nosnapshot',
- ],
- }],
- ],
- }, {
- 'dependencies': ['../../tools/gyp/v8.gyp:v8'],
- }],
- ['os_posix == 1', {
- # TODO(svenpanne): This is a temporary work-around to fix the
warnings
- # that show up because we use -std=gnu++0x instead of -std=c++11.
- 'cflags!': [
- '-pedantic',
- ],
- }],
- ],
- },
- ],
-}
=======================================
--- /branches/bleeding_edge/test/heap-unittests/heap-unittests.h Tue Aug 19
10:54:54 2014 UTC
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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.
-
-#ifndef V8_HEAP_UNITTESTS_HEAP_UNITTESTS_H_
-#define V8_HEAP_UNITTESTS_HEAP_UNITTESTS_H_
-
-#include "include/v8.h"
-#include "src/zone.h"
-#include "testing/gtest-support.h"
-
-namespace v8 {
-namespace internal {
-
-// Forward declarations.
-class Factory;
-class Heap;
-
-class RuntimeTest : public ::testing::Test {
- public:
- RuntimeTest();
- virtual ~RuntimeTest();
-
- Factory* factory() const;
- Heap* heap() const;
- Isolate* isolate() const { return reinterpret_cast<Isolate*>(isolate_); }
- Zone* zone() { return &zone_; }
-
- static void SetUpTestCase();
- static void TearDownTestCase();
-
- private:
- static v8::Isolate* isolate_;
- v8::Isolate::Scope isolate_scope_;
- v8::HandleScope handle_scope_;
- Zone zone_;
-};
-
-} // namespace internal
-} // namespace v8
-
-#endif // V8_HEAP_UNITTESTS_HEAP_UNITTESTS_H_
=======================================
--- /branches/bleeding_edge/build/all.gyp Mon Sep 1 07:13:55 2014 UTC
+++ /branches/bleeding_edge/build/all.gyp Mon Sep 1 09:12:50 2014 UTC
@@ -9,13 +9,12 @@
'type': 'none',
'dependencies': [
'../samples/samples.gyp:*',
- '../src/base/base.gyp:*',
+ '../src/base/base.gyp:base-unittests',
'../src/d8.gyp:d8',
+ '../src/heap/heap.gyp:heap-unittests',
'../src/libplatform/libplatform.gyp:libplatform-unittests',
'../test/cctest/cctest.gyp:*',
'../test/compiler-unittests/compiler-unittests.gyp:*',
- '../test/heap-unittests/heap-unittests.gyp:*',
- '../test/runtime-unittests/runtime-unittests.gyp:*',
],
'conditions': [
['component!="shared_library"', {
=======================================
--- /branches/bleeding_edge/tools/presubmit.py Mon Sep 1 07:13:55 2014 UTC
+++ /branches/bleeding_edge/tools/presubmit.py Mon Sep 1 09:12:50 2014 UTC
@@ -238,9 +238,7 @@
def GetPathsToSearch(self):
return ['src', 'include', 'samples',
join('test', 'cctest'),
- join('test', 'compiler-unittests'),
- join('test', 'heap-unittests'),
- join('test', 'runtime-unittests')]
+ join('test', 'compiler-unittests')]
def GetCpplintScript(self, prio_path):
for path in [prio_path] + os.environ["PATH"].split(os.pathsep):
=======================================
--- /branches/bleeding_edge/tools/run-tests.py Mon Sep 1 07:13:55 2014 UTC
+++ /branches/bleeding_edge/tools/run-tests.py Mon Sep 1 09:12:50 2014 UTC
@@ -52,8 +52,7 @@
ARCH_GUESS = utils.DefaultArch()
DEFAULT_TESTS = ["mjsunit", "fuzz-natives", "base-unittests",
"cctest", "compiler-unittests", "heap-unittests",
- "libplatform-unittests", "runtime-unittests",
- "message", "preparser"]
+ "libplatform-unittests", "message", "preparser"]
TIMEOUT_DEFAULT = 60
TIMEOUT_SCALEFACTOR = {"debug" : 4,
"release" : 1 }
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.