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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 auto instruction = | 278 auto instruction = |
279 NewInstruction(kArchJmp, 0, nullptr, 1, inputs)->MarkAsControl(); | 279 NewInstruction(kArchJmp, 0, nullptr, 1, inputs)->MarkAsControl(); |
280 return AddInstruction(NewIndex(), instruction); | 280 return AddInstruction(NewIndex(), instruction); |
281 } | 281 } |
282 | 282 |
283 | 283 |
284 Instruction* InstructionSequenceTest::NewInstruction( | 284 Instruction* InstructionSequenceTest::NewInstruction( |
285 InstructionCode code, size_t outputs_size, InstructionOperand** outputs, | 285 InstructionCode code, size_t outputs_size, InstructionOperand** outputs, |
286 size_t inputs_size, InstructionOperand** inputs, size_t temps_size, | 286 size_t inputs_size, InstructionOperand** inputs, size_t temps_size, |
287 InstructionOperand** temps) { | 287 InstructionOperand** temps) { |
288 CHECK_NE(nullptr, current_block_); | 288 CHECK(current_block_); |
289 return Instruction::New(zone(), code, outputs_size, outputs, inputs_size, | 289 return Instruction::New(zone(), code, outputs_size, outputs, inputs_size, |
290 inputs, temps_size, temps); | 290 inputs, temps_size, temps); |
291 } | 291 } |
292 | 292 |
293 | 293 |
294 InstructionOperand* InstructionSequenceTest::Unallocated( | 294 InstructionOperand* InstructionSequenceTest::Unallocated( |
295 TestOperand op, UnallocatedOperand::ExtendedPolicy policy) { | 295 TestOperand op, UnallocatedOperand::ExtendedPolicy policy) { |
296 auto unallocated = new (zone()) UnallocatedOperand(policy); | 296 auto unallocated = new (zone()) UnallocatedOperand(policy); |
297 unallocated->set_virtual_register(op.vreg_.value_); | 297 unallocated->set_virtual_register(op.vreg_.value_); |
298 return unallocated; | 298 return unallocated; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 auto instruction_block = new (zone()) | 412 auto instruction_block = new (zone()) |
413 InstructionBlock(zone(), block_id, rpo, loop_header, loop_end, false); | 413 InstructionBlock(zone(), block_id, rpo, loop_header, loop_end, false); |
414 instruction_blocks_.push_back(instruction_block); | 414 instruction_blocks_.push_back(instruction_block); |
415 current_block_ = instruction_block; | 415 current_block_ = instruction_block; |
416 sequence()->StartBlock(rpo); | 416 sequence()->StartBlock(rpo); |
417 return instruction_block; | 417 return instruction_block; |
418 } | 418 } |
419 | 419 |
420 | 420 |
421 void InstructionSequenceTest::WireBlocks() { | 421 void InstructionSequenceTest::WireBlocks() { |
422 CHECK_EQ(nullptr, current_block()); | 422 CHECK(!current_block()); |
423 CHECK(instruction_blocks_.size() == completions_.size()); | 423 CHECK(instruction_blocks_.size() == completions_.size()); |
424 size_t offset = 0; | 424 size_t offset = 0; |
425 for (const auto& completion : completions_) { | 425 for (const auto& completion : completions_) { |
426 switch (completion.type_) { | 426 switch (completion.type_) { |
427 case kBlockEnd: | 427 case kBlockEnd: |
428 break; | 428 break; |
429 case kFallThrough: // Fallthrough. | 429 case kFallThrough: // Fallthrough. |
430 case kJump: | 430 case kJump: |
431 WireBlock(offset, completion.offset_0_); | 431 WireBlock(offset, completion.offset_0_); |
432 break; | 432 break; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 | 467 |
468 int InstructionSequenceTest::AddInstruction(int instruction_index, | 468 int InstructionSequenceTest::AddInstruction(int instruction_index, |
469 Instruction* instruction) { | 469 Instruction* instruction) { |
470 sequence()->AddInstruction(instruction); | 470 sequence()->AddInstruction(instruction); |
471 return instruction_index; | 471 return instruction_index; |
472 } | 472 } |
473 | 473 |
474 } // namespace compiler | 474 } // namespace compiler |
475 } // namespace internal | 475 } // namespace internal |
476 } // namespace v8 | 476 } // namespace v8 |
OLD | NEW |