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 #include "src/base/utils/random-number-generator.h" | 5 #include "src/base/utils/random-number-generator.h" |
6 #include "src/compiler/pipeline.h" | 6 #include "src/compiler/pipeline.h" |
7 #include "test/unittests/compiler/instruction-sequence-unittest.h" | 7 #include "test/unittests/compiler/instruction-sequence-unittest.h" |
8 #include "test/unittests/test-utils.h" | 8 #include "test/unittests/test-utils.h" |
9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
10 | 10 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 TestOperand inputs[] = {input_op_0, input_op_1, input_op_2, input_op_3}; | 283 TestOperand inputs[] = {input_op_0, input_op_1, input_op_2, input_op_3}; |
284 return EmitCall(output_op, CountInputs(arraysize(inputs), inputs), inputs); | 284 return EmitCall(output_op, CountInputs(arraysize(inputs), inputs), inputs); |
285 } | 285 } |
286 | 286 |
287 | 287 |
288 Instruction* InstructionSequenceTest::EmitBranch(TestOperand input_op) { | 288 Instruction* InstructionSequenceTest::EmitBranch(TestOperand input_op) { |
289 InstructionOperand inputs[4]{ConvertInputOp(input_op), ConvertInputOp(Imm()), | 289 InstructionOperand inputs[4]{ConvertInputOp(input_op), ConvertInputOp(Imm()), |
290 ConvertInputOp(Imm()), ConvertInputOp(Imm())}; | 290 ConvertInputOp(Imm()), ConvertInputOp(Imm())}; |
291 InstructionCode opcode = kArchJmp | FlagsModeField::encode(kFlags_branch) | | 291 InstructionCode opcode = kArchJmp | FlagsModeField::encode(kFlags_branch) | |
292 FlagsConditionField::encode(kEqual); | 292 FlagsConditionField::encode(kEqual); |
293 auto instruction = | 293 auto instruction = NewInstruction(opcode, 0, nullptr, 4, inputs); |
294 NewInstruction(opcode, 0, nullptr, 4, inputs)->MarkAsControl(); | |
295 return AddInstruction(instruction); | 294 return AddInstruction(instruction); |
296 } | 295 } |
297 | 296 |
298 | 297 |
299 Instruction* InstructionSequenceTest::EmitFallThrough() { | 298 Instruction* InstructionSequenceTest::EmitFallThrough() { |
300 auto instruction = NewInstruction(kArchNop, 0, nullptr)->MarkAsControl(); | 299 auto instruction = NewInstruction(kArchNop, 0, nullptr); |
301 return AddInstruction(instruction); | 300 return AddInstruction(instruction); |
302 } | 301 } |
303 | 302 |
304 | 303 |
305 Instruction* InstructionSequenceTest::EmitJump() { | 304 Instruction* InstructionSequenceTest::EmitJump() { |
306 InstructionOperand inputs[1]{ConvertInputOp(Imm())}; | 305 InstructionOperand inputs[1]{ConvertInputOp(Imm())}; |
307 auto instruction = | 306 auto instruction = NewInstruction(kArchJmp, 0, nullptr, 1, inputs); |
308 NewInstruction(kArchJmp, 0, nullptr, 1, inputs)->MarkAsControl(); | |
309 return AddInstruction(instruction); | 307 return AddInstruction(instruction); |
310 } | 308 } |
311 | 309 |
312 | 310 |
313 Instruction* InstructionSequenceTest::NewInstruction( | 311 Instruction* InstructionSequenceTest::NewInstruction( |
314 InstructionCode code, size_t outputs_size, InstructionOperand* outputs, | 312 InstructionCode code, size_t outputs_size, InstructionOperand* outputs, |
315 size_t inputs_size, InstructionOperand* inputs, size_t temps_size, | 313 size_t inputs_size, InstructionOperand* inputs, size_t temps_size, |
316 InstructionOperand* temps) { | 314 InstructionOperand* temps) { |
317 CHECK(current_block_); | 315 CHECK(current_block_); |
318 return Instruction::New(zone(), code, outputs_size, outputs, inputs_size, | 316 return Instruction::New(zone(), code, outputs_size, outputs, inputs_size, |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 | 484 |
487 | 485 |
488 Instruction* InstructionSequenceTest::AddInstruction(Instruction* instruction) { | 486 Instruction* InstructionSequenceTest::AddInstruction(Instruction* instruction) { |
489 sequence()->AddInstruction(instruction); | 487 sequence()->AddInstruction(instruction); |
490 return instruction; | 488 return instruction; |
491 } | 489 } |
492 | 490 |
493 } // namespace compiler | 491 } // namespace compiler |
494 } // namespace internal | 492 } // namespace internal |
495 } // namespace v8 | 493 } // namespace v8 |
OLD | NEW |