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_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ | 5 #ifndef V8_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ |
6 #define V8_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ | 6 #define V8_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 return !IsDouble(virtual_register) && !IsReference(virtual_register); | 136 return !IsDouble(virtual_register) && !IsReference(virtual_register); |
137 } | 137 } |
138 | 138 |
139 bool IsReference(const InstructionOperand* operand) const { | 139 bool IsReference(const InstructionOperand* operand) const { |
140 return IsReference(ToVreg(operand)); | 140 return IsReference(ToVreg(operand)); |
141 } | 141 } |
142 bool IsReference(int virtual_register) const { | 142 bool IsReference(int virtual_register) const { |
143 return references_.find(virtual_register) != references_.end(); | 143 return references_.find(virtual_register) != references_.end(); |
144 } | 144 } |
145 | 145 |
| 146 float ToFloat32(const InstructionOperand* operand) const { |
| 147 return ToConstant(operand).ToFloat32(); |
| 148 } |
| 149 |
146 int32_t ToInt32(const InstructionOperand* operand) const { | 150 int32_t ToInt32(const InstructionOperand* operand) const { |
147 return ToConstant(operand).ToInt32(); | 151 return ToConstant(operand).ToInt32(); |
148 } | 152 } |
149 | 153 |
150 int64_t ToInt64(const InstructionOperand* operand) const { | 154 int64_t ToInt64(const InstructionOperand* operand) const { |
151 return ToConstant(operand).ToInt64(); | 155 return ToConstant(operand).ToInt64(); |
152 } | 156 } |
153 | 157 |
154 int ToVreg(const InstructionOperand* operand) const { | 158 int ToVreg(const InstructionOperand* operand) const { |
155 if (operand->IsConstant()) return operand->index(); | 159 if (operand->IsConstant()) return operand->index(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 template <typename T> | 204 template <typename T> |
201 class InstructionSelectorTestWithParam | 205 class InstructionSelectorTestWithParam |
202 : public InstructionSelectorTest, | 206 : public InstructionSelectorTest, |
203 public ::testing::WithParamInterface<T> {}; | 207 public ::testing::WithParamInterface<T> {}; |
204 | 208 |
205 } // namespace compiler | 209 } // namespace compiler |
206 } // namespace internal | 210 } // namespace internal |
207 } // namespace v8 | 211 } // namespace v8 |
208 | 212 |
209 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ | 213 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ |
OLD | NEW |