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 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1552 // seen selectors. | 1552 // seen selectors. |
1553 if (target != null && target.isGenerativeConstructorBody()) { | 1553 if (target != null && target.isGenerativeConstructorBody()) { |
1554 methodName = name.slowToString(); | 1554 methodName = name.slowToString(); |
1555 arguments = visitArguments(node.inputs); | 1555 arguments = visitArguments(node.inputs); |
1556 } else { | 1556 } else { |
1557 methodName = backend.namer.instanceMethodInvocationName( | 1557 methodName = backend.namer.instanceMethodInvocationName( |
1558 node.selector.library, name, node.selector); | 1558 node.selector.library, name, node.selector); |
1559 arguments = visitArguments(node.inputs); | 1559 arguments = visitArguments(node.inputs); |
1560 bool inLoop = node.block.enclosingLoopHeader != null; | 1560 bool inLoop = node.block.enclosingLoopHeader != null; |
1561 | 1561 |
1562 // Register this invocation to collect the types used at all call sites. | |
1563 Selector selector = getOptimizedSelectorFor(node, node.selector); | 1562 Selector selector = getOptimizedSelectorFor(node, node.selector); |
1564 // TODO(ngeoffray): Remove the following restriction. Because | 1563 if (node.isInterceptorCall) { |
1565 // the second input of this interceptor call is the actual | |
1566 // receiver (the first is the interceptor), the backend gets | |
1567 // confused. We should pass a list of types instead of a node to | |
1568 // [registerDynamicInvocation]. | |
1569 if (!node.isInterceptorCall) { | |
1570 backend.registerDynamicInvocation(node, selector, types); | |
1571 } else { | |
1572 backend.addInterceptedSelector(selector); | 1564 backend.addInterceptedSelector(selector); |
1573 } | 1565 } |
| 1566 // Register this invocation to collect the types used at all call sites. |
| 1567 backend.registerDynamicInvocation(node, selector, types); |
1574 | 1568 |
1575 // If we don't know what we're calling or if we are calling a getter, | 1569 // If we don't know what we're calling or if we are calling a getter, |
1576 // we need to register that fact that we may be calling a closure | 1570 // we need to register that fact that we may be calling a closure |
1577 // with the same arguments. | 1571 // with the same arguments. |
1578 if (target == null || target.isGetter()) { | 1572 if (target == null || target.isGetter()) { |
1579 // TODO(kasperl): If we have a typed selector for the call, we | 1573 // TODO(kasperl): If we have a typed selector for the call, we |
1580 // may know something about the types of closures that need | 1574 // may know something about the types of closures that need |
1581 // the specific closure call method. | 1575 // the specific closure call method. |
1582 Selector call = new Selector.callClosureFrom(selector); | 1576 Selector call = new Selector.callClosureFrom(selector); |
1583 world.registerDynamicInvocation(call.name, call); | 1577 world.registerDynamicInvocation(call.name, call); |
(...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3049 if (leftType.canBeNull() && rightType.canBeNull()) { | 3043 if (leftType.canBeNull() && rightType.canBeNull()) { |
3050 if (left.isConstantNull() || right.isConstantNull() || | 3044 if (left.isConstantNull() || right.isConstantNull() || |
3051 (leftType.isPrimitive() && leftType == rightType)) { | 3045 (leftType.isPrimitive() && leftType == rightType)) { |
3052 return '=='; | 3046 return '=='; |
3053 } | 3047 } |
3054 return null; | 3048 return null; |
3055 } else { | 3049 } else { |
3056 return '==='; | 3050 return '==='; |
3057 } | 3051 } |
3058 } | 3052 } |
OLD | NEW |