| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 CHECK(it != instructions_.end()); | 253 CHECK(it != instructions_.end()); |
| 254 return it->second; | 254 return it->second; |
| 255 } | 255 } |
| 256 | 256 |
| 257 | 257 |
| 258 int InstructionSequenceTest::EmitBranch(TestOperand input_op) { | 258 int InstructionSequenceTest::EmitBranch(TestOperand input_op) { |
| 259 InstructionOperand* inputs[4]{ConvertInputOp(input_op), ConvertInputOp(Imm()), | 259 InstructionOperand* inputs[4]{ConvertInputOp(input_op), ConvertInputOp(Imm()), |
| 260 ConvertInputOp(Imm()), ConvertInputOp(Imm())}; | 260 ConvertInputOp(Imm()), ConvertInputOp(Imm())}; |
| 261 InstructionCode opcode = kArchJmp | FlagsModeField::encode(kFlags_branch) | | 261 InstructionCode opcode = kArchJmp | FlagsModeField::encode(kFlags_branch) | |
| 262 FlagsConditionField::encode(kEqual); | 262 FlagsConditionField::encode(kEqual); |
| 263 auto instruction = NewInstruction(opcode, 0, nullptr, 4, inputs); | 263 auto instruction = |
| 264 NewInstruction(opcode, 0, nullptr, 4, inputs)->MarkAsControl(); |
| 264 return AddInstruction(NewIndex(), instruction); | 265 return AddInstruction(NewIndex(), instruction); |
| 265 } | 266 } |
| 266 | 267 |
| 267 | 268 |
| 268 int InstructionSequenceTest::EmitFallThrough() { | 269 int InstructionSequenceTest::EmitFallThrough() { |
| 269 auto instruction = NewInstruction(kArchNop, 0, nullptr); | 270 auto instruction = NewInstruction(kArchNop, 0, nullptr)->MarkAsControl(); |
| 270 return AddInstruction(NewIndex(), instruction); | 271 return AddInstruction(NewIndex(), instruction); |
| 271 } | 272 } |
| 272 | 273 |
| 273 | 274 |
| 274 int InstructionSequenceTest::EmitJump() { | 275 int InstructionSequenceTest::EmitJump() { |
| 275 InstructionOperand* inputs[1]{ConvertInputOp(Imm())}; | 276 InstructionOperand* inputs[1]{ConvertInputOp(Imm())}; |
| 276 auto instruction = NewInstruction(kArchJmp, 0, nullptr, 1, inputs); | 277 auto instruction = |
| 278 NewInstruction(kArchJmp, 0, nullptr, 1, inputs)->MarkAsControl(); |
| 277 return AddInstruction(NewIndex(), instruction); | 279 return AddInstruction(NewIndex(), instruction); |
| 278 } | 280 } |
| 279 | 281 |
| 280 | 282 |
| 281 Instruction* InstructionSequenceTest::NewInstruction( | 283 Instruction* InstructionSequenceTest::NewInstruction( |
| 282 InstructionCode code, size_t outputs_size, InstructionOperand** outputs, | 284 InstructionCode code, size_t outputs_size, InstructionOperand** outputs, |
| 283 size_t inputs_size, InstructionOperand** inputs, size_t temps_size, | 285 size_t inputs_size, InstructionOperand** inputs, size_t temps_size, |
| 284 InstructionOperand** temps) { | 286 InstructionOperand** temps) { |
| 285 CHECK_NE(nullptr, current_block_); | 287 CHECK_NE(nullptr, current_block_); |
| 286 return Instruction::New(zone(), code, outputs_size, outputs, inputs_size, | 288 return Instruction::New(zone(), code, outputs_size, outputs, inputs_size, |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 | 466 |
| 465 int InstructionSequenceTest::AddInstruction(int instruction_index, | 467 int InstructionSequenceTest::AddInstruction(int instruction_index, |
| 466 Instruction* instruction) { | 468 Instruction* instruction) { |
| 467 sequence()->AddInstruction(instruction); | 469 sequence()->AddInstruction(instruction); |
| 468 return instruction_index; | 470 return instruction_index; |
| 469 } | 471 } |
| 470 | 472 |
| 471 } // namespace compiler | 473 } // namespace compiler |
| 472 } // namespace internal | 474 } // namespace internal |
| 473 } // namespace v8 | 475 } // namespace v8 |
| OLD | NEW |