Chromium Code Reviews| 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 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1190 bool hasExpectedType() => builtin || type.isUnknown() || left.isString(); | 1190 bool hasExpectedType() => builtin || type.isUnknown() || left.isString(); |
| 1191 | 1191 |
| 1192 HType computeDesiredInputType(HInstruction input) { | 1192 HType computeDesiredInputType(HInstruction input) { |
| 1193 // TODO(floitsch): we want the target to be a function. | 1193 // TODO(floitsch): we want the target to be a function. |
| 1194 if (input == target) return HType.UNKNOWN; | 1194 if (input == target) return HType.UNKNOWN; |
| 1195 if (isString() || left.isString()) { | 1195 if (isString() || left.isString()) { |
| 1196 return (input == left) ? HType.STRING : HType.UNKNOWN; | 1196 return (input == left) ? HType.STRING : HType.UNKNOWN; |
| 1197 } | 1197 } |
| 1198 if (right.isString()) return HType.STRING; | 1198 if (right.isString()) return HType.STRING; |
| 1199 if (isNumber() || left.isNumber() || right.isNumber()) return HType.NUMBER; | 1199 if (isNumber() || left.isNumber() || right.isNumber()) return HType.NUMBER; |
| 1200 if (type.isUnknown()) return HType.NUMBER; | |
|
ngeoffray
2012/01/11 12:30:13
Crying :-)
| |
| 1201 return HType.UNKNOWN; | 1200 return HType.UNKNOWN; |
| 1202 } | 1201 } |
| 1203 } | 1202 } |
| 1204 | 1203 |
| 1205 class HDivide extends HBinaryArithmetic { | 1204 class HDivide extends HBinaryArithmetic { |
| 1206 HDivide(HStatic target, HInstruction left, HInstruction right) | 1205 HDivide(HStatic target, HInstruction left, HInstruction right) |
| 1207 : super(target, left, right); | 1206 : super(target, left, right); |
| 1208 accept(HVisitor visitor) => visitor.visitDivide(this); | 1207 accept(HVisitor visitor) => visitor.visitDivide(this); |
| 1209 num evaluate(num a, num b) => a / b; | 1208 num evaluate(num a, num b) => a / b; |
| 1210 bool typeEquals(other) => other is HDivide; | 1209 bool typeEquals(other) => other is HDivide; |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1986 HInstruction first, | 1985 HInstruction first, |
| 1987 HInstruction second) | 1986 HInstruction second) |
| 1988 : super(<HInstruction>[first, second]); | 1987 : super(<HInstruction>[first, second]); |
| 1989 toString() => operation; | 1988 toString() => operation; |
| 1990 accept(HVisitor visitor) => visitor.visitLogicalOperator(this); | 1989 accept(HVisitor visitor) => visitor.visitLogicalOperator(this); |
| 1991 HInstruction get left() => inputs[0]; | 1990 HInstruction get left() => inputs[0]; |
| 1992 HInstruction get right() => inputs[1]; | 1991 HInstruction get right() => inputs[1]; |
| 1993 HType computeType() => HType.BOOLEAN; | 1992 HType computeType() => HType.BOOLEAN; |
| 1994 bool hasExpectedType() => true; | 1993 bool hasExpectedType() => true; |
| 1995 } | 1994 } |
| OLD | NEW |