| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 interface HVisitor<R> { | 5 interface HVisitor<R> { |
| 6 R visitAdd(HAdd node); | 6 R visitAdd(HAdd node); |
| 7 R visitBitAnd(HBitAnd node); | 7 R visitBitAnd(HBitAnd node); |
| 8 R visitBitNot(HBitNot node); | 8 R visitBitNot(HBitNot node); |
| 9 R visitBitOr(HBitOr node); | 9 R visitBitOr(HBitOr node); |
| 10 R visitBitXor(HBitXor node); | 10 R visitBitXor(HBitXor node); |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 void assignCommonDominator(HBasicBlock predecessor) { | 615 void assignCommonDominator(HBasicBlock predecessor) { |
| 616 assert(isClosed()); | 616 assert(isClosed()); |
| 617 if (dominator === null) { | 617 if (dominator === null) { |
| 618 // If this basic block doesn't have a dominator yet we use the | 618 // If this basic block doesn't have a dominator yet we use the |
| 619 // given predecessor as the dominator. | 619 // given predecessor as the dominator. |
| 620 predecessor.addDominatedBlock(this); | 620 predecessor.addDominatedBlock(this); |
| 621 } else if (predecessor.dominator !== null) { | 621 } else if (predecessor.dominator !== null) { |
| 622 // If the predecessor has a dominator and this basic block has a | 622 // If the predecessor has a dominator and this basic block has a |
| 623 // dominator, we find a common parent in the dominator tree and | 623 // dominator, we find a common parent in the dominator tree and |
| 624 // use that as the dominator. | 624 // use that as the dominator. |
| 625 HBasicBlock first = dominator; | 625 HBasicBlock block0 = dominator; |
| 626 HBasicBlock second = predecessor; | 626 HBasicBlock block1 = predecessor; |
| 627 while (first !== second) { | 627 while (block0 !== block1) { |
| 628 if (first.id > second.id) { | 628 if (block0.id > block1.id) { |
| 629 first = first.dominator; | 629 block0 = block0.dominator; |
| 630 } else { | 630 } else { |
| 631 second = second.dominator; | 631 block1 = block1.dominator; |
| 632 } | 632 } |
| 633 assert(first !== null && second !== null); | 633 assert(block0 !== null && block1 !== null); |
| 634 } | 634 } |
| 635 if (dominator !== first) { | 635 if (dominator !== block0) { |
| 636 dominator.removeDominatedBlock(this); | 636 dominator.removeDominatedBlock(this); |
| 637 first.addDominatedBlock(this); | 637 block0.addDominatedBlock(this); |
| 638 } | 638 } |
| 639 } | 639 } |
| 640 } | 640 } |
| 641 | 641 |
| 642 void forEachPhi(void f(HPhi phi)) { | 642 void forEachPhi(void f(HPhi phi)) { |
| 643 HPhi current = phis.first; | 643 HPhi current = phis.first; |
| 644 while (current !== null) { | 644 while (current !== null) { |
| 645 f(current); | 645 f(current); |
| 646 current = current.next; | 646 current = current.next; |
| 647 } | 647 } |
| (...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2226 class HIfBlockInformation { | 2226 class HIfBlockInformation { |
| 2227 final HIf branch; | 2227 final HIf branch; |
| 2228 final SubGraph thenGraph; | 2228 final SubGraph thenGraph; |
| 2229 final SubGraph elseGraph; | 2229 final SubGraph elseGraph; |
| 2230 final HBasicBlock joinBlock; | 2230 final HBasicBlock joinBlock; |
| 2231 HIfBlockInformation(this.branch, | 2231 HIfBlockInformation(this.branch, |
| 2232 this.thenGraph, | 2232 this.thenGraph, |
| 2233 this.elseGraph, | 2233 this.elseGraph, |
| 2234 this.joinBlock); | 2234 this.joinBlock); |
| 2235 } | 2235 } |
| OLD | NEW |