Commit 9564d803 authored by mtrofin's avatar mtrofin Committed by Commit bot

Move register allocation unittests and constrain owners

There are subtle test expectations/nuances that are easy to break.

BUG=

Review-Url: https://codereview.chromium.org/2585583006
Cr-Commit-Position: refs/heads/master@{#41778}
parent 8e833623
...@@ -63,13 +63,11 @@ v8_executable("unittests") { ...@@ -63,13 +63,11 @@ v8_executable("unittests") {
"compiler/js-typed-lowering-unittest.cc", "compiler/js-typed-lowering-unittest.cc",
"compiler/linkage-tail-call-unittest.cc", "compiler/linkage-tail-call-unittest.cc",
"compiler/live-range-builder.h", "compiler/live-range-builder.h",
"compiler/live-range-unittest.cc",
"compiler/liveness-analyzer-unittest.cc", "compiler/liveness-analyzer-unittest.cc",
"compiler/load-elimination-unittest.cc", "compiler/load-elimination-unittest.cc",
"compiler/loop-peeling-unittest.cc", "compiler/loop-peeling-unittest.cc",
"compiler/machine-operator-reducer-unittest.cc", "compiler/machine-operator-reducer-unittest.cc",
"compiler/machine-operator-unittest.cc", "compiler/machine-operator-unittest.cc",
"compiler/move-optimizer-unittest.cc",
"compiler/node-cache-unittest.cc", "compiler/node-cache-unittest.cc",
"compiler/node-matchers-unittest.cc", "compiler/node-matchers-unittest.cc",
"compiler/node-properties-unittest.cc", "compiler/node-properties-unittest.cc",
...@@ -77,7 +75,9 @@ v8_executable("unittests") { ...@@ -77,7 +75,9 @@ v8_executable("unittests") {
"compiler/node-test-utils.h", "compiler/node-test-utils.h",
"compiler/node-unittest.cc", "compiler/node-unittest.cc",
"compiler/opcodes-unittest.cc", "compiler/opcodes-unittest.cc",
"compiler/register-allocator-unittest.cc", "compiler/regalloc/live-range-unittest.cc",
"compiler/regalloc/move-optimizer-unittest.cc",
"compiler/regalloc/register-allocator-unittest.cc",
"compiler/schedule-unittest.cc", "compiler/schedule-unittest.cc",
"compiler/scheduler-rpo-unittest.cc", "compiler/scheduler-rpo-unittest.cc",
"compiler/scheduler-unittest.cc", "compiler/scheduler-unittest.cc",
......
set noparent
bmeurer@chromium.org
jarin@chromium.org
mtrofin@chromium.org
\ No newline at end of file
...@@ -2,11 +2,9 @@ ...@@ -2,11 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "test/unittests/compiler/live-range-builder.h" #include "test/unittests/compiler/live-range-builder.h"
#include "test/unittests/test-utils.h" #include "test/unittests/test-utils.h"
// TODO(mtrofin): would we want to centralize this definition? // TODO(mtrofin): would we want to centralize this definition?
#ifdef DEBUG #ifdef DEBUG
#define V8_ASSERT_DEBUG_DEATH(statement, regex) \ #define V8_ASSERT_DEBUG_DEATH(statement, regex) \
...@@ -29,7 +27,6 @@ class LiveRangeUnitTest : public TestWithZone { ...@@ -29,7 +27,6 @@ class LiveRangeUnitTest : public TestWithZone {
return range->SplitAt(LifetimePosition::FromInt(pos), zone()); return range->SplitAt(LifetimePosition::FromInt(pos), zone());
} }
TopLevelLiveRange* Splinter(TopLevelLiveRange* top, int start, int end, TopLevelLiveRange* Splinter(TopLevelLiveRange* top, int start, int end,
int new_id = 0) { int new_id = 0) {
if (top->splinter() == nullptr) { if (top->splinter() == nullptr) {
...@@ -70,7 +67,6 @@ class LiveRangeUnitTest : public TestWithZone { ...@@ -70,7 +67,6 @@ class LiveRangeUnitTest : public TestWithZone {
} }
}; };
TEST_F(LiveRangeUnitTest, InvalidConstruction) { TEST_F(LiveRangeUnitTest, InvalidConstruction) {
// Build a range manually, because the builder guards against empty cases. // Build a range manually, because the builder guards against empty cases.
TopLevelLiveRange* range = TopLevelLiveRange* range =
...@@ -81,31 +77,26 @@ TEST_F(LiveRangeUnitTest, InvalidConstruction) { ...@@ -81,31 +77,26 @@ TEST_F(LiveRangeUnitTest, InvalidConstruction) {
".*"); ".*");
} }
TEST_F(LiveRangeUnitTest, SplitInvalidStart) { TEST_F(LiveRangeUnitTest, SplitInvalidStart) {
TopLevelLiveRange* range = TestRangeBuilder(zone()).Build(0, 1); TopLevelLiveRange* range = TestRangeBuilder(zone()).Build(0, 1);
V8_ASSERT_DEBUG_DEATH(Split(range, 0), ".*"); V8_ASSERT_DEBUG_DEATH(Split(range, 0), ".*");
} }
TEST_F(LiveRangeUnitTest, DISABLE_IN_RELEASE(InvalidSplitEnd)) { TEST_F(LiveRangeUnitTest, DISABLE_IN_RELEASE(InvalidSplitEnd)) {
TopLevelLiveRange* range = TestRangeBuilder(zone()).Build(0, 1); TopLevelLiveRange* range = TestRangeBuilder(zone()).Build(0, 1);
ASSERT_DEATH_IF_SUPPORTED(Split(range, 1), ".*"); ASSERT_DEATH_IF_SUPPORTED(Split(range, 1), ".*");
} }
TEST_F(LiveRangeUnitTest, DISABLE_IN_RELEASE(SplitInvalidPreStart)) { TEST_F(LiveRangeUnitTest, DISABLE_IN_RELEASE(SplitInvalidPreStart)) {
TopLevelLiveRange* range = TestRangeBuilder(zone()).Build(1, 2); TopLevelLiveRange* range = TestRangeBuilder(zone()).Build(1, 2);
ASSERT_DEATH_IF_SUPPORTED(Split(range, 0), ".*"); ASSERT_DEATH_IF_SUPPORTED(Split(range, 0), ".*");
} }
TEST_F(LiveRangeUnitTest, DISABLE_IN_RELEASE(SplitInvalidPostEnd)) { TEST_F(LiveRangeUnitTest, DISABLE_IN_RELEASE(SplitInvalidPostEnd)) {
TopLevelLiveRange* range = TestRangeBuilder(zone()).Build(0, 1); TopLevelLiveRange* range = TestRangeBuilder(zone()).Build(0, 1);
ASSERT_DEATH_IF_SUPPORTED(Split(range, 2), ".*"); ASSERT_DEATH_IF_SUPPORTED(Split(range, 2), ".*");
} }
TEST_F(LiveRangeUnitTest, SplitSingleIntervalNoUsePositions) { TEST_F(LiveRangeUnitTest, SplitSingleIntervalNoUsePositions) {
TopLevelLiveRange* range = TestRangeBuilder(zone()).Build(0, 2); TopLevelLiveRange* range = TestRangeBuilder(zone()).Build(0, 2);
LiveRange* child = Split(range, 1); LiveRange* child = Split(range, 1);
...@@ -119,7 +110,6 @@ TEST_F(LiveRangeUnitTest, SplitSingleIntervalNoUsePositions) { ...@@ -119,7 +110,6 @@ TEST_F(LiveRangeUnitTest, SplitSingleIntervalNoUsePositions) {
EXPECT_TRUE(RangesMatch(expected_bottom, child)); EXPECT_TRUE(RangesMatch(expected_bottom, child));
} }
TEST_F(LiveRangeUnitTest, SplitManyIntervalNoUsePositionsBetween) { TEST_F(LiveRangeUnitTest, SplitManyIntervalNoUsePositionsBetween) {
TopLevelLiveRange* range = TopLevelLiveRange* range =
TestRangeBuilder(zone()).Add(0, 2).Add(4, 6).Build(); TestRangeBuilder(zone()).Add(0, 2).Add(4, 6).Build();
...@@ -134,7 +124,6 @@ TEST_F(LiveRangeUnitTest, SplitManyIntervalNoUsePositionsBetween) { ...@@ -134,7 +124,6 @@ TEST_F(LiveRangeUnitTest, SplitManyIntervalNoUsePositionsBetween) {
EXPECT_TRUE(RangesMatch(expected_bottom, child)); EXPECT_TRUE(RangesMatch(expected_bottom, child));
} }
TEST_F(LiveRangeUnitTest, SplitManyIntervalNoUsePositionsFront) { TEST_F(LiveRangeUnitTest, SplitManyIntervalNoUsePositionsFront) {
TopLevelLiveRange* range = TopLevelLiveRange* range =
TestRangeBuilder(zone()).Add(0, 2).Add(4, 6).Build(); TestRangeBuilder(zone()).Add(0, 2).Add(4, 6).Build();
...@@ -150,7 +139,6 @@ TEST_F(LiveRangeUnitTest, SplitManyIntervalNoUsePositionsFront) { ...@@ -150,7 +139,6 @@ TEST_F(LiveRangeUnitTest, SplitManyIntervalNoUsePositionsFront) {
EXPECT_TRUE(RangesMatch(expected_bottom, child)); EXPECT_TRUE(RangesMatch(expected_bottom, child));
} }
TEST_F(LiveRangeUnitTest, SplitManyIntervalNoUsePositionsAfter) { TEST_F(LiveRangeUnitTest, SplitManyIntervalNoUsePositionsAfter) {
TopLevelLiveRange* range = TopLevelLiveRange* range =
TestRangeBuilder(zone()).Add(0, 2).Add(4, 6).Build(); TestRangeBuilder(zone()).Add(0, 2).Add(4, 6).Build();
...@@ -166,7 +154,6 @@ TEST_F(LiveRangeUnitTest, SplitManyIntervalNoUsePositionsAfter) { ...@@ -166,7 +154,6 @@ TEST_F(LiveRangeUnitTest, SplitManyIntervalNoUsePositionsAfter) {
EXPECT_TRUE(RangesMatch(expected_bottom, child)); EXPECT_TRUE(RangesMatch(expected_bottom, child));
} }
TEST_F(LiveRangeUnitTest, SplitSingleIntervalUsePositions) { TEST_F(LiveRangeUnitTest, SplitSingleIntervalUsePositions) {
TopLevelLiveRange* range = TopLevelLiveRange* range =
TestRangeBuilder(zone()).Add(0, 3).AddUse(0).AddUse(2).Build(); TestRangeBuilder(zone()).Add(0, 3).AddUse(0).AddUse(2).Build();
...@@ -184,7 +171,6 @@ TEST_F(LiveRangeUnitTest, SplitSingleIntervalUsePositions) { ...@@ -184,7 +171,6 @@ TEST_F(LiveRangeUnitTest, SplitSingleIntervalUsePositions) {
EXPECT_TRUE(RangesMatch(expected_bottom, child)); EXPECT_TRUE(RangesMatch(expected_bottom, child));
} }
TEST_F(LiveRangeUnitTest, SplitSingleIntervalUsePositionsAtPos) { TEST_F(LiveRangeUnitTest, SplitSingleIntervalUsePositionsAtPos) {
TopLevelLiveRange* range = TopLevelLiveRange* range =
TestRangeBuilder(zone()).Add(0, 3).AddUse(0).AddUse(2).Build(); TestRangeBuilder(zone()).Add(0, 3).AddUse(0).AddUse(2).Build();
...@@ -201,7 +187,6 @@ TEST_F(LiveRangeUnitTest, SplitSingleIntervalUsePositionsAtPos) { ...@@ -201,7 +187,6 @@ TEST_F(LiveRangeUnitTest, SplitSingleIntervalUsePositionsAtPos) {
EXPECT_TRUE(RangesMatch(expected_bottom, child)); EXPECT_TRUE(RangesMatch(expected_bottom, child));
} }
TEST_F(LiveRangeUnitTest, SplitManyIntervalUsePositionsBetween) { TEST_F(LiveRangeUnitTest, SplitManyIntervalUsePositionsBetween) {
TopLevelLiveRange* range = TopLevelLiveRange* range =
TestRangeBuilder(zone()).Add(0, 2).Add(4, 6).AddUse(1).AddUse(5).Build(); TestRangeBuilder(zone()).Add(0, 2).Add(4, 6).AddUse(1).AddUse(5).Build();
...@@ -218,7 +203,6 @@ TEST_F(LiveRangeUnitTest, SplitManyIntervalUsePositionsBetween) { ...@@ -218,7 +203,6 @@ TEST_F(LiveRangeUnitTest, SplitManyIntervalUsePositionsBetween) {
EXPECT_TRUE(RangesMatch(expected_bottom, child)); EXPECT_TRUE(RangesMatch(expected_bottom, child));
} }
TEST_F(LiveRangeUnitTest, SplitManyIntervalUsePositionsAtInterval) { TEST_F(LiveRangeUnitTest, SplitManyIntervalUsePositionsAtInterval) {
TopLevelLiveRange* range = TopLevelLiveRange* range =
TestRangeBuilder(zone()).Add(0, 2).Add(4, 6).AddUse(1).AddUse(4).Build(); TestRangeBuilder(zone()).Add(0, 2).Add(4, 6).AddUse(1).AddUse(4).Build();
...@@ -235,7 +219,6 @@ TEST_F(LiveRangeUnitTest, SplitManyIntervalUsePositionsAtInterval) { ...@@ -235,7 +219,6 @@ TEST_F(LiveRangeUnitTest, SplitManyIntervalUsePositionsAtInterval) {
EXPECT_TRUE(RangesMatch(expected_bottom, child)); EXPECT_TRUE(RangesMatch(expected_bottom, child));
} }
TEST_F(LiveRangeUnitTest, SplitManyIntervalUsePositionsFront) { TEST_F(LiveRangeUnitTest, SplitManyIntervalUsePositionsFront) {
TopLevelLiveRange* range = TopLevelLiveRange* range =
TestRangeBuilder(zone()).Add(0, 2).Add(4, 6).AddUse(1).AddUse(5).Build(); TestRangeBuilder(zone()).Add(0, 2).Add(4, 6).AddUse(1).AddUse(5).Build();
...@@ -252,7 +235,6 @@ TEST_F(LiveRangeUnitTest, SplitManyIntervalUsePositionsFront) { ...@@ -252,7 +235,6 @@ TEST_F(LiveRangeUnitTest, SplitManyIntervalUsePositionsFront) {
EXPECT_TRUE(RangesMatch(expected_bottom, child)); EXPECT_TRUE(RangesMatch(expected_bottom, child));
} }
TEST_F(LiveRangeUnitTest, SplitManyIntervalUsePositionsAfter) { TEST_F(LiveRangeUnitTest, SplitManyIntervalUsePositionsAfter) {
TopLevelLiveRange* range = TopLevelLiveRange* range =
TestRangeBuilder(zone()).Add(0, 2).Add(4, 6).AddUse(1).AddUse(5).Build(); TestRangeBuilder(zone()).Add(0, 2).Add(4, 6).AddUse(1).AddUse(5).Build();
...@@ -268,7 +250,6 @@ TEST_F(LiveRangeUnitTest, SplitManyIntervalUsePositionsAfter) { ...@@ -268,7 +250,6 @@ TEST_F(LiveRangeUnitTest, SplitManyIntervalUsePositionsAfter) {
EXPECT_TRUE(RangesMatch(expected_bottom, child)); EXPECT_TRUE(RangesMatch(expected_bottom, child));
} }
TEST_F(LiveRangeUnitTest, SplinterSingleInterval) { TEST_F(LiveRangeUnitTest, SplinterSingleInterval) {
TopLevelLiveRange* range = TestRangeBuilder(zone()).Build(0, 6); TopLevelLiveRange* range = TestRangeBuilder(zone()).Build(0, 6);
TopLevelLiveRange* splinter = Splinter(range, 3, 5); TopLevelLiveRange* splinter = Splinter(range, 3, 5);
...@@ -283,7 +264,6 @@ TEST_F(LiveRangeUnitTest, SplinterSingleInterval) { ...@@ -283,7 +264,6 @@ TEST_F(LiveRangeUnitTest, SplinterSingleInterval) {
EXPECT_TRUE(RangesMatch(expected_splinter, splinter)); EXPECT_TRUE(RangesMatch(expected_splinter, splinter));
} }
TEST_F(LiveRangeUnitTest, MergeSingleInterval) { TEST_F(LiveRangeUnitTest, MergeSingleInterval) {
TopLevelLiveRange* original = TestRangeBuilder(zone()).Build(0, 6); TopLevelLiveRange* original = TestRangeBuilder(zone()).Build(0, 6);
TopLevelLiveRange* splinter = Splinter(original, 3, 5); TopLevelLiveRange* splinter = Splinter(original, 3, 5);
...@@ -296,7 +276,6 @@ TEST_F(LiveRangeUnitTest, MergeSingleInterval) { ...@@ -296,7 +276,6 @@ TEST_F(LiveRangeUnitTest, MergeSingleInterval) {
EXPECT_TRUE(RangesMatch(result, original)); EXPECT_TRUE(RangesMatch(result, original));
} }
TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsOutside) { TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsOutside) {
TopLevelLiveRange* range = TopLevelLiveRange* range =
TestRangeBuilder(zone()).Add(0, 3).Add(5, 8).Build(); TestRangeBuilder(zone()).Add(0, 3).Add(5, 8).Build();
...@@ -313,7 +292,6 @@ TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsOutside) { ...@@ -313,7 +292,6 @@ TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsOutside) {
EXPECT_TRUE(RangesMatch(expected_splinter, splinter)); EXPECT_TRUE(RangesMatch(expected_splinter, splinter));
} }
TEST_F(LiveRangeUnitTest, MergeMultipleIntervalsOutside) { TEST_F(LiveRangeUnitTest, MergeMultipleIntervalsOutside) {
TopLevelLiveRange* original = TopLevelLiveRange* original =
TestRangeBuilder(zone()).Add(0, 3).Add(5, 8).Build(); TestRangeBuilder(zone()).Add(0, 3).Add(5, 8).Build();
...@@ -327,14 +305,12 @@ TEST_F(LiveRangeUnitTest, MergeMultipleIntervalsOutside) { ...@@ -327,14 +305,12 @@ TEST_F(LiveRangeUnitTest, MergeMultipleIntervalsOutside) {
EXPECT_TRUE(RangesMatch(result, original)); EXPECT_TRUE(RangesMatch(result, original));
} }
TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsInside) { TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsInside) {
TopLevelLiveRange* range = TopLevelLiveRange* range =
TestRangeBuilder(zone()).Add(0, 3).Add(5, 8).Build(); TestRangeBuilder(zone()).Add(0, 3).Add(5, 8).Build();
V8_ASSERT_DEBUG_DEATH(Splinter(range, 3, 5), ".*"); V8_ASSERT_DEBUG_DEATH(Splinter(range, 3, 5), ".*");
} }
TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsLeft) { TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsLeft) {
TopLevelLiveRange* range = TopLevelLiveRange* range =
TestRangeBuilder(zone()).Add(0, 3).Add(5, 8).Build(); TestRangeBuilder(zone()).Add(0, 3).Add(5, 8).Build();
...@@ -350,7 +326,6 @@ TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsLeft) { ...@@ -350,7 +326,6 @@ TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsLeft) {
EXPECT_TRUE(RangesMatch(expected_splinter, splinter)); EXPECT_TRUE(RangesMatch(expected_splinter, splinter));
} }
TEST_F(LiveRangeUnitTest, MergeMultipleIntervalsLeft) { TEST_F(LiveRangeUnitTest, MergeMultipleIntervalsLeft) {
TopLevelLiveRange* original = TopLevelLiveRange* original =
TestRangeBuilder(zone()).Add(0, 3).Add(5, 8).Build(); TestRangeBuilder(zone()).Add(0, 3).Add(5, 8).Build();
...@@ -363,7 +338,6 @@ TEST_F(LiveRangeUnitTest, MergeMultipleIntervalsLeft) { ...@@ -363,7 +338,6 @@ TEST_F(LiveRangeUnitTest, MergeMultipleIntervalsLeft) {
EXPECT_TRUE(RangesMatch(result, original)); EXPECT_TRUE(RangesMatch(result, original));
} }
TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsRight) { TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsRight) {
TopLevelLiveRange* range = TopLevelLiveRange* range =
TestRangeBuilder(zone()).Add(0, 3).Add(5, 8).Build(); TestRangeBuilder(zone()).Add(0, 3).Add(5, 8).Build();
...@@ -379,7 +353,6 @@ TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsRight) { ...@@ -379,7 +353,6 @@ TEST_F(LiveRangeUnitTest, SplinterMultipleIntervalsRight) {
EXPECT_TRUE(RangesMatch(expected_splinter, splinter)); EXPECT_TRUE(RangesMatch(expected_splinter, splinter));
} }
TEST_F(LiveRangeUnitTest, SplinterMergeMultipleTimes) { TEST_F(LiveRangeUnitTest, SplinterMergeMultipleTimes) {
TopLevelLiveRange* range = TopLevelLiveRange* range =
TestRangeBuilder(zone()).Add(0, 3).Add(5, 10).Add(12, 16).Build(); TestRangeBuilder(zone()).Add(0, 3).Add(5, 10).Add(12, 16).Build();
...@@ -398,7 +371,6 @@ TEST_F(LiveRangeUnitTest, SplinterMergeMultipleTimes) { ...@@ -398,7 +371,6 @@ TEST_F(LiveRangeUnitTest, SplinterMergeMultipleTimes) {
EXPECT_TRUE(RangesMatch(expected_splinter, splinter)); EXPECT_TRUE(RangesMatch(expected_splinter, splinter));
} }
TEST_F(LiveRangeUnitTest, MergeMultipleIntervalsRight) { TEST_F(LiveRangeUnitTest, MergeMultipleIntervalsRight) {
TopLevelLiveRange* original = TopLevelLiveRange* original =
TestRangeBuilder(zone()).Add(0, 3).Add(5, 8).Build(); TestRangeBuilder(zone()).Add(0, 3).Add(5, 8).Build();
...@@ -413,7 +385,6 @@ TEST_F(LiveRangeUnitTest, MergeMultipleIntervalsRight) { ...@@ -413,7 +385,6 @@ TEST_F(LiveRangeUnitTest, MergeMultipleIntervalsRight) {
EXPECT_TRUE(RangesMatch(result, original)); EXPECT_TRUE(RangesMatch(result, original));
} }
TEST_F(LiveRangeUnitTest, MergeAfterSplitting) { TEST_F(LiveRangeUnitTest, MergeAfterSplitting) {
TopLevelLiveRange* original = TestRangeBuilder(zone()).Build(0, 8); TopLevelLiveRange* original = TestRangeBuilder(zone()).Build(0, 8);
TopLevelLiveRange* splinter = Splinter(original, 4, 6); TopLevelLiveRange* splinter = Splinter(original, 4, 6);
...@@ -430,7 +401,6 @@ TEST_F(LiveRangeUnitTest, MergeAfterSplitting) { ...@@ -430,7 +401,6 @@ TEST_F(LiveRangeUnitTest, MergeAfterSplitting) {
EXPECT_TRUE(RangesMatch(result, original)); EXPECT_TRUE(RangesMatch(result, original));
} }
TEST_F(LiveRangeUnitTest, IDGeneration) { TEST_F(LiveRangeUnitTest, IDGeneration) {
TopLevelLiveRange* vreg = TestRangeBuilder(zone()).Id(2).Build(0, 100); TopLevelLiveRange* vreg = TestRangeBuilder(zone()).Id(2).Build(0, 100);
EXPECT_EQ(2, vreg->vreg()); EXPECT_EQ(2, vreg->vreg());
......
...@@ -98,7 +98,6 @@ class MoveOptimizerTest : public InstructionSequenceTest { ...@@ -98,7 +98,6 @@ class MoveOptimizerTest : public InstructionSequenceTest {
} }
}; };
TEST_F(MoveOptimizerTest, RemovesRedundant) { TEST_F(MoveOptimizerTest, RemovesRedundant) {
StartBlock(); StartBlock();
auto first_instr = EmitNop(); auto first_instr = EmitNop();
...@@ -127,7 +126,6 @@ TEST_F(MoveOptimizerTest, RemovesRedundant) { ...@@ -127,7 +126,6 @@ TEST_F(MoveOptimizerTest, RemovesRedundant) {
CHECK(Contains(move, FPReg(kF32_1, kFloat32), FPReg(kF32_2, kFloat32))); CHECK(Contains(move, FPReg(kF32_1, kFloat32), FPReg(kF32_2, kFloat32)));
} }
TEST_F(MoveOptimizerTest, RemovesRedundantExplicit) { TEST_F(MoveOptimizerTest, RemovesRedundantExplicit) {
int index1 = GetAllocatableCode(0); int index1 = GetAllocatableCode(0);
int index2 = GetAllocatableCode(1); int index2 = GetAllocatableCode(1);
...@@ -167,7 +165,6 @@ TEST_F(MoveOptimizerTest, RemovesRedundantExplicit) { ...@@ -167,7 +165,6 @@ TEST_F(MoveOptimizerTest, RemovesRedundantExplicit) {
CHECK(Contains(move, FPReg(f32_1, kFloat32), ExplicitFPReg(f32_2, kFloat32))); CHECK(Contains(move, FPReg(f32_1, kFloat32), ExplicitFPReg(f32_2, kFloat32)));
} }
TEST_F(MoveOptimizerTest, SplitsConstants) { TEST_F(MoveOptimizerTest, SplitsConstants) {
StartBlock(); StartBlock();
EndBlock(Last()); EndBlock(Last());
...@@ -191,7 +188,6 @@ TEST_F(MoveOptimizerTest, SplitsConstants) { ...@@ -191,7 +188,6 @@ TEST_F(MoveOptimizerTest, SplitsConstants) {
CHECK(Contains(move, Reg(0), Slot(2))); CHECK(Contains(move, Reg(0), Slot(2)));
} }
TEST_F(MoveOptimizerTest, SimpleMerge) { TEST_F(MoveOptimizerTest, SimpleMerge) {
StartBlock(); StartBlock();
EndBlock(Branch(Imm(), 1, 2)); EndBlock(Branch(Imm(), 1, 2));
...@@ -227,7 +223,6 @@ TEST_F(MoveOptimizerTest, SimpleMerge) { ...@@ -227,7 +223,6 @@ TEST_F(MoveOptimizerTest, SimpleMerge) {
CHECK(Contains(move, FPReg(kF32_1, kFloat32), FPReg(kF32_2, kFloat32))); CHECK(Contains(move, FPReg(kF32_1, kFloat32), FPReg(kF32_2, kFloat32)));
} }
TEST_F(MoveOptimizerTest, SimpleMergeCycle) { TEST_F(MoveOptimizerTest, SimpleMergeCycle) {
StartBlock(); StartBlock();
EndBlock(Branch(Imm(), 1, 2)); EndBlock(Branch(Imm(), 1, 2));
...@@ -279,7 +274,6 @@ TEST_F(MoveOptimizerTest, SimpleMergeCycle) { ...@@ -279,7 +274,6 @@ TEST_F(MoveOptimizerTest, SimpleMergeCycle) {
CHECK(Contains(move, FPReg(kF32_2, kFloat32), FPReg(kF32_1, kFloat32))); CHECK(Contains(move, FPReg(kF32_2, kFloat32), FPReg(kF32_1, kFloat32)));
} }
TEST_F(MoveOptimizerTest, GapsCanMoveOverInstruction) { TEST_F(MoveOptimizerTest, GapsCanMoveOverInstruction) {
StartBlock(); StartBlock();
int const_index = 1; int const_index = 1;
...@@ -317,7 +311,6 @@ TEST_F(MoveOptimizerTest, GapsCanMoveOverInstruction) { ...@@ -317,7 +311,6 @@ TEST_F(MoveOptimizerTest, GapsCanMoveOverInstruction) {
CHECK_EQ(1, assignment); CHECK_EQ(1, assignment);
} }
TEST_F(MoveOptimizerTest, SubsetMovesMerge) { TEST_F(MoveOptimizerTest, SubsetMovesMerge) {
StartBlock(); StartBlock();
EndBlock(Branch(Imm(), 1, 2)); EndBlock(Branch(Imm(), 1, 2));
...@@ -354,7 +347,6 @@ TEST_F(MoveOptimizerTest, SubsetMovesMerge) { ...@@ -354,7 +347,6 @@ TEST_F(MoveOptimizerTest, SubsetMovesMerge) {
CHECK(Contains(b2_move, Reg(4), Reg(5))); CHECK(Contains(b2_move, Reg(4), Reg(5)));
} }
TEST_F(MoveOptimizerTest, GapConflictSubsetMovesDoNotMerge) { TEST_F(MoveOptimizerTest, GapConflictSubsetMovesDoNotMerge) {
StartBlock(); StartBlock();
EndBlock(Branch(Imm(), 1, 2)); EndBlock(Branch(Imm(), 1, 2));
......
...@@ -9,7 +9,6 @@ namespace v8 { ...@@ -9,7 +9,6 @@ namespace v8 {
namespace internal { namespace internal {
namespace compiler { namespace compiler {
namespace { namespace {
// We can't just use the size of the moves collection, because of // We can't just use the size of the moves collection, because of
...@@ -23,7 +22,6 @@ int GetMoveCount(const ParallelMove& moves) { ...@@ -23,7 +22,6 @@ int GetMoveCount(const ParallelMove& moves) {
return move_count; return move_count;
} }
bool AreOperandsOfSameType( bool AreOperandsOfSameType(
const AllocatedOperand& op, const AllocatedOperand& op,
const InstructionSequenceTest::TestOperand& test_op) { const InstructionSequenceTest::TestOperand& test_op) {
...@@ -36,7 +34,6 @@ bool AreOperandsOfSameType( ...@@ -36,7 +34,6 @@ bool AreOperandsOfSameType(
(op.IsStackSlot() && !test_op_is_reg); (op.IsStackSlot() && !test_op_is_reg);
} }
bool AllocatedOperandMatches( bool AllocatedOperandMatches(
const AllocatedOperand& op, const AllocatedOperand& op,
const InstructionSequenceTest::TestOperand& test_op) { const InstructionSequenceTest::TestOperand& test_op) {
...@@ -46,7 +43,6 @@ bool AllocatedOperandMatches( ...@@ -46,7 +43,6 @@ bool AllocatedOperandMatches(
test_op.value_ == InstructionSequenceTest::kNoValue); test_op.value_ == InstructionSequenceTest::kNoValue);
} }
int GetParallelMoveCount(int instr_index, Instruction::GapPosition gap_pos, int GetParallelMoveCount(int instr_index, Instruction::GapPosition gap_pos,
const InstructionSequence* sequence) { const InstructionSequence* sequence) {
const ParallelMove* moves = const ParallelMove* moves =
...@@ -55,7 +51,6 @@ int GetParallelMoveCount(int instr_index, Instruction::GapPosition gap_pos, ...@@ -55,7 +51,6 @@ int GetParallelMoveCount(int instr_index, Instruction::GapPosition gap_pos,
return GetMoveCount(*moves); return GetMoveCount(*moves);
} }
bool IsParallelMovePresent(int instr_index, Instruction::GapPosition gap_pos, bool IsParallelMovePresent(int instr_index, Instruction::GapPosition gap_pos,
const InstructionSequence* sequence, const InstructionSequence* sequence,
const InstructionSequenceTest::TestOperand& src, const InstructionSequenceTest::TestOperand& src,
...@@ -79,7 +74,6 @@ bool IsParallelMovePresent(int instr_index, Instruction::GapPosition gap_pos, ...@@ -79,7 +74,6 @@ bool IsParallelMovePresent(int instr_index, Instruction::GapPosition gap_pos,
} // namespace } // namespace
class RegisterAllocatorTest : public InstructionSequenceTest { class RegisterAllocatorTest : public InstructionSequenceTest {
public: public:
void Allocate() { void Allocate() {
...@@ -88,7 +82,6 @@ class RegisterAllocatorTest : public InstructionSequenceTest { ...@@ -88,7 +82,6 @@ class RegisterAllocatorTest : public InstructionSequenceTest {
} }
}; };
TEST_F(RegisterAllocatorTest, CanAllocateThreeRegisters) { TEST_F(RegisterAllocatorTest, CanAllocateThreeRegisters) {
// return p0 + p1; // return p0 + p1;
StartBlock(); StartBlock();
...@@ -136,7 +129,6 @@ TEST_F(RegisterAllocatorTest, SimpleLoop) { ...@@ -136,7 +129,6 @@ TEST_F(RegisterAllocatorTest, SimpleLoop) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, SimpleBranch) { TEST_F(RegisterAllocatorTest, SimpleBranch) {
// return i ? K1 : K2 // return i ? K1 : K2
StartBlock(); StartBlock();
...@@ -154,7 +146,6 @@ TEST_F(RegisterAllocatorTest, SimpleBranch) { ...@@ -154,7 +146,6 @@ TEST_F(RegisterAllocatorTest, SimpleBranch) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, SimpleDiamond) { TEST_F(RegisterAllocatorTest, SimpleDiamond) {
// return p0 ? p0 : p0 // return p0 ? p0 : p0
StartBlock(); StartBlock();
...@@ -174,7 +165,6 @@ TEST_F(RegisterAllocatorTest, SimpleDiamond) { ...@@ -174,7 +165,6 @@ TEST_F(RegisterAllocatorTest, SimpleDiamond) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, SimpleDiamondPhi) { TEST_F(RegisterAllocatorTest, SimpleDiamondPhi) {
// return i ? K1 : K2 // return i ? K1 : K2
StartBlock(); StartBlock();
...@@ -195,7 +185,6 @@ TEST_F(RegisterAllocatorTest, SimpleDiamondPhi) { ...@@ -195,7 +185,6 @@ TEST_F(RegisterAllocatorTest, SimpleDiamondPhi) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, DiamondManyPhis) { TEST_F(RegisterAllocatorTest, DiamondManyPhis) {
const int kPhis = kDefaultNRegs * 2; const int kPhis = kDefaultNRegs * 2;
...@@ -227,7 +216,6 @@ TEST_F(RegisterAllocatorTest, DiamondManyPhis) { ...@@ -227,7 +216,6 @@ TEST_F(RegisterAllocatorTest, DiamondManyPhis) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, DoubleDiamondManyRedundantPhis) { TEST_F(RegisterAllocatorTest, DoubleDiamondManyRedundantPhis) {
const int kPhis = kDefaultNRegs * 2; const int kPhis = kDefaultNRegs * 2;
...@@ -266,7 +254,6 @@ TEST_F(RegisterAllocatorTest, DoubleDiamondManyRedundantPhis) { ...@@ -266,7 +254,6 @@ TEST_F(RegisterAllocatorTest, DoubleDiamondManyRedundantPhis) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, RegressionPhisNeedTooManyRegisters) { TEST_F(RegisterAllocatorTest, RegressionPhisNeedTooManyRegisters) {
const size_t kNumRegs = 3; const size_t kNumRegs = 3;
const size_t kParams = kNumRegs + 1; const size_t kParams = kNumRegs + 1;
...@@ -315,7 +302,6 @@ TEST_F(RegisterAllocatorTest, RegressionPhisNeedTooManyRegisters) { ...@@ -315,7 +302,6 @@ TEST_F(RegisterAllocatorTest, RegressionPhisNeedTooManyRegisters) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, SpillPhi) { TEST_F(RegisterAllocatorTest, SpillPhi) {
StartBlock(); StartBlock();
EndBlock(Branch(Imm(), 1, 2)); EndBlock(Branch(Imm(), 1, 2));
...@@ -337,7 +323,6 @@ TEST_F(RegisterAllocatorTest, SpillPhi) { ...@@ -337,7 +323,6 @@ TEST_F(RegisterAllocatorTest, SpillPhi) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, MoveLotsOfConstants) { TEST_F(RegisterAllocatorTest, MoveLotsOfConstants) {
StartBlock(); StartBlock();
VReg constants[kDefaultNRegs]; VReg constants[kDefaultNRegs];
...@@ -357,7 +342,6 @@ TEST_F(RegisterAllocatorTest, MoveLotsOfConstants) { ...@@ -357,7 +342,6 @@ TEST_F(RegisterAllocatorTest, MoveLotsOfConstants) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, SplitBeforeInstruction) { TEST_F(RegisterAllocatorTest, SplitBeforeInstruction) {
const int kNumRegs = 6; const int kNumRegs = 6;
SetNumRegs(kNumRegs, kNumRegs); SetNumRegs(kNumRegs, kNumRegs);
...@@ -383,7 +367,6 @@ TEST_F(RegisterAllocatorTest, SplitBeforeInstruction) { ...@@ -383,7 +367,6 @@ TEST_F(RegisterAllocatorTest, SplitBeforeInstruction) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, SplitBeforeInstruction2) { TEST_F(RegisterAllocatorTest, SplitBeforeInstruction2) {
const int kNumRegs = 6; const int kNumRegs = 6;
SetNumRegs(kNumRegs, kNumRegs); SetNumRegs(kNumRegs, kNumRegs);
...@@ -408,7 +391,6 @@ TEST_F(RegisterAllocatorTest, SplitBeforeInstruction2) { ...@@ -408,7 +391,6 @@ TEST_F(RegisterAllocatorTest, SplitBeforeInstruction2) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, NestedDiamondPhiMerge) { TEST_F(RegisterAllocatorTest, NestedDiamondPhiMerge) {
// Outer diamond. // Outer diamond.
StartBlock(); StartBlock();
...@@ -455,7 +437,6 @@ TEST_F(RegisterAllocatorTest, NestedDiamondPhiMerge) { ...@@ -455,7 +437,6 @@ TEST_F(RegisterAllocatorTest, NestedDiamondPhiMerge) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, NestedDiamondPhiMergeDifferent) { TEST_F(RegisterAllocatorTest, NestedDiamondPhiMergeDifferent) {
// Outer diamond. // Outer diamond.
StartBlock(); StartBlock();
...@@ -502,7 +483,6 @@ TEST_F(RegisterAllocatorTest, NestedDiamondPhiMergeDifferent) { ...@@ -502,7 +483,6 @@ TEST_F(RegisterAllocatorTest, NestedDiamondPhiMergeDifferent) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, RegressionSplitBeforeAndMove) { TEST_F(RegisterAllocatorTest, RegressionSplitBeforeAndMove) {
StartBlock(); StartBlock();
...@@ -529,7 +509,6 @@ TEST_F(RegisterAllocatorTest, RegressionSplitBeforeAndMove) { ...@@ -529,7 +509,6 @@ TEST_F(RegisterAllocatorTest, RegressionSplitBeforeAndMove) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, RegressionSpillTwice) { TEST_F(RegisterAllocatorTest, RegressionSpillTwice) {
StartBlock(); StartBlock();
auto p_0 = Parameter(Reg(1)); auto p_0 = Parameter(Reg(1));
...@@ -539,7 +518,6 @@ TEST_F(RegisterAllocatorTest, RegressionSpillTwice) { ...@@ -539,7 +518,6 @@ TEST_F(RegisterAllocatorTest, RegressionSpillTwice) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, RegressionLoadConstantBeforeSpill) { TEST_F(RegisterAllocatorTest, RegressionLoadConstantBeforeSpill) {
StartBlock(); StartBlock();
// Fill registers. // Fill registers.
...@@ -574,7 +552,6 @@ TEST_F(RegisterAllocatorTest, RegressionLoadConstantBeforeSpill) { ...@@ -574,7 +552,6 @@ TEST_F(RegisterAllocatorTest, RegressionLoadConstantBeforeSpill) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, DiamondWithCallFirstBlock) { TEST_F(RegisterAllocatorTest, DiamondWithCallFirstBlock) {
StartBlock(); StartBlock();
auto x = EmitOI(Reg(0)); auto x = EmitOI(Reg(0));
...@@ -595,7 +572,6 @@ TEST_F(RegisterAllocatorTest, DiamondWithCallFirstBlock) { ...@@ -595,7 +572,6 @@ TEST_F(RegisterAllocatorTest, DiamondWithCallFirstBlock) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, DiamondWithCallSecondBlock) { TEST_F(RegisterAllocatorTest, DiamondWithCallSecondBlock) {
StartBlock(); StartBlock();
auto x = EmitOI(Reg(0)); auto x = EmitOI(Reg(0));
...@@ -616,7 +592,6 @@ TEST_F(RegisterAllocatorTest, DiamondWithCallSecondBlock) { ...@@ -616,7 +592,6 @@ TEST_F(RegisterAllocatorTest, DiamondWithCallSecondBlock) {
Allocate(); Allocate();
} }
TEST_F(RegisterAllocatorTest, SingleDeferredBlockSpill) { TEST_F(RegisterAllocatorTest, SingleDeferredBlockSpill) {
StartBlock(); // B0 StartBlock(); // B0
auto var = EmitOI(Reg(0)); auto var = EmitOI(Reg(0));
...@@ -655,7 +630,6 @@ TEST_F(RegisterAllocatorTest, SingleDeferredBlockSpill) { ...@@ -655,7 +630,6 @@ TEST_F(RegisterAllocatorTest, SingleDeferredBlockSpill) {
sequence(), Reg(0), Slot(0))); sequence(), Reg(0), Slot(0)));
} }
TEST_F(RegisterAllocatorTest, MultipleDeferredBlockSpills) { TEST_F(RegisterAllocatorTest, MultipleDeferredBlockSpills) {
if (!FLAG_turbo_preprocess_ranges) return; if (!FLAG_turbo_preprocess_ranges) return;
...@@ -706,12 +680,10 @@ TEST_F(RegisterAllocatorTest, MultipleDeferredBlockSpills) { ...@@ -706,12 +680,10 @@ TEST_F(RegisterAllocatorTest, MultipleDeferredBlockSpills) {
EXPECT_TRUE(IsParallelMovePresent(end_of_b2, Instruction::START, sequence(), EXPECT_TRUE(IsParallelMovePresent(end_of_b2, Instruction::START, sequence(),
Slot(var3_slot), Reg())); Slot(var3_slot), Reg()));
EXPECT_EQ(0, EXPECT_EQ(0,
GetParallelMoveCount(start_of_b3, Instruction::START, sequence())); GetParallelMoveCount(start_of_b3, Instruction::START, sequence()));
} }
namespace { namespace {
enum class ParameterType { kFixedSlot, kSlot, kRegister, kFixedRegister }; enum class ParameterType { kFixedSlot, kSlot, kRegister, kFixedRegister };
...@@ -738,7 +710,6 @@ class SlotConstraintTest : public RegisterAllocatorTest, ...@@ -738,7 +710,6 @@ class SlotConstraintTest : public RegisterAllocatorTest,
} // namespace } // namespace
#if GTEST_HAS_COMBINE #if GTEST_HAS_COMBINE
TEST_P(SlotConstraintTest, SlotConstraint) { TEST_P(SlotConstraintTest, SlotConstraint) {
...@@ -785,7 +756,6 @@ TEST_P(SlotConstraintTest, SlotConstraint) { ...@@ -785,7 +756,6 @@ TEST_P(SlotConstraintTest, SlotConstraint) {
Allocate(); Allocate();
} }
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
RegisterAllocatorTest, SlotConstraintTest, RegisterAllocatorTest, SlotConstraintTest,
::testing::Combine(::testing::ValuesIn(kParameterTypes), ::testing::Combine(::testing::ValuesIn(kParameterTypes),
......
...@@ -57,12 +57,12 @@ ...@@ -57,12 +57,12 @@
'compiler/linkage-tail-call-unittest.cc', 'compiler/linkage-tail-call-unittest.cc',
'compiler/liveness-analyzer-unittest.cc', 'compiler/liveness-analyzer-unittest.cc',
'compiler/live-range-builder.h', 'compiler/live-range-builder.h',
'compiler/live-range-unittest.cc', 'compiler/regalloc/live-range-unittest.cc',
'compiler/load-elimination-unittest.cc', 'compiler/load-elimination-unittest.cc',
'compiler/loop-peeling-unittest.cc', 'compiler/loop-peeling-unittest.cc',
'compiler/machine-operator-reducer-unittest.cc', 'compiler/machine-operator-reducer-unittest.cc',
'compiler/machine-operator-unittest.cc', 'compiler/machine-operator-unittest.cc',
'compiler/move-optimizer-unittest.cc', 'compiler/regalloc/move-optimizer-unittest.cc',
'compiler/node-cache-unittest.cc', 'compiler/node-cache-unittest.cc',
'compiler/node-matchers-unittest.cc', 'compiler/node-matchers-unittest.cc',
'compiler/node-properties-unittest.cc', 'compiler/node-properties-unittest.cc',
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
'compiler/node-test-utils.h', 'compiler/node-test-utils.h',
'compiler/node-unittest.cc', 'compiler/node-unittest.cc',
'compiler/opcodes-unittest.cc', 'compiler/opcodes-unittest.cc',
'compiler/register-allocator-unittest.cc', 'compiler/regalloc/register-allocator-unittest.cc',
'compiler/schedule-unittest.cc', 'compiler/schedule-unittest.cc',
'compiler/scheduler-unittest.cc', 'compiler/scheduler-unittest.cc',
'compiler/scheduler-rpo-unittest.cc', 'compiler/scheduler-rpo-unittest.cc',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment