| Index: runtime/vm/intermediate_language.cc
|
| diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
|
| index 8fc6e01d85f6dea53704d9eefbc56e93885e7111..0721fc595f540d9caa02cd79bea22119dcf035a5 100644
|
| --- a/runtime/vm/intermediate_language.cc
|
| +++ b/runtime/vm/intermediate_language.cc
|
| @@ -119,9 +119,17 @@ void JoinEntryInstr::DiscoverBlocks(
|
| // number, so they should stay in lockstep.
|
| ASSERT(preorder->length() == parent->length());
|
|
|
| - // 5. Recursively visit the successor.
|
| + // 5. Iterate straight-line successors until a branch instruction or
|
| + // another basic block entry instruction, and visit that instruction.
|
| ASSERT(successor_ != NULL);
|
| - successor_->DiscoverBlocks(this, preorder, postorder, parent);
|
| + Instruction* next = successor_;
|
| + while ((next != NULL) && !next->IsBlockEntry() && !next->IsBranch()) {
|
| + set_last_instruction(next);
|
| + next = next->StraightLineSuccessor();
|
| + }
|
| + if (next != NULL) {
|
| + next->DiscoverBlocks(this, preorder, postorder, parent);
|
| + }
|
|
|
| // 6. Assign postorder number and add the block entry to the list.
|
| set_postorder_number(postorder->length());
|
| @@ -152,9 +160,19 @@ void TargetEntryInstr::DiscoverBlocks(
|
| // they should stay in lockstep.
|
| ASSERT(preorder->length() == parent->length());
|
|
|
| - // 5. Recursively visit the successor.
|
| + // 5. Iterate straight-line successors until a branch instruction or
|
| + // another basic block entry instruction, and visit that instruction.
|
| ASSERT(successor_ != NULL);
|
| - successor_->DiscoverBlocks(this, preorder, postorder, parent);
|
| + Instruction* next = successor_;
|
| + while ((next != NULL) &&
|
| + !next->IsBlockEntry() &&
|
| + !next->IsBranch()) {
|
| + set_last_instruction(next);
|
| + next = next->StraightLineSuccessor();
|
| + }
|
| + if (next != NULL) {
|
| + next->DiscoverBlocks(this, preorder, postorder, parent);
|
| + }
|
|
|
| // 6. Assign postorder number and add the block entry to the list.
|
| set_postorder_number(postorder->length());
|
| @@ -162,77 +180,6 @@ void TargetEntryInstr::DiscoverBlocks(
|
| }
|
|
|
|
|
| -void PickTempInstr::DiscoverBlocks(
|
| - BlockEntryInstr* current_block,
|
| - GrowableArray<BlockEntryInstr*>* preorder,
|
| - GrowableArray<BlockEntryInstr*>* postorder,
|
| - GrowableArray<BlockEntryInstr*>* parent) {
|
| - current_block->set_last_instruction(this);
|
| - ASSERT(successor_ != NULL);
|
| - successor_->DiscoverBlocks(current_block, preorder, postorder, parent);
|
| -}
|
| -
|
| -
|
| -void TuckTempInstr::DiscoverBlocks(
|
| - BlockEntryInstr* current_block,
|
| - GrowableArray<BlockEntryInstr*>* preorder,
|
| - GrowableArray<BlockEntryInstr*>* postorder,
|
| - GrowableArray<BlockEntryInstr*>* parent) {
|
| - current_block->set_last_instruction(this);
|
| - ASSERT(successor_ != NULL);
|
| - successor_->DiscoverBlocks(current_block, preorder, postorder, parent);
|
| -}
|
| -
|
| -
|
| -void DoInstr::DiscoverBlocks(
|
| - BlockEntryInstr* current_block,
|
| - GrowableArray<BlockEntryInstr*>* preorder,
|
| - GrowableArray<BlockEntryInstr*>* postorder,
|
| - GrowableArray<BlockEntryInstr*>* parent) {
|
| - current_block->set_last_instruction(this);
|
| - ASSERT(successor_ != NULL);
|
| - successor_->DiscoverBlocks(current_block, preorder, postorder, parent);
|
| -}
|
| -
|
| -
|
| -void BindInstr::DiscoverBlocks(
|
| - BlockEntryInstr* current_block,
|
| - GrowableArray<BlockEntryInstr*>* preorder,
|
| - GrowableArray<BlockEntryInstr*>* postorder,
|
| - GrowableArray<BlockEntryInstr*>* parent) {
|
| - current_block->set_last_instruction(this);
|
| - ASSERT(successor_ != NULL);
|
| - successor_->DiscoverBlocks(current_block, preorder, postorder, parent);
|
| -}
|
| -
|
| -
|
| -void ReturnInstr::DiscoverBlocks(
|
| - BlockEntryInstr* current_block,
|
| - GrowableArray<BlockEntryInstr*>* preorder,
|
| - GrowableArray<BlockEntryInstr*>* postorder,
|
| - GrowableArray<BlockEntryInstr*>* parent) {
|
| - current_block->set_last_instruction(this);
|
| -}
|
| -
|
| -
|
| -void ThrowInstr::DiscoverBlocks(
|
| - BlockEntryInstr* current_block,
|
| - GrowableArray<BlockEntryInstr*>* preorder,
|
| - GrowableArray<BlockEntryInstr*>* postorder,
|
| - GrowableArray<BlockEntryInstr*>* parent) {
|
| - current_block->set_last_instruction(this);
|
| -}
|
| -
|
| -
|
| -void ReThrowInstr::DiscoverBlocks(
|
| - BlockEntryInstr* current_block,
|
| - GrowableArray<BlockEntryInstr*>* preorder,
|
| - GrowableArray<BlockEntryInstr*>* postorder,
|
| - GrowableArray<BlockEntryInstr*>* parent) {
|
| - current_block->set_last_instruction(this);
|
| -}
|
| -
|
| -
|
| void BranchInstr::DiscoverBlocks(
|
| BlockEntryInstr* current_block,
|
| GrowableArray<BlockEntryInstr*>* preorder,
|
|
|