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