Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: test/unittests/compiler/instruction-sequence-unittest.cc

Issue 951553005: [turbofan] remove dependence of InstructionBlock on BasicBlock (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/unittests/compiler/instruction-sequence-unittest.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 default: 403 default:
404 break; 404 break;
405 } 405 }
406 CHECK(false); 406 CHECK(false);
407 return InstructionOperand(); 407 return InstructionOperand();
408 } 408 }
409 409
410 410
411 InstructionBlock* InstructionSequenceTest::NewBlock() { 411 InstructionBlock* InstructionSequenceTest::NewBlock() {
412 CHECK(current_block_ == nullptr); 412 CHECK(current_block_ == nullptr);
413 auto block_id = BasicBlock::Id::FromSize(instruction_blocks_.size()); 413 Rpo rpo = Rpo::FromInt(static_cast<int>(instruction_blocks_.size()));
414 Rpo rpo = Rpo::FromInt(block_id.ToInt());
415 Rpo loop_header = Rpo::Invalid(); 414 Rpo loop_header = Rpo::Invalid();
416 Rpo loop_end = Rpo::Invalid(); 415 Rpo loop_end = Rpo::Invalid();
417 if (!loop_blocks_.empty()) { 416 if (!loop_blocks_.empty()) {
418 auto& loop_data = loop_blocks_.back(); 417 auto& loop_data = loop_blocks_.back();
419 // This is a loop header. 418 // This is a loop header.
420 if (!loop_data.loop_header_.IsValid()) { 419 if (!loop_data.loop_header_.IsValid()) {
421 loop_end = Rpo::FromInt(block_id.ToInt() + loop_data.expected_blocks_); 420 loop_end = Rpo::FromInt(rpo.ToInt() + loop_data.expected_blocks_);
422 loop_data.expected_blocks_--; 421 loop_data.expected_blocks_--;
423 loop_data.loop_header_ = rpo; 422 loop_data.loop_header_ = rpo;
424 } else { 423 } else {
425 // This is a loop body. 424 // This is a loop body.
426 CHECK_NE(0, loop_data.expected_blocks_); 425 CHECK_NE(0, loop_data.expected_blocks_);
427 // TODO(dcarney): handle nested loops. 426 // TODO(dcarney): handle nested loops.
428 loop_data.expected_blocks_--; 427 loop_data.expected_blocks_--;
429 loop_header = loop_data.loop_header_; 428 loop_header = loop_data.loop_header_;
430 } 429 }
431 } 430 }
432 // Construct instruction block. 431 // Construct instruction block.
433 auto instruction_block = new (zone()) 432 auto instruction_block =
434 InstructionBlock(zone(), block_id, rpo, loop_header, loop_end, false); 433 new (zone()) InstructionBlock(zone(), rpo, loop_header, loop_end, false);
435 instruction_blocks_.push_back(instruction_block); 434 instruction_blocks_.push_back(instruction_block);
436 current_block_ = instruction_block; 435 current_block_ = instruction_block;
437 sequence()->StartBlock(rpo); 436 sequence()->StartBlock(rpo);
438 return instruction_block; 437 return instruction_block;
439 } 438 }
440 439
441 440
442 void InstructionSequenceTest::WireBlocks() { 441 void InstructionSequenceTest::WireBlocks() {
443 CHECK(!current_block()); 442 CHECK(!current_block());
444 CHECK(instruction_blocks_.size() == completions_.size()); 443 CHECK(instruction_blocks_.size() == completions_.size());
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 483
485 484
486 Instruction* InstructionSequenceTest::AddInstruction(Instruction* instruction) { 485 Instruction* InstructionSequenceTest::AddInstruction(Instruction* instruction) {
487 sequence()->AddInstruction(instruction); 486 sequence()->AddInstruction(instruction);
488 return instruction; 487 return instruction;
489 } 488 }
490 489
491 } // namespace compiler 490 } // namespace compiler
492 } // namespace internal 491 } // namespace internal
493 } // namespace v8 492 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/instruction-sequence-unittest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698