| 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 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1835 assert(isInBasicBlock()); | 1835 assert(isInBasicBlock()); |
| 1836 inputs.add(input); | 1836 inputs.add(input); |
| 1837 input.usedBy.add(this); | 1837 input.usedBy.add(this); |
| 1838 } | 1838 } |
| 1839 | 1839 |
| 1840 // Compute the (shared) type of the inputs if any. If all inputs | 1840 // Compute the (shared) type of the inputs if any. If all inputs |
| 1841 // have the same known type return it. If any two inputs have | 1841 // have the same known type return it. If any two inputs have |
| 1842 // different known types, we'll return a conflict -- otherwise we'll | 1842 // different known types, we'll return a conflict -- otherwise we'll |
| 1843 // simply return an unknown type. | 1843 // simply return an unknown type. |
| 1844 HType computeInputsType(bool unknownWins) { | 1844 HType computeInputsType(bool unknownWins) { |
| 1845 bool seenUnknown = false; | |
| 1846 HType candidateType = inputs[0].propagatedType; | 1845 HType candidateType = inputs[0].propagatedType; |
| 1846 bool seenUnknown = candidateType.isUnknown(); |
| 1847 for (int i = 1, length = inputs.length; i < length; i++) { | 1847 for (int i = 1, length = inputs.length; i < length; i++) { |
| 1848 HType inputType = inputs[i].propagatedType; | 1848 HType inputType = inputs[i].propagatedType; |
| 1849 if (inputType.isUnknown()) { | 1849 if (inputType.isUnknown()) { |
| 1850 seenUnknown = true; | 1850 seenUnknown = true; |
| 1851 } else { | 1851 } else { |
| 1852 candidateType = candidateType.combine(inputType); | 1852 candidateType = candidateType.combine(inputType); |
| 1853 if (candidateType.isConflicting()) return HType.CONFLICTING; | 1853 if (candidateType.isConflicting()) return HType.CONFLICTING; |
| 1854 } | 1854 } |
| 1855 } | 1855 } |
| 1856 if (seenUnknown && unknownWins) return HType.UNKNOWN; | 1856 if (seenUnknown && unknownWins) return HType.UNKNOWN; |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2304 final bool isAnd; | 2304 final bool isAnd; |
| 2305 final SubExpression left; | 2305 final SubExpression left; |
| 2306 final SubExpression right; | 2306 final SubExpression right; |
| 2307 final HBasicBlock joinBlock; | 2307 final HBasicBlock joinBlock; |
| 2308 HAndOrBlockInformation(this.isAnd, | 2308 HAndOrBlockInformation(this.isAnd, |
| 2309 this.left, | 2309 this.left, |
| 2310 this.right, | 2310 this.right, |
| 2311 this.joinBlock); | 2311 this.joinBlock); |
| 2312 bool accept(HBlockInformationVisitor visitor) => visitor.visitAndOrInfo(this); | 2312 bool accept(HBlockInformationVisitor visitor) => visitor.visitAndOrInfo(this); |
| 2313 } | 2313 } |
| OLD | NEW |