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 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 world.registerDynamicInvocation(name, selector); | 1534 world.registerDynamicInvocation(name, selector); |
1535 } | 1535 } |
1536 } | 1536 } |
1537 push(jsPropertyCall(object, methodName, arguments), node); | 1537 push(jsPropertyCall(object, methodName, arguments), node); |
1538 } | 1538 } |
1539 | 1539 |
1540 Selector getOptimizedSelectorFor(HInvokeDynamic node, | 1540 Selector getOptimizedSelectorFor(HInvokeDynamic node, |
1541 Selector defaultSelector) { | 1541 Selector defaultSelector) { |
1542 // TODO(4434): For private members we need to use the untyped selector. | 1542 // TODO(4434): For private members we need to use the untyped selector. |
1543 if (defaultSelector.name.isPrivate()) return defaultSelector; | 1543 if (defaultSelector.name.isPrivate()) return defaultSelector; |
| 1544 // If [JSInvocationMirror.invokeOn] has been called, we must not create a |
| 1545 // typed selector based on the receiver type. |
| 1546 if (node.element == null && // Invocation is not exact. |
| 1547 backend.compiler.enabledInvokeOn) { |
| 1548 return defaultSelector; |
| 1549 } |
1544 HType receiverHType = types[node.inputs[0]]; | 1550 HType receiverHType = types[node.inputs[0]]; |
1545 DartType receiverType = receiverHType.computeType(compiler); | 1551 DartType receiverType = receiverHType.computeType(compiler); |
1546 if (receiverType != null) { | 1552 if (receiverType != null) { |
1547 return new TypedSelector(receiverType, defaultSelector); | 1553 return new TypedSelector(receiverType, defaultSelector); |
1548 } else { | 1554 } else { |
1549 return defaultSelector; | 1555 return defaultSelector; |
1550 } | 1556 } |
1551 } | 1557 } |
1552 | 1558 |
1553 visitInvokeDynamicSetter(HInvokeDynamicSetter node) { | 1559 visitInvokeDynamicSetter(HInvokeDynamicSetter node) { |
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3031 if (leftType.canBeNull() && rightType.canBeNull()) { | 3037 if (leftType.canBeNull() && rightType.canBeNull()) { |
3032 if (left.isConstantNull() || right.isConstantNull() || | 3038 if (left.isConstantNull() || right.isConstantNull() || |
3033 (leftType.isPrimitive() && leftType == rightType)) { | 3039 (leftType.isPrimitive() && leftType == rightType)) { |
3034 return '=='; | 3040 return '=='; |
3035 } | 3041 } |
3036 return null; | 3042 return null; |
3037 } else { | 3043 } else { |
3038 return '==='; | 3044 return '==='; |
3039 } | 3045 } |
3040 } | 3046 } |
OLD | NEW |