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

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

Issue 490673006: [turbofan] Add support for Finish to the InstructionSelector. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
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_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 <set>
10 10
11 #include "src/base/utils/random-number-generator.h" 11 #include "src/base/utils/random-number-generator.h"
12 #include "src/compiler/instruction-selector.h" 12 #include "src/compiler/instruction-selector.h"
13 #include "src/compiler/raw-machine-assembler.h" 13 #include "src/compiler/raw-machine-assembler.h"
14 #include "test/compiler-unittests/compiler-unittests.h" 14 #include "test/compiler-unittests/compiler-unittests.h"
15 15
16 namespace v8 { 16 namespace v8 {
17 namespace internal { 17 namespace internal {
18 namespace compiler { 18 namespace compiler {
19 19
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 }; 109 };
110 110
111 class Stream V8_FINAL { 111 class Stream V8_FINAL {
112 public: 112 public:
113 size_t size() const { return instructions_.size(); } 113 size_t size() const { return instructions_.size(); }
114 const Instruction* operator[](size_t index) const { 114 const Instruction* operator[](size_t index) const {
115 EXPECT_LT(index, size()); 115 EXPECT_LT(index, size());
116 return instructions_[index]; 116 return instructions_[index];
117 } 117 }
118 118
119 bool IsDouble(int virtual_register) const {
120 return doubles_.find(virtual_register) != doubles_.end();
121 }
122
123 bool IsReference(int virtual_register) const {
124 return references_.find(virtual_register) != references_.end();
125 }
126
119 int32_t ToInt32(const InstructionOperand* operand) const { 127 int32_t ToInt32(const InstructionOperand* operand) const {
120 return ToConstant(operand).ToInt32(); 128 return ToConstant(operand).ToInt32();
121 } 129 }
122 130
123 int ToVreg(const InstructionOperand* operand) const { 131 int ToVreg(const InstructionOperand* operand) const {
124 EXPECT_EQ(InstructionOperand::UNALLOCATED, operand->kind()); 132 EXPECT_EQ(InstructionOperand::UNALLOCATED, operand->kind());
125 return UnallocatedOperand::cast(operand)->virtual_register(); 133 return UnallocatedOperand::cast(operand)->virtual_register();
126 } 134 }
127 135
128 private: 136 private:
(...skipping 11 matching lines...) Expand all
140 return i->second; 148 return i->second;
141 } 149 }
142 150
143 friend class StreamBuilder; 151 friend class StreamBuilder;
144 152
145 typedef std::map<int, Constant> ConstantMap; 153 typedef std::map<int, Constant> ConstantMap;
146 154
147 ConstantMap constants_; 155 ConstantMap constants_;
148 ConstantMap immediates_; 156 ConstantMap immediates_;
149 std::deque<Instruction*> instructions_; 157 std::deque<Instruction*> instructions_;
158 std::set<int> doubles_;
159 std::set<int> references_;
150 }; 160 };
151 161
152 base::RandomNumberGenerator rng_; 162 base::RandomNumberGenerator rng_;
153 }; 163 };
154 164
155 165
156 template <typename T> 166 template <typename T>
157 class InstructionSelectorTestWithParam 167 class InstructionSelectorTestWithParam
158 : public InstructionSelectorTest, 168 : public InstructionSelectorTest,
159 public ::testing::WithParamInterface<T> {}; 169 public ::testing::WithParamInterface<T> {};
160 170
161 } // namespace compiler 171 } // namespace compiler
162 } // namespace internal 172 } // namespace internal
163 } // namespace v8 173 } // namespace v8
164 174
165 #endif // V8_COMPILER_UNITTESTS_INSTRUCTION_SELECTOR_UNITTEST_H_ 175 #endif // V8_COMPILER_UNITTESTS_INSTRUCTION_SELECTOR_UNITTEST_H_
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | test/compiler-unittests/instruction-selector-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698