| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 abstract class HVisitor<R> { | 7 abstract class HVisitor<R> { |
| 8 R visitAdd(HAdd node); | 8 R visitAdd(HAdd node); |
| 9 R visitBailoutTarget(HBailoutTarget node); | 9 R visitBailoutTarget(HBailoutTarget node); |
| 10 R visitBitAnd(HBitAnd node); | 10 R visitBitAnd(HBitAnd node); |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 // Keep the list of dominated blocks sorted such that if there are two | 652 // Keep the list of dominated blocks sorted such that if there are two |
| 653 // succeeding blocks in the list, the predecessor is before the successor. | 653 // succeeding blocks in the list, the predecessor is before the successor. |
| 654 // Assume that we add the dominated blocks in the right order. | 654 // Assume that we add the dominated blocks in the right order. |
| 655 int index = dominatedBlocks.length; | 655 int index = dominatedBlocks.length; |
| 656 while (index > 0 && dominatedBlocks[index - 1].id > block.id) { | 656 while (index > 0 && dominatedBlocks[index - 1].id > block.id) { |
| 657 index--; | 657 index--; |
| 658 } | 658 } |
| 659 if (index == dominatedBlocks.length) { | 659 if (index == dominatedBlocks.length) { |
| 660 dominatedBlocks.add(block); | 660 dominatedBlocks.add(block); |
| 661 } else { | 661 } else { |
| 662 dominatedBlocks.insertRange(index, 1, block); | 662 dominatedBlocks.insert(index, block); |
| 663 } | 663 } |
| 664 assert(block.dominator == null); | 664 assert(block.dominator == null); |
| 665 block.dominator = this; | 665 block.dominator = this; |
| 666 } | 666 } |
| 667 | 667 |
| 668 void removeDominatedBlock(HBasicBlock block) { | 668 void removeDominatedBlock(HBasicBlock block) { |
| 669 assert(isClosed()); | 669 assert(isClosed()); |
| 670 assert(id != null && block.id != null); | 670 assert(id != null && block.id != null); |
| 671 int index = dominatedBlocks.indexOf(block); | 671 int index = dominatedBlocks.indexOf(block); |
| 672 assert(index >= 0); | 672 assert(index >= 0); |
| 673 if (index == dominatedBlocks.length - 1) { | 673 if (index == dominatedBlocks.length - 1) { |
| 674 dominatedBlocks.removeLast(); | 674 dominatedBlocks.removeLast(); |
| 675 } else { | 675 } else { |
| 676 dominatedBlocks.removeRange(index, 1); | 676 dominatedBlocks.removeRange(index, index + 1); |
| 677 } | 677 } |
| 678 assert(identical(block.dominator, this)); | 678 assert(identical(block.dominator, this)); |
| 679 block.dominator = null; | 679 block.dominator = null; |
| 680 } | 680 } |
| 681 | 681 |
| 682 void assignCommonDominator(HBasicBlock predecessor) { | 682 void assignCommonDominator(HBasicBlock predecessor) { |
| 683 assert(isClosed()); | 683 assert(isClosed()); |
| 684 if (dominator == null) { | 684 if (dominator == null) { |
| 685 // If this basic block doesn't have a dominator yet we use the | 685 // If this basic block doesn't have a dominator yet we use the |
| 686 // given predecessor as the dominator. | 686 // given predecessor as the dominator. |
| (...skipping 1960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2647 HBasicBlock get start => expression.start; | 2647 HBasicBlock get start => expression.start; |
| 2648 HBasicBlock get end { | 2648 HBasicBlock get end { |
| 2649 // We don't create a switch block if there are no cases. | 2649 // We don't create a switch block if there are no cases. |
| 2650 assert(!statements.isEmpty); | 2650 assert(!statements.isEmpty); |
| 2651 return statements.last.end; | 2651 return statements.last.end; |
| 2652 } | 2652 } |
| 2653 | 2653 |
| 2654 bool accept(HStatementInformationVisitor visitor) => | 2654 bool accept(HStatementInformationVisitor visitor) => |
| 2655 visitor.visitSwitchInfo(this); | 2655 visitor.visitSwitchInfo(this); |
| 2656 } | 2656 } |
| OLD | NEW |