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_SEQUENCE_UNITTEST_H_ | 5 #ifndef V8_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_ |
6 #define V8_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_ | 6 #define V8_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_ |
7 | 7 |
8 #include "src/compiler/instruction.h" | 8 #include "src/compiler/instruction.h" |
9 #include "test/unittests/test-utils.h" | 9 #include "test/unittests/test-utils.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 typedef std::pair<VReg, VReg> VRegPair; | 30 typedef std::pair<VReg, VReg> VRegPair; |
31 | 31 |
32 enum TestOperandType { | 32 enum TestOperandType { |
33 kInvalid, | 33 kInvalid, |
34 kSameAsFirst, | 34 kSameAsFirst, |
35 kRegister, | 35 kRegister, |
36 kFixedRegister, | 36 kFixedRegister, |
37 kSlot, | 37 kSlot, |
38 kFixedSlot, | 38 kFixedSlot, |
| 39 kExplicit, |
39 kImmediate, | 40 kImmediate, |
40 kNone, | 41 kNone, |
41 kConstant, | 42 kConstant, |
42 kUnique, | 43 kUnique, |
43 kUniqueRegister | 44 kUniqueRegister |
44 }; | 45 }; |
45 | 46 |
46 struct TestOperand { | 47 struct TestOperand { |
47 TestOperand() : type_(kInvalid), vreg_(), value_(kNoValue) {} | 48 TestOperand() : type_(kInvalid), vreg_(), value_(kNoValue) {} |
48 TestOperand(TestOperandType type, int imm) | 49 TestOperand(TestOperandType type, int imm) |
49 : type_(type), vreg_(), value_(imm) {} | 50 : type_(type), vreg_(), value_(imm) {} |
50 TestOperand(TestOperandType type, VReg vreg, int value = kNoValue) | 51 TestOperand(TestOperandType type, VReg vreg, int value = kNoValue) |
51 : type_(type), vreg_(vreg), value_(value) {} | 52 : type_(type), vreg_(vreg), value_(value) {} |
52 | 53 |
53 TestOperandType type_; | 54 TestOperandType type_; |
54 VReg vreg_; | 55 VReg vreg_; |
55 int value_; | 56 int value_; |
56 }; | 57 }; |
57 | 58 |
58 static TestOperand Same() { return TestOperand(kSameAsFirst, VReg()); } | 59 static TestOperand Same() { return TestOperand(kSameAsFirst, VReg()); } |
59 | 60 |
| 61 static TestOperand ExplicitReg(int index) { |
| 62 TestOperandType type = kExplicit; |
| 63 return TestOperand(type, VReg(), index); |
| 64 } |
| 65 |
60 static TestOperand Reg(VReg vreg, int index = kNoValue) { | 66 static TestOperand Reg(VReg vreg, int index = kNoValue) { |
61 TestOperandType type = kRegister; | 67 TestOperandType type = kRegister; |
62 if (index != kNoValue) type = kFixedRegister; | 68 if (index != kNoValue) type = kFixedRegister; |
63 return TestOperand(type, vreg, index); | 69 return TestOperand(type, vreg, index); |
64 } | 70 } |
65 | 71 |
66 static TestOperand Reg(int index = kNoValue) { return Reg(VReg(), index); } | 72 static TestOperand Reg(int index = kNoValue) { return Reg(VReg(), index); } |
67 | 73 |
68 static TestOperand Slot(VReg vreg, int index = kNoValue) { | 74 static TestOperand Slot(VReg vreg, int index = kNoValue) { |
69 TestOperandType type = kSlot; | 75 TestOperandType type = kSlot; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 LoopBlocks loop_blocks_; | 241 LoopBlocks loop_blocks_; |
236 InstructionBlock* current_block_; | 242 InstructionBlock* current_block_; |
237 bool block_returns_; | 243 bool block_returns_; |
238 }; | 244 }; |
239 | 245 |
240 } // namespace compiler | 246 } // namespace compiler |
241 } // namespace internal | 247 } // namespace internal |
242 } // namespace v8 | 248 } // namespace v8 |
243 | 249 |
244 #endif // V8_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_ | 250 #endif // V8_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_ |
OLD | NEW |