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 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 139 } |
140 | 140 |
141 bool IsReference(const Node* node) const { | 141 bool IsReference(const Node* node) const { |
142 return IsReference(ToVreg(node)); | 142 return IsReference(ToVreg(node)); |
143 } | 143 } |
144 | 144 |
145 float ToFloat32(const InstructionOperand* operand) const { | 145 float ToFloat32(const InstructionOperand* operand) const { |
146 return ToConstant(operand).ToFloat32(); | 146 return ToConstant(operand).ToFloat32(); |
147 } | 147 } |
148 | 148 |
| 149 double ToFloat64(const InstructionOperand* operand) const { |
| 150 return ToConstant(operand).ToFloat64(); |
| 151 } |
| 152 |
149 int32_t ToInt32(const InstructionOperand* operand) const { | 153 int32_t ToInt32(const InstructionOperand* operand) const { |
150 return ToConstant(operand).ToInt32(); | 154 return ToConstant(operand).ToInt32(); |
151 } | 155 } |
152 | 156 |
153 int64_t ToInt64(const InstructionOperand* operand) const { | 157 int64_t ToInt64(const InstructionOperand* operand) const { |
154 return ToConstant(operand).ToInt64(); | 158 return ToConstant(operand).ToInt64(); |
155 } | 159 } |
156 | 160 |
| 161 Handle<HeapObject> ToHeapObject(const InstructionOperand* operand) const { |
| 162 return ToConstant(operand).ToHeapObject(); |
| 163 } |
| 164 |
157 int ToVreg(const InstructionOperand* operand) const { | 165 int ToVreg(const InstructionOperand* operand) const { |
158 if (operand->IsConstant()) return operand->index(); | 166 if (operand->IsConstant()) return operand->index(); |
159 EXPECT_EQ(InstructionOperand::UNALLOCATED, operand->kind()); | 167 EXPECT_EQ(InstructionOperand::UNALLOCATED, operand->kind()); |
160 return UnallocatedOperand::cast(operand)->virtual_register(); | 168 return UnallocatedOperand::cast(operand)->virtual_register(); |
161 } | 169 } |
162 | 170 |
163 int ToVreg(const Node* node) const; | 171 int ToVreg(const Node* node) const; |
164 | 172 |
165 FrameStateDescriptor* GetFrameStateDescriptor(int deoptimization_id) { | 173 FrameStateDescriptor* GetFrameStateDescriptor(int deoptimization_id) { |
166 EXPECT_LT(deoptimization_id, GetFrameStateDescriptorCount()); | 174 EXPECT_LT(deoptimization_id, GetFrameStateDescriptorCount()); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 template <typename T> | 227 template <typename T> |
220 class InstructionSelectorTestWithParam | 228 class InstructionSelectorTestWithParam |
221 : public InstructionSelectorTest, | 229 : public InstructionSelectorTest, |
222 public ::testing::WithParamInterface<T> {}; | 230 public ::testing::WithParamInterface<T> {}; |
223 | 231 |
224 } // namespace compiler | 232 } // namespace compiler |
225 } // namespace internal | 233 } // namespace internal |
226 } // namespace v8 | 234 } // namespace v8 |
227 | 235 |
228 #endif // V8_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ | 236 #endif // V8_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ |
OLD | NEW |