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 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1508 world.registerDynamicInvocation(name, selector); | 1508 world.registerDynamicInvocation(name, selector); |
1509 } | 1509 } |
1510 } | 1510 } |
1511 push(jsPropertyCall(object, methodName, arguments), node); | 1511 push(jsPropertyCall(object, methodName, arguments), node); |
1512 } | 1512 } |
1513 | 1513 |
1514 Selector getOptimizedSelectorFor(HInvokeDynamic node, | 1514 Selector getOptimizedSelectorFor(HInvokeDynamic node, |
1515 Selector defaultSelector) { | 1515 Selector defaultSelector) { |
1516 // TODO(4434): For private members we need to use the untyped selector. | 1516 // TODO(4434): For private members we need to use the untyped selector. |
1517 if (defaultSelector.name.isPrivate()) return defaultSelector; | 1517 if (defaultSelector.name.isPrivate()) return defaultSelector; |
| 1518 // If [noSuchMethod] has been overridden and [InvocationMirror.invokeOn] |
| 1519 // has been called we must not create a typed selector based on the receiver |
| 1520 // type. |
| 1521 if (node.element == null && // Invocation is not exact. |
| 1522 backend.compiler.enabledInvokeOn) { |
| 1523 return defaultSelector; |
| 1524 } |
1518 HType receiverHType = types[node.inputs[0]]; | 1525 HType receiverHType = types[node.inputs[0]]; |
1519 DartType receiverType = receiverHType.computeType(compiler); | 1526 DartType receiverType = receiverHType.computeType(compiler); |
1520 if (receiverType != null) { | 1527 if (receiverType != null) { |
1521 return new TypedSelector(receiverType, defaultSelector); | 1528 return new TypedSelector(receiverType, defaultSelector); |
1522 } else { | 1529 } else { |
1523 return defaultSelector; | 1530 return defaultSelector; |
1524 } | 1531 } |
1525 } | 1532 } |
1526 | 1533 |
1527 visitInvokeDynamicSetter(HInvokeDynamicSetter node) { | 1534 visitInvokeDynamicSetter(HInvokeDynamicSetter node) { |
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2992 if (leftType.canBeNull() && rightType.canBeNull()) { | 2999 if (leftType.canBeNull() && rightType.canBeNull()) { |
2993 if (left.isConstantNull() || right.isConstantNull() || | 3000 if (left.isConstantNull() || right.isConstantNull() || |
2994 (leftType.isPrimitive() && leftType == rightType)) { | 3001 (leftType.isPrimitive() && leftType == rightType)) { |
2995 return '=='; | 3002 return '=='; |
2996 } | 3003 } |
2997 return null; | 3004 return null; |
2998 } else { | 3005 } else { |
2999 return '==='; | 3006 return '==='; |
3000 } | 3007 } |
3001 } | 3008 } |
OLD | NEW |