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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 } | 202 } |
203 | 203 |
204 Constant ToConstant(const InstructionOperand* operand) const { | 204 Constant ToConstant(const InstructionOperand* operand) const { |
205 ConstantMap::const_iterator i; | 205 ConstantMap::const_iterator i; |
206 if (operand->IsConstant()) { | 206 if (operand->IsConstant()) { |
207 i = constants_.find(ConstantOperand::cast(operand)->virtual_register()); | 207 i = constants_.find(ConstantOperand::cast(operand)->virtual_register()); |
208 EXPECT_EQ(ConstantOperand::cast(operand)->virtual_register(), i->first); | 208 EXPECT_EQ(ConstantOperand::cast(operand)->virtual_register(), i->first); |
209 EXPECT_FALSE(constants_.end() == i); | 209 EXPECT_FALSE(constants_.end() == i); |
210 } else { | 210 } else { |
211 EXPECT_EQ(InstructionOperand::IMMEDIATE, operand->kind()); | 211 EXPECT_EQ(InstructionOperand::IMMEDIATE, operand->kind()); |
212 i = immediates_.find(ImmediateOperand::cast(operand)->index()); | 212 auto imm = ImmediateOperand::cast(operand); |
213 EXPECT_EQ(ImmediateOperand::cast(operand)->index(), i->first); | 213 if (imm->type() == ImmediateOperand::INLINE) { |
| 214 return Constant(imm->inline_value()); |
| 215 } |
| 216 i = immediates_.find(imm->indexed_value()); |
| 217 EXPECT_EQ(imm->indexed_value(), i->first); |
214 EXPECT_FALSE(immediates_.end() == i); | 218 EXPECT_FALSE(immediates_.end() == i); |
215 } | 219 } |
216 return i->second; | 220 return i->second; |
217 } | 221 } |
218 | 222 |
219 friend class StreamBuilder; | 223 friend class StreamBuilder; |
220 | 224 |
221 typedef std::map<int, Constant> ConstantMap; | 225 typedef std::map<int, Constant> ConstantMap; |
222 typedef std::map<NodeId, int> VirtualRegisters; | 226 typedef std::map<NodeId, int> VirtualRegisters; |
223 | 227 |
(...skipping 13 matching lines...) Expand all Loading... |
237 template <typename T> | 241 template <typename T> |
238 class InstructionSelectorTestWithParam | 242 class InstructionSelectorTestWithParam |
239 : public InstructionSelectorTest, | 243 : public InstructionSelectorTest, |
240 public ::testing::WithParamInterface<T> {}; | 244 public ::testing::WithParamInterface<T> {}; |
241 | 245 |
242 } // namespace compiler | 246 } // namespace compiler |
243 } // namespace internal | 247 } // namespace internal |
244 } // namespace v8 | 248 } // namespace v8 |
245 | 249 |
246 #endif // V8_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ | 250 #endif // V8_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ |
OLD | NEW |