OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ | 5 #ifndef V8_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ |
6 #define V8_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ | 6 #define V8_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "src/base/utils/random-number-generator.h" | 11 #include "src/base/utils/random-number-generator.h" |
12 #include "src/compiler/instruction-selector.h" | 12 #include "src/compiler/instruction-selector.h" |
13 #include "src/compiler/raw-machine-assembler.h" | 13 #include "src/compiler/raw-machine-assembler.h" |
14 #include "src/macro-assembler.h" | 14 #include "src/macro-assembler.h" |
15 #include "test/unittests/test-utils.h" | 15 #include "test/unittests/test-utils.h" |
16 | 16 |
17 namespace v8 { | 17 namespace v8 { |
18 namespace internal { | 18 namespace internal { |
19 namespace compiler { | 19 namespace compiler { |
20 | 20 |
21 class InstructionSelectorTest : public TestWithContext, | 21 class InstructionSelectorTest : public TestWithContext, |
22 public TestWithIsolateAndZone { | 22 public TestWithIsolateAndZone { |
23 public: | 23 public: |
24 InstructionSelectorTest(); | 24 InstructionSelectorTest(); |
25 ~InstructionSelectorTest() OVERRIDE; | 25 ~InstructionSelectorTest() override; |
26 | 26 |
27 base::RandomNumberGenerator* rng() { return &rng_; } | 27 base::RandomNumberGenerator* rng() { return &rng_; } |
28 | 28 |
29 class Stream; | 29 class Stream; |
30 | 30 |
31 enum StreamBuilderMode { | 31 enum StreamBuilderMode { |
32 kAllInstructions, | 32 kAllInstructions, |
33 kTargetInstructions, | 33 kTargetInstructions, |
34 kAllExceptNopInstructions | 34 kAllExceptNopInstructions |
35 }; | 35 }; |
36 | 36 |
37 class StreamBuilder FINAL : public RawMachineAssembler { | 37 class StreamBuilder final : public RawMachineAssembler { |
38 public: | 38 public: |
39 StreamBuilder(InstructionSelectorTest* test, MachineType return_type) | 39 StreamBuilder(InstructionSelectorTest* test, MachineType return_type) |
40 : RawMachineAssembler(test->isolate(), | 40 : RawMachineAssembler(test->isolate(), |
41 new (test->zone()) Graph(test->zone()), | 41 new (test->zone()) Graph(test->zone()), |
42 MakeMachineSignature(test->zone(), return_type)), | 42 MakeMachineSignature(test->zone(), return_type)), |
43 test_(test) {} | 43 test_(test) {} |
44 StreamBuilder(InstructionSelectorTest* test, MachineType return_type, | 44 StreamBuilder(InstructionSelectorTest* test, MachineType return_type, |
45 MachineType parameter0_type) | 45 MachineType parameter0_type) |
46 : RawMachineAssembler( | 46 : RawMachineAssembler( |
47 test->isolate(), new (test->zone()) Graph(test->zone()), | 47 test->isolate(), new (test->zone()) Graph(test->zone()), |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 builder.AddParam(parameter0_type); | 110 builder.AddParam(parameter0_type); |
111 builder.AddParam(parameter1_type); | 111 builder.AddParam(parameter1_type); |
112 builder.AddParam(parameter2_type); | 112 builder.AddParam(parameter2_type); |
113 return builder.Build(); | 113 return builder.Build(); |
114 } | 114 } |
115 | 115 |
116 private: | 116 private: |
117 InstructionSelectorTest* test_; | 117 InstructionSelectorTest* test_; |
118 }; | 118 }; |
119 | 119 |
120 class Stream FINAL { | 120 class Stream final { |
121 public: | 121 public: |
122 size_t size() const { return instructions_.size(); } | 122 size_t size() const { return instructions_.size(); } |
123 const Instruction* operator[](size_t index) const { | 123 const Instruction* operator[](size_t index) const { |
124 EXPECT_LT(index, size()); | 124 EXPECT_LT(index, size()); |
125 return instructions_[index]; | 125 return instructions_[index]; |
126 } | 126 } |
127 | 127 |
128 bool IsDouble(const InstructionOperand* operand) const { | 128 bool IsDouble(const InstructionOperand* operand) const { |
129 return IsDouble(ToVreg(operand)); | 129 return IsDouble(ToVreg(operand)); |
130 } | 130 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 template <typename T> | 241 template <typename T> |
242 class InstructionSelectorTestWithParam | 242 class InstructionSelectorTestWithParam |
243 : public InstructionSelectorTest, | 243 : public InstructionSelectorTest, |
244 public ::testing::WithParamInterface<T> {}; | 244 public ::testing::WithParamInterface<T> {}; |
245 | 245 |
246 } // namespace compiler | 246 } // namespace compiler |
247 } // namespace internal | 247 } // namespace internal |
248 } // namespace v8 | 248 } // namespace v8 |
249 | 249 |
250 #endif // V8_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ | 250 #endif // V8_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ |
OLD | NEW |