| 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
|
|
|