| Index: test/compiler-unittests/instruction-selector-unittest.h
|
| diff --git a/test/compiler-unittests/instruction-selector-unittest.h b/test/compiler-unittests/instruction-selector-unittest.h
|
| index 3a7b590757349f37f11ae5db2230ee2cba292da7..5a4273fd1266d7e39b4d404540a0b5ba9ab861b9 100644
|
| --- a/test/compiler-unittests/instruction-selector-unittest.h
|
| +++ b/test/compiler-unittests/instruction-selector-unittest.h
|
| @@ -6,7 +6,9 @@
|
| #define V8_COMPILER_UNITTESTS_INSTRUCTION_SELECTOR_UNITTEST_H_
|
|
|
| #include <deque>
|
| +#include <ostream> // NOLINT(readability/streams)
|
|
|
| +#include "src/base/utils/random-number-generator.h"
|
| #include "src/compiler/instruction-selector.h"
|
| #include "src/compiler/raw-machine-assembler.h"
|
| #include "test/compiler-unittests/compiler-unittests.h"
|
| @@ -17,9 +19,11 @@ namespace compiler {
|
|
|
| class InstructionSelectorTest : public CompilerTest {
|
| public:
|
| - InstructionSelectorTest() {}
|
| + InstructionSelectorTest();
|
| virtual ~InstructionSelectorTest() {}
|
|
|
| + base::RandomNumberGenerator* rng() { return &rng_; }
|
| +
|
| protected:
|
| class Stream;
|
|
|
| @@ -44,6 +48,14 @@ class InstructionSelectorTest : public CompilerTest {
|
| CallDescriptorBuilder(test->zone(), return_type, parameter0_type,
|
| parameter1_type)),
|
| test_(test) {}
|
| + StreamBuilder(InstructionSelectorTest* test, MachineType return_type,
|
| + MachineType parameter0_type, MachineType parameter1_type,
|
| + MachineType parameter2_type)
|
| + : RawMachineAssembler(
|
| + new (test->zone()) Graph(test->zone()),
|
| + CallDescriptorBuilder(test->zone(), return_type, parameter0_type,
|
| + parameter1_type, parameter2_type)),
|
| + test_(test) {}
|
|
|
| Stream Build(CpuFeature feature) {
|
| return Build(InstructionSelector::Features(feature));
|
| @@ -81,6 +93,17 @@ class InstructionSelectorTest : public CompilerTest {
|
| MachineCallDescriptorBuilder(return_type, 2, parameter_types);
|
| }
|
|
|
| + MachineCallDescriptorBuilder* CallDescriptorBuilder(
|
| + Zone* zone, MachineType return_type, MachineType parameter0_type,
|
| + MachineType parameter1_type, MachineType parameter2_type) {
|
| + MachineType* parameter_types = zone->NewArray<MachineType>(3);
|
| + parameter_types[0] = parameter0_type;
|
| + parameter_types[1] = parameter1_type;
|
| + parameter_types[2] = parameter2_type;
|
| + return new (zone)
|
| + MachineCallDescriptorBuilder(return_type, 3, parameter_types);
|
| + }
|
| +
|
| private:
|
| InstructionSelectorTest* test_;
|
| };
|
| @@ -97,6 +120,11 @@ class InstructionSelectorTest : public CompilerTest {
|
| return ToConstant(operand).ToInt32();
|
| }
|
|
|
| + int ToVreg(const InstructionOperand* operand) const {
|
| + EXPECT_EQ(InstructionOperand::UNALLOCATED, operand->kind());
|
| + return UnallocatedOperand::cast(operand)->virtual_register();
|
| + }
|
| +
|
| private:
|
| Constant ToConstant(const InstructionOperand* operand) const {
|
| ConstantMap::const_iterator i;
|
| @@ -120,8 +148,16 @@ class InstructionSelectorTest : public CompilerTest {
|
| ConstantMap immediates_;
|
| std::deque<Instruction*> instructions_;
|
| };
|
| +
|
| + base::RandomNumberGenerator rng_;
|
| };
|
|
|
| +
|
| +template <typename T>
|
| +class InstructionSelectorTestWithParam
|
| + : public InstructionSelectorTest,
|
| + public ::testing::WithParamInterface<T> {};
|
| +
|
| } // namespace compiler
|
| } // namespace internal
|
| } // namespace v8
|
|
|