| 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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 } | 727 } |
| 728 | 728 |
| 729 HType combine(HType other) { | 729 HType combine(HType other) { |
| 730 if (isUnknown()) return other; | 730 if (isUnknown()) return other; |
| 731 if (other.isUnknown()) return this; | 731 if (other.isUnknown()) return this; |
| 732 return getTypeFromFlag(this.flag & other.flag); | 732 return getTypeFromFlag(this.flag & other.flag); |
| 733 } | 733 } |
| 734 } | 734 } |
| 735 | 735 |
| 736 class HInstruction implements Hashable { | 736 class HInstruction implements Hashable { |
| 737 Element sourceElement; |
| 738 |
| 737 final int id; | 739 final int id; |
| 738 static int idCounter; | 740 static int idCounter; |
| 739 | 741 |
| 740 final List<HInstruction> inputs; | 742 final List<HInstruction> inputs; |
| 741 final List<HInstruction> usedBy; | 743 final List<HInstruction> usedBy; |
| 742 | 744 |
| 743 HBasicBlock block; | 745 HBasicBlock block; |
| 744 HInstruction previous = null; | 746 HInstruction previous = null; |
| 745 HInstruction next = null; | 747 HInstruction next = null; |
| 746 int flags = 0; | 748 int flags = 0; |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1758 bool isCodeMotionInvariant() => true; | 1760 bool isCodeMotionInvariant() => true; |
| 1759 } | 1761 } |
| 1760 | 1762 |
| 1761 class HThis extends HParameterValue { | 1763 class HThis extends HParameterValue { |
| 1762 HThis() : super(null); | 1764 HThis() : super(null); |
| 1763 toString() => 'this'; | 1765 toString() => 'this'; |
| 1764 accept(HVisitor visitor) => visitor.visitThis(this); | 1766 accept(HVisitor visitor) => visitor.visitThis(this); |
| 1765 } | 1767 } |
| 1766 | 1768 |
| 1767 class HPhi extends HInstruction { | 1769 class HPhi extends HInstruction { |
| 1768 final Element element; | |
| 1769 | |
| 1770 static final IS_NOT_LOGICAL_OPERATOR = 0; | 1770 static final IS_NOT_LOGICAL_OPERATOR = 0; |
| 1771 static final IS_AND = 1; | 1771 static final IS_AND = 1; |
| 1772 static final IS_OR = 2; | 1772 static final IS_OR = 2; |
| 1773 | 1773 |
| 1774 int logicalOperatorType = IS_NOT_LOGICAL_OPERATOR; | 1774 int logicalOperatorType = IS_NOT_LOGICAL_OPERATOR; |
| 1775 | 1775 |
| 1776 // The order of the [inputs] must correspond to the order of the | 1776 // The order of the [inputs] must correspond to the order of the |
| 1777 // predecessor-edges. That is if an input comes from the first predecessor | 1777 // predecessor-edges. That is if an input comes from the first predecessor |
| 1778 // of the surrounding block, then the input must be the first in the [HPhi]. | 1778 // of the surrounding block, then the input must be the first in the [HPhi]. |
| 1779 HPhi(this.element, List<HInstruction> inputs) : super(inputs); | 1779 HPhi(Element element, List<HInstruction> inputs) : super(inputs) { |
| 1780 sourceElement = element; |
| 1781 } |
| 1780 HPhi.noInputs(Element element) : this(element, <HInstruction>[]); | 1782 HPhi.noInputs(Element element) : this(element, <HInstruction>[]); |
| 1781 HPhi.singleInput(Element element, HInstruction input) | 1783 HPhi.singleInput(Element element, HInstruction input) |
| 1782 : this(element, <HInstruction>[input]); | 1784 : this(element, <HInstruction>[input]); |
| 1783 HPhi.manyInputs(Element element, List<HInstruction> inputs) | 1785 HPhi.manyInputs(Element element, List<HInstruction> inputs) |
| 1784 : this(element, inputs); | 1786 : this(element, inputs); |
| 1785 | 1787 |
| 1786 void addInput(HInstruction input) { | 1788 void addInput(HInstruction input) { |
| 1787 assert(isInBasicBlock()); | 1789 assert(isInBasicBlock()); |
| 1788 inputs.add(input); | 1790 inputs.add(input); |
| 1789 input.usedBy.add(this); | 1791 input.usedBy.add(this); |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2256 final bool isAnd; | 2258 final bool isAnd; |
| 2257 final SubExpression left; | 2259 final SubExpression left; |
| 2258 final SubExpression right; | 2260 final SubExpression right; |
| 2259 final HBasicBlock joinBlock; | 2261 final HBasicBlock joinBlock; |
| 2260 HAndOrBlockInformation(this.isAnd, | 2262 HAndOrBlockInformation(this.isAnd, |
| 2261 this.left, | 2263 this.left, |
| 2262 this.right, | 2264 this.right, |
| 2263 this.joinBlock); | 2265 this.joinBlock); |
| 2264 bool accept(HBlockInformationVisitor visitor) => visitor.visitAndOrInfo(this); | 2266 bool accept(HBlockInformationVisitor visitor) => visitor.visitAndOrInfo(this); |
| 2265 } | 2267 } |
| OLD | NEW |