| 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/compiler/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
| 6 #include "src/compiler/graph.h" | 6 #include "src/compiler/graph.h" |
| 7 #include "src/compiler/instruction.h" | 7 #include "src/compiler/instruction.h" |
| 8 #include "src/compiler/schedule.h" | 8 #include "src/compiler/schedule.h" |
| 9 #include "src/compiler/state-values-utils.h" | 9 #include "src/compiler/state-values-utils.h" |
| 10 | 10 |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 for (BasicBlockVector::const_iterator it = schedule->rpo_order()->begin(); | 608 for (BasicBlockVector::const_iterator it = schedule->rpo_order()->begin(); |
| 609 it != schedule->rpo_order()->end(); ++it, ++rpo_number) { | 609 it != schedule->rpo_order()->end(); ++it, ++rpo_number) { |
| 610 DCHECK(!(*blocks)[rpo_number]); | 610 DCHECK(!(*blocks)[rpo_number]); |
| 611 DCHECK(GetRpo(*it).ToSize() == rpo_number); | 611 DCHECK(GetRpo(*it).ToSize() == rpo_number); |
| 612 (*blocks)[rpo_number] = InstructionBlockFor(zone, *it); | 612 (*blocks)[rpo_number] = InstructionBlockFor(zone, *it); |
| 613 } | 613 } |
| 614 ComputeAssemblyOrder(blocks); | 614 ComputeAssemblyOrder(blocks); |
| 615 return blocks; | 615 return blocks; |
| 616 } | 616 } |
| 617 | 617 |
| 618 void InstructionSequence::Validate() { |
| 619 // Validate blocks are in edge-split form: no block with multiple successors |
| 620 // has an edge to a block (== a successor) with more than one predecessors. |
| 621 for (const InstructionBlock* block : instruction_blocks()) { |
| 622 if (block->SuccessorCount() > 1) { |
| 623 for (const RpoNumber& successor_id : block->successors()) { |
| 624 const InstructionBlock* successor = InstructionBlockAt(successor_id); |
| 625 // Expect precisely one predecessor: "block". |
| 626 CHECK(successor->PredecessorCount() == 1 && |
| 627 successor->predecessors()[0] == block->rpo_number()); |
| 628 } |
| 629 } |
| 630 } |
| 631 } |
| 618 | 632 |
| 619 void InstructionSequence::ComputeAssemblyOrder(InstructionBlocks* blocks) { | 633 void InstructionSequence::ComputeAssemblyOrder(InstructionBlocks* blocks) { |
| 620 int ao = 0; | 634 int ao = 0; |
| 621 for (auto const block : *blocks) { | 635 for (auto const block : *blocks) { |
| 622 if (!block->IsDeferred()) { | 636 if (!block->IsDeferred()) { |
| 623 block->set_ao_number(RpoNumber::FromInt(ao++)); | 637 block->set_ao_number(RpoNumber::FromInt(ao++)); |
| 624 } | 638 } |
| 625 } | 639 } |
| 626 for (auto const block : *blocks) { | 640 for (auto const block : *blocks) { |
| 627 if (block->IsDeferred()) { | 641 if (block->IsDeferred()) { |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 } | 972 } |
| 959 for (int i = 0; i < code.InstructionBlockCount(); i++) { | 973 for (int i = 0; i < code.InstructionBlockCount(); i++) { |
| 960 printable.sequence_->PrintBlock(printable.register_configuration_, i); | 974 printable.sequence_->PrintBlock(printable.register_configuration_, i); |
| 961 } | 975 } |
| 962 return os; | 976 return os; |
| 963 } | 977 } |
| 964 | 978 |
| 965 } // namespace compiler | 979 } // namespace compiler |
| 966 } // namespace internal | 980 } // namespace internal |
| 967 } // namespace v8 | 981 } // namespace v8 |
| OLD | NEW |