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_UNITTESTS_INSTRUCTION_SELECTOR_UNITTEST_H_ | 5 #ifndef V8_COMPILER_UNITTESTS_INSTRUCTION_SELECTOR_UNITTEST_H_ |
6 #define V8_COMPILER_UNITTESTS_INSTRUCTION_SELECTOR_UNITTEST_H_ | 6 #define V8_COMPILER_UNITTESTS_INSTRUCTION_SELECTOR_UNITTEST_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <ostream> // NOLINT(readability/streams) | 9 #include <ostream> // NOLINT(readability/streams) |
10 | 10 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 int ToVreg(const InstructionOperand* operand) const { | 123 int ToVreg(const InstructionOperand* operand) const { |
124 EXPECT_EQ(InstructionOperand::UNALLOCATED, operand->kind()); | 124 EXPECT_EQ(InstructionOperand::UNALLOCATED, operand->kind()); |
125 return UnallocatedOperand::cast(operand)->virtual_register(); | 125 return UnallocatedOperand::cast(operand)->virtual_register(); |
126 } | 126 } |
127 | 127 |
128 private: | 128 private: |
129 Constant ToConstant(const InstructionOperand* operand) const { | 129 Constant ToConstant(const InstructionOperand* operand) const { |
130 ConstantMap::const_iterator i; | 130 ConstantMap::const_iterator i; |
131 if (operand->IsConstant()) { | 131 if (operand->IsConstant()) { |
132 i = constants_.find(operand->index()); | 132 i = constants_.find(operand->index()); |
133 EXPECT_NE(constants_.end(), i); | 133 EXPECT_FALSE(constants_.end() == i); |
134 } else { | 134 } else { |
135 EXPECT_EQ(InstructionOperand::IMMEDIATE, operand->kind()); | 135 EXPECT_EQ(InstructionOperand::IMMEDIATE, operand->kind()); |
136 i = immediates_.find(operand->index()); | 136 i = immediates_.find(operand->index()); |
137 EXPECT_NE(immediates_.end(), i); | 137 EXPECT_FALSE(immediates_.end() == i); |
138 } | 138 } |
139 EXPECT_EQ(operand->index(), i->first); | 139 EXPECT_EQ(operand->index(), i->first); |
140 return i->second; | 140 return i->second; |
141 } | 141 } |
142 | 142 |
143 friend class StreamBuilder; | 143 friend class StreamBuilder; |
144 | 144 |
145 typedef std::map<int, Constant> ConstantMap; | 145 typedef std::map<int, Constant> ConstantMap; |
146 | 146 |
147 ConstantMap constants_; | 147 ConstantMap constants_; |
148 ConstantMap immediates_; | 148 ConstantMap immediates_; |
149 std::deque<Instruction*> instructions_; | 149 std::deque<Instruction*> instructions_; |
150 }; | 150 }; |
151 | 151 |
152 base::RandomNumberGenerator rng_; | 152 base::RandomNumberGenerator rng_; |
153 }; | 153 }; |
154 | 154 |
155 | 155 |
156 template <typename T> | 156 template <typename T> |
157 class InstructionSelectorTestWithParam | 157 class InstructionSelectorTestWithParam |
158 : public InstructionSelectorTest, | 158 : public InstructionSelectorTest, |
159 public ::testing::WithParamInterface<T> {}; | 159 public ::testing::WithParamInterface<T> {}; |
160 | 160 |
161 } // namespace compiler | 161 } // namespace compiler |
162 } // namespace internal | 162 } // namespace internal |
163 } // namespace v8 | 163 } // namespace v8 |
164 | 164 |
165 #endif // V8_COMPILER_UNITTESTS_INSTRUCTION_SELECTOR_UNITTEST_H_ | 165 #endif // V8_COMPILER_UNITTESTS_INSTRUCTION_SELECTOR_UNITTEST_H_ |
OLD | NEW |