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 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 } | 1642 } |
1643 | 1643 |
1644 visitInvokeClosure(HInvokeClosure node) { | 1644 visitInvokeClosure(HInvokeClosure node) { |
1645 Selector call = new Selector.callClosureFrom(node.selector); | 1645 Selector call = new Selector.callClosureFrom(node.selector); |
1646 use(node.receiver); | 1646 use(node.receiver); |
1647 push(jsPropertyCall(pop(), | 1647 push(jsPropertyCall(pop(), |
1648 backend.namer.invocationName(call), | 1648 backend.namer.invocationName(call), |
1649 visitArguments(node.inputs)), | 1649 visitArguments(node.inputs)), |
1650 node); | 1650 node); |
1651 world.registerDynamicInvocation(call.name, call); | 1651 world.registerDynamicInvocation(call.name, call); |
1652 // A closure can also be invoked through [HInvokeDynamicMethod] by | |
1653 // explicitly calling the [:call:] method. Therefore, we must also | |
1654 // register types here to let the backend invalidate wrong | |
1655 // optimizations. | |
1656 backend.registerDynamicInvocation(node, call, types); | |
1657 } | 1652 } |
1658 | 1653 |
1659 visitInvokeStatic(HInvokeStatic node) { | 1654 visitInvokeStatic(HInvokeStatic node) { |
1660 if (node.typeCode() == HInstruction.INVOKE_STATIC_TYPECODE) { | 1655 if (node.typeCode() == HInstruction.INVOKE_STATIC_TYPECODE) { |
1661 // Register this invocation to collect the types used at all call sites. | 1656 // Register this invocation to collect the types used at all call sites. |
1662 backend.registerStaticInvocation(node, types); | 1657 backend.registerStaticInvocation(node, types); |
1663 } | 1658 } |
1664 use(node.target); | 1659 use(node.target); |
1665 push(new js.Call(pop(), visitArguments(node.inputs)), node); | 1660 push(new js.Call(pop(), visitArguments(node.inputs)), node); |
1666 } | 1661 } |
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3019 if (leftType.canBeNull() && rightType.canBeNull()) { | 3014 if (leftType.canBeNull() && rightType.canBeNull()) { |
3020 if (left.isConstantNull() || right.isConstantNull() || | 3015 if (left.isConstantNull() || right.isConstantNull() || |
3021 (leftType.isPrimitive() && leftType == rightType)) { | 3016 (leftType.isPrimitive() && leftType == rightType)) { |
3022 return '=='; | 3017 return '=='; |
3023 } | 3018 } |
3024 return null; | 3019 return null; |
3025 } else { | 3020 } else { |
3026 return '==='; | 3021 return '==='; |
3027 } | 3022 } |
3028 } | 3023 } |
OLD | NEW |