| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 class SsaCodeGeneratorTask extends CompilerTask { | 7 class SsaCodeGeneratorTask extends CompilerTask { |
| 8 | 8 |
| 9 final JavaScriptBackend backend; | 9 final JavaScriptBackend backend; |
| 10 | 10 |
| (...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1521 } else if (target == backend.jsArrayRemoveLast) { | 1521 } else if (target == backend.jsArrayRemoveLast) { |
| 1522 methodName = 'pop'; | 1522 methodName = 'pop'; |
| 1523 } else if (target == backend.jsStringSplit) { | 1523 } else if (target == backend.jsStringSplit) { |
| 1524 methodName = 'split'; | 1524 methodName = 'split'; |
| 1525 // Split returns a List, so we make sure the backend knows the | 1525 // Split returns a List, so we make sure the backend knows the |
| 1526 // list class is instantiated. | 1526 // list class is instantiated. |
| 1527 world.registerInstantiatedClass(compiler.listClass); | 1527 world.registerInstantiatedClass(compiler.listClass); |
| 1528 } else if (target == backend.jsStringConcat) { | 1528 } else if (target == backend.jsStringConcat) { |
| 1529 push(new js.Binary('+', object, arguments[0]), node); | 1529 push(new js.Binary('+', object, arguments[0]), node); |
| 1530 return; | 1530 return; |
| 1531 } else if (target.isNative() && !compiler.enableTypeAssertions) { |
| 1532 // Enable direct calls to a native method only if we don't |
| 1533 // run in checked mode, where the Dart version may have |
| 1534 // type annotations on parameters and return type that it |
| 1535 // should check. |
| 1536 // Also check that the parameters are not functions: it's |
| 1537 // the callee that will translate them to JS functions. |
| 1538 bool canInlineNativeCall = true; |
| 1539 target.computeSignature(compiler).forEachParameter((Element element) { |
| 1540 DartType type = element.computeType(compiler).unalias(compiler); |
| 1541 if (type is FunctionType) { |
| 1542 canInlineNativeCall = false; |
| 1543 } |
| 1544 }); |
| 1545 if (canInlineNativeCall) { |
| 1546 methodName = target.fixedBackendName(); |
| 1547 } |
| 1531 } | 1548 } |
| 1532 } | 1549 } |
| 1533 } | 1550 } |
| 1534 | 1551 |
| 1535 if (methodName == null) { | 1552 if (methodName == null) { |
| 1536 methodName = backend.namer.invocationName(node.selector); | 1553 methodName = backend.namer.invocationName(node.selector); |
| 1537 registerMethodInvoke(node); | 1554 registerMethodInvoke(node); |
| 1538 } | 1555 } |
| 1539 push(jsPropertyCall(object, methodName, arguments), node); | 1556 push(jsPropertyCall(object, methodName, arguments), node); |
| 1540 } | 1557 } |
| (...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2989 if (leftType.canBeNull() && rightType.canBeNull()) { | 3006 if (leftType.canBeNull() && rightType.canBeNull()) { |
| 2990 if (left.isConstantNull() || right.isConstantNull() || | 3007 if (left.isConstantNull() || right.isConstantNull() || |
| 2991 (leftType.isPrimitive() && leftType == rightType)) { | 3008 (leftType.isPrimitive() && leftType == rightType)) { |
| 2992 return '=='; | 3009 return '=='; |
| 2993 } | 3010 } |
| 2994 return null; | 3011 return null; |
| 2995 } else { | 3012 } else { |
| 2996 return '==='; | 3013 return '==='; |
| 2997 } | 3014 } |
| 2998 } | 3015 } |
| OLD | NEW |