| 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 class SsaCodeGeneratorTask extends CompilerTask { | 5 class SsaCodeGeneratorTask extends CompilerTask { |
| 6 | 6 |
| 7 final JavaScriptBackend backend; | 7 final JavaScriptBackend backend; |
| 8 | 8 |
| 9 SsaCodeGeneratorTask(JavaScriptBackend backend) | 9 SsaCodeGeneratorTask(JavaScriptBackend backend) |
| 10 : this.backend = backend, | 10 : this.backend = backend, |
| (...skipping 2139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2150 use(input); | 2150 use(input); |
| 2151 js.Expression or0 = new js.Binary("|", pop(), new js.LiteralNumber("0")); | 2151 js.Expression or0 = new js.Binary("|", pop(), new js.LiteralNumber("0")); |
| 2152 push(new js.Binary(cmp, left, or0)); | 2152 push(new js.Binary(cmp, left, or0)); |
| 2153 } | 2153 } |
| 2154 | 2154 |
| 2155 void checkBigInt(HInstruction input, String cmp) { | 2155 void checkBigInt(HInstruction input, String cmp) { |
| 2156 use(input); | 2156 use(input); |
| 2157 js.Expression left = pop(); | 2157 js.Expression left = pop(); |
| 2158 use(input); | 2158 use(input); |
| 2159 js.Expression right = pop(); | 2159 js.Expression right = pop(); |
| 2160 // TODO(4984): Deal with infinity. | 2160 // TODO(4984): Deal with infinity and -0.0. |
| 2161 push(new js.LiteralExpression.withData('Math.floor(#) === #', | 2161 push(new js.LiteralExpression.withData('Math.floor(#) === #', |
| 2162 <js.Expression>[left, right])); | 2162 <js.Expression>[left, right])); |
| 2163 } | 2163 } |
| 2164 | 2164 |
| 2165 void checkTypeOf(HInstruction input, String cmp, String typeName) { | 2165 void checkTypeOf(HInstruction input, String cmp, String typeName) { |
| 2166 use(input); | 2166 use(input); |
| 2167 js.Expression typeOf = new js.Prefix("typeof", pop()); | 2167 js.Expression typeOf = new js.Prefix("typeof", pop()); |
| 2168 push(new js.Binary(cmp, typeOf, new js.LiteralString("'$typeName'"))); | 2168 push(new js.Binary(cmp, typeOf, new js.LiteralString("'$typeName'"))); |
| 2169 } | 2169 } |
| 2170 | 2170 |
| (...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2990 if (leftType.canBeNull() && rightType.canBeNull()) { | 2990 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 2991 if (left.isConstantNull() || right.isConstantNull() || | 2991 if (left.isConstantNull() || right.isConstantNull() || |
| 2992 (leftType.isPrimitive() && leftType == rightType)) { | 2992 (leftType.isPrimitive() && leftType == rightType)) { |
| 2993 return '=='; | 2993 return '=='; |
| 2994 } | 2994 } |
| 2995 return null; | 2995 return null; |
| 2996 } else { | 2996 } else { |
| 2997 return '==='; | 2997 return '==='; |
| 2998 } | 2998 } |
| 2999 } | 2999 } |
| OLD | NEW |