| 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 final JavaScriptBackend backend; | 6 final JavaScriptBackend backend; |
| 7 SsaCodeGeneratorTask(JavaScriptBackend backend) | 7 SsaCodeGeneratorTask(JavaScriptBackend backend) |
| 8 : this.backend = backend, | 8 : this.backend = backend, |
| 9 super(backend.compiler); | 9 super(backend.compiler); |
| 10 String get name() => 'SSA code generator'; | 10 String get name() => 'SSA code generator'; |
| (...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1760 use(input.inputs[0]); | 1760 use(input.inputs[0]); |
| 1761 push(new js.Binary("!==", pop(), new js.LiteralBool(true)), input); | 1761 push(new js.Binary("!==", pop(), new js.LiteralBool(true)), input); |
| 1762 } else if (isBuiltinRelational(input) && | 1762 } else if (isBuiltinRelational(input) && |
| 1763 isGenerateAtUseSite(input) && | 1763 isGenerateAtUseSite(input) && |
| 1764 types[input.inputs[0]].isUseful() && | 1764 types[input.inputs[0]].isUseful() && |
| 1765 !input.inputs[0].isDouble(types) && | 1765 !input.inputs[0].isDouble(types) && |
| 1766 types[input.inputs[1]].isUseful() && | 1766 types[input.inputs[1]].isUseful() && |
| 1767 !input.inputs[1].isDouble(types)) { | 1767 !input.inputs[1].isDouble(types)) { |
| 1768 // This optimization doesn't work for NaN, so we only do it if the | 1768 // This optimization doesn't work for NaN, so we only do it if the |
| 1769 // type is known to be non-Double. | 1769 // type is known to be non-Double. |
| 1770 Map<String, String> inverseOperator = const <String>{ | 1770 Map<String, String> inverseOperator = const <String, String>{ |
| 1771 "==" : "!=", | 1771 "==" : "!=", |
| 1772 "!=" : "==", | 1772 "!=" : "==", |
| 1773 "===": "!==", | 1773 "===": "!==", |
| 1774 "!==": "===", | 1774 "!==": "===", |
| 1775 "<" : ">=", | 1775 "<" : ">=", |
| 1776 "<=" : ">", | 1776 "<=" : ">", |
| 1777 ">" : "<=", | 1777 ">" : "<=", |
| 1778 ">=" : "<" | 1778 ">=" : "<" |
| 1779 }; | 1779 }; |
| 1780 HRelational relational = input; | 1780 HRelational relational = input; |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2274 } | 2274 } |
| 2275 push(result, node); | 2275 push(result, node); |
| 2276 } | 2276 } |
| 2277 if (node.nullOk) { | 2277 if (node.nullOk) { |
| 2278 checkNull(input); | 2278 checkNull(input); |
| 2279 push(new js.Binary('||', pop(), pop()), node); | 2279 push(new js.Binary('||', pop(), pop()), node); |
| 2280 } | 2280 } |
| 2281 } | 2281 } |
| 2282 | 2282 |
| 2283 void visitTypeConversion(HTypeConversion node) { | 2283 void visitTypeConversion(HTypeConversion node) { |
| 2284 Map<String, SourceString> castNames = const <SourceString> { | 2284 Map<String, SourceString> castNames = const <String, SourceString> { |
| 2285 "stringTypeCheck": | 2285 "stringTypeCheck": |
| 2286 const SourceString("stringTypeCast"), | 2286 const SourceString("stringTypeCast"), |
| 2287 "doubleTypeCheck": | 2287 "doubleTypeCheck": |
| 2288 const SourceString("doubleTypeCast"), | 2288 const SourceString("doubleTypeCast"), |
| 2289 "numTypeCheck": | 2289 "numTypeCheck": |
| 2290 const SourceString("numTypeCast"), | 2290 const SourceString("numTypeCast"), |
| 2291 "boolTypeCheck": | 2291 "boolTypeCheck": |
| 2292 const SourceString("boolTypeCast"), | 2292 const SourceString("boolTypeCast"), |
| 2293 "functionTypeCheck": | 2293 "functionTypeCheck": |
| 2294 const SourceString("functionTypeCast"), | 2294 const SourceString("functionTypeCast"), |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2901 if (leftType.canBeNull() && rightType.canBeNull()) { | 2901 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 2902 if (left.isConstantNull() || right.isConstantNull() || | 2902 if (left.isConstantNull() || right.isConstantNull() || |
| 2903 (leftType.isPrimitive() && leftType == rightType)) { | 2903 (leftType.isPrimitive() && leftType == rightType)) { |
| 2904 return '=='; | 2904 return '=='; |
| 2905 } | 2905 } |
| 2906 return null; | 2906 return null; |
| 2907 } else { | 2907 } else { |
| 2908 return '==='; | 2908 return '==='; |
| 2909 } | 2909 } |
| 2910 } | 2910 } |
| OLD | NEW |