Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: test/unittests/compiler/register-allocator-unittest.cc

Issue 1018853003: [turbofan] add non fixed slot constraint to register allocator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/unittests/compiler/instruction-sequence-unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/register-allocator-unittest.cc
diff --git a/test/unittests/compiler/register-allocator-unittest.cc b/test/unittests/compiler/register-allocator-unittest.cc
index 84022c91dea6aa3434473135a40244494fc6f057..873b4ecd2aca2a240c83266058f15c65e7965e41 100644
--- a/test/unittests/compiler/register-allocator-unittest.cc
+++ b/test/unittests/compiler/register-allocator-unittest.cc
@@ -491,6 +491,87 @@ TEST_F(RegisterAllocatorTest, RegressionLoadConstantBeforeSpill) {
Allocate();
}
+
+namespace {
+
+enum class ParameterType { kFixedSlot, kSlot, kRegister, kFixedRegister };
+
+const ParameterType kParameterTypes[] = {
+ ParameterType::kFixedSlot, ParameterType::kSlot, ParameterType::kRegister,
+ ParameterType::kFixedRegister};
+
+class SlotConstraintTest : public RegisterAllocatorTest,
+ public ::testing::WithParamInterface<
+ ::testing::tuple<ParameterType, int>> {
+ public:
+ static const int kMaxVariant = 5;
+
+ protected:
+ ParameterType parameter_type() const {
+ return ::testing::get<0>(B::GetParam());
+ }
+ int variant() const { return ::testing::get<1>(B::GetParam()); }
+
+ private:
+ typedef ::testing::WithParamInterface<::testing::tuple<ParameterType, int>> B;
+};
+}
+
+
+#if GTEST_HAS_COMBINE
+
+TEST_P(SlotConstraintTest, SlotConstraint) {
+ StartBlock();
+ VReg p_0;
+ switch (parameter_type()) {
+ case ParameterType::kFixedSlot:
+ p_0 = Parameter(Slot(-1));
+ break;
+ case ParameterType::kSlot:
+ p_0 = Parameter(Slot(-1));
+ break;
+ case ParameterType::kRegister:
+ p_0 = Parameter(Reg());
+ break;
+ case ParameterType::kFixedRegister:
+ p_0 = Parameter(Reg(1));
+ break;
+ }
+ switch (variant()) {
+ case 0:
+ EmitI(Slot(p_0), Reg(p_0));
+ break;
+ case 1:
+ EmitI(Slot(p_0));
+ break;
+ case 2:
+ EmitI(Reg(p_0));
+ EmitI(Slot(p_0));
+ break;
+ case 3:
+ EmitI(Slot(p_0));
+ EmitI(Reg(p_0));
+ break;
+ case 4:
+ EmitI(Slot(p_0, -1), Slot(p_0), Reg(p_0), Reg(p_0, 1));
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+ EndBlock(Last());
+
+ Allocate();
+}
+
+
+INSTANTIATE_TEST_CASE_P(
+ RegisterAllocatorTest, SlotConstraintTest,
+ ::testing::Combine(::testing::ValuesIn(kParameterTypes),
+ ::testing::Range(0, SlotConstraintTest::kMaxVariant)));
+
+#endif // GTEST_HAS_COMBINE
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « test/unittests/compiler/instruction-sequence-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698