| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 { | 146 float ToFloat32(const InstructionOperand* operand) const { |
| 147 return ToConstant(operand).ToFloat32(); | 147 return ToConstant(operand).ToFloat32(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 double ToFloat64(const InstructionOperand* operand) const { |
| 151 return ToConstant(operand).ToFloat64(); |
| 152 } |
| 153 |
| 150 int32_t ToInt32(const InstructionOperand* operand) const { | 154 int32_t ToInt32(const InstructionOperand* operand) const { |
| 151 return ToConstant(operand).ToInt32(); | 155 return ToConstant(operand).ToInt32(); |
| 152 } | 156 } |
| 153 | 157 |
| 154 int64_t ToInt64(const InstructionOperand* operand) const { | 158 int64_t ToInt64(const InstructionOperand* operand) const { |
| 155 return ToConstant(operand).ToInt64(); | 159 return ToConstant(operand).ToInt64(); |
| 156 } | 160 } |
| 157 | 161 |
| 162 Handle<HeapObject> ToHeapObject(const InstructionOperand* operand) const { |
| 163 return ToConstant(operand).ToHeapObject(); |
| 164 } |
| 165 |
| 158 int ToVreg(const InstructionOperand* operand) const { | 166 int ToVreg(const InstructionOperand* operand) const { |
| 159 if (operand->IsConstant()) return operand->index(); | 167 if (operand->IsConstant()) return operand->index(); |
| 160 EXPECT_EQ(InstructionOperand::UNALLOCATED, operand->kind()); | 168 EXPECT_EQ(InstructionOperand::UNALLOCATED, operand->kind()); |
| 161 return UnallocatedOperand::cast(operand)->virtual_register(); | 169 return UnallocatedOperand::cast(operand)->virtual_register(); |
| 162 } | 170 } |
| 163 | 171 |
| 164 FrameStateDescriptor* GetFrameStateDescriptor(int deoptimization_id) { | 172 FrameStateDescriptor* GetFrameStateDescriptor(int deoptimization_id) { |
| 165 EXPECT_LT(deoptimization_id, GetFrameStateDescriptorCount()); | 173 EXPECT_LT(deoptimization_id, GetFrameStateDescriptorCount()); |
| 166 return deoptimization_entries_[deoptimization_id]; | 174 return deoptimization_entries_[deoptimization_id]; |
| 167 } | 175 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 template <typename T> | 212 template <typename T> |
| 205 class InstructionSelectorTestWithParam | 213 class InstructionSelectorTestWithParam |
| 206 : public InstructionSelectorTest, | 214 : public InstructionSelectorTest, |
| 207 public ::testing::WithParamInterface<T> {}; | 215 public ::testing::WithParamInterface<T> {}; |
| 208 | 216 |
| 209 } // namespace compiler | 217 } // namespace compiler |
| 210 } // namespace internal | 218 } // namespace internal |
| 211 } // namespace v8 | 219 } // namespace v8 |
| 212 | 220 |
| 213 #endif // V8_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ | 221 #endif // V8_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ |
| OLD | NEW |