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_SEQUENCE_UNITTEST_H_ | 5 #ifndef V8_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_ |
6 #define V8_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_ | 6 #define V8_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_ |
7 | 7 |
8 #include "src/compiler/instruction.h" | 8 #include "src/compiler/instruction.h" |
9 #include "test/unittests/test-utils.h" | 9 #include "test/unittests/test-utils.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 private: | 172 private: |
173 VReg NewReg() { return VReg(sequence()->NextVirtualRegister()); } | 173 VReg NewReg() { return VReg(sequence()->NextVirtualRegister()); } |
174 int NewIndex() { return current_instruction_index_--; } | 174 int NewIndex() { return current_instruction_index_--; } |
175 | 175 |
176 static TestOperand Invalid() { return TestOperand(kInvalid, VReg()); } | 176 static TestOperand Invalid() { return TestOperand(kInvalid, VReg()); } |
177 | 177 |
178 int EmitBranch(TestOperand input_op); | 178 int EmitBranch(TestOperand input_op); |
179 int EmitFallThrough(); | 179 int EmitFallThrough(); |
180 int EmitJump(); | 180 int EmitJump(); |
181 Instruction* NewInstruction(InstructionCode code, size_t outputs_size, | 181 Instruction* NewInstruction(InstructionCode code, size_t outputs_size, |
182 InstructionOperand** outputs, | 182 InstructionOperand* outputs, |
183 size_t inputs_size = 0, | 183 size_t inputs_size = 0, |
184 InstructionOperand* *inputs = nullptr, | 184 InstructionOperand* inputs = nullptr, |
185 size_t temps_size = 0, | 185 size_t temps_size = 0, |
186 InstructionOperand* *temps = nullptr); | 186 InstructionOperand* temps = nullptr); |
187 InstructionOperand* Unallocated(TestOperand op, | 187 InstructionOperand Unallocated(TestOperand op, |
188 UnallocatedOperand::ExtendedPolicy policy); | 188 UnallocatedOperand::ExtendedPolicy policy); |
189 InstructionOperand* Unallocated(TestOperand op, | 189 InstructionOperand Unallocated(TestOperand op, |
190 UnallocatedOperand::ExtendedPolicy policy, | 190 UnallocatedOperand::ExtendedPolicy policy, |
191 UnallocatedOperand::Lifetime lifetime); | 191 UnallocatedOperand::Lifetime lifetime); |
192 InstructionOperand* Unallocated(TestOperand op, | 192 InstructionOperand Unallocated(TestOperand op, |
193 UnallocatedOperand::ExtendedPolicy policy, | 193 UnallocatedOperand::ExtendedPolicy policy, |
194 int index); | 194 int index); |
195 InstructionOperand* Unallocated(TestOperand op, | 195 InstructionOperand Unallocated(TestOperand op, |
196 UnallocatedOperand::BasicPolicy policy, | 196 UnallocatedOperand::BasicPolicy policy, |
197 int index); | 197 int index); |
198 InstructionOperand** ConvertInputs(size_t input_size, TestOperand* inputs); | 198 InstructionOperand* ConvertInputs(size_t input_size, TestOperand* inputs); |
199 InstructionOperand* ConvertInputOp(TestOperand op); | 199 InstructionOperand ConvertInputOp(TestOperand op); |
200 InstructionOperand* ConvertOutputOp(VReg vreg, TestOperand op); | 200 InstructionOperand ConvertOutputOp(VReg vreg, TestOperand op); |
201 InstructionBlock* NewBlock(); | 201 InstructionBlock* NewBlock(); |
202 void WireBlock(size_t block_offset, int jump_offset); | 202 void WireBlock(size_t block_offset, int jump_offset); |
203 | 203 |
204 int Emit(int instruction_index, InstructionCode code, size_t outputs_size = 0, | 204 int Emit(int instruction_index, InstructionCode code, size_t outputs_size = 0, |
205 InstructionOperand* *outputs = nullptr, size_t inputs_size = 0, | 205 InstructionOperand* outputs = nullptr, size_t inputs_size = 0, |
206 InstructionOperand* *inputs = nullptr, size_t temps_size = 0, | 206 InstructionOperand* inputs = nullptr, size_t temps_size = 0, |
207 InstructionOperand* *temps = nullptr, bool is_call = false); | 207 InstructionOperand* temps = nullptr, bool is_call = false); |
208 | 208 |
209 int AddInstruction(int instruction_index, Instruction* instruction); | 209 int AddInstruction(int instruction_index, Instruction* instruction); |
210 | 210 |
211 struct LoopData { | 211 struct LoopData { |
212 Rpo loop_header_; | 212 Rpo loop_header_; |
213 int expected_blocks_; | 213 int expected_blocks_; |
214 }; | 214 }; |
215 | 215 |
216 typedef std::vector<LoopData> LoopBlocks; | 216 typedef std::vector<LoopData> LoopBlocks; |
217 typedef std::map<int, const Instruction*> Instructions; | 217 typedef std::map<int, const Instruction*> Instructions; |
(...skipping 12 matching lines...) Expand all Loading... |
230 LoopBlocks loop_blocks_; | 230 LoopBlocks loop_blocks_; |
231 InstructionBlock* current_block_; | 231 InstructionBlock* current_block_; |
232 bool block_returns_; | 232 bool block_returns_; |
233 }; | 233 }; |
234 | 234 |
235 } // namespace compiler | 235 } // namespace compiler |
236 } // namespace internal | 236 } // namespace internal |
237 } // namespace v8 | 237 } // namespace v8 |
238 | 238 |
239 #endif // V8_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_ | 239 #endif // V8_UNITTESTS_COMPILER_INSTRUCTION_SEQUENCE_UNITTEST_H_ |
OLD | NEW |