Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Side by Side Diff: test/unittests/compiler/instruction-selector-unittest.h

Issue 1075903002: [turbofan] support small immediates (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-jump-threading.cc ('k') | test/unittests/compiler/instruction-selector-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698