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 /** | 7 /** |
8 * A special element for the extra parameter taken by intercepted | 8 * A special element for the extra parameter taken by intercepted |
9 * methods. We need to override [Element.computeType] because our | 9 * methods. We need to override [Element.computeType] because our |
10 * optimizers may look at its declared type. | 10 * optimizers may look at its declared type. |
(...skipping 2882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2893 | 2893 |
2894 HInstruction receiver; | 2894 HInstruction receiver; |
2895 if (node.receiver == null) { | 2895 if (node.receiver == null) { |
2896 receiver = localsHandler.readThis(); | 2896 receiver = localsHandler.readThis(); |
2897 } else { | 2897 } else { |
2898 visit(node.receiver); | 2898 visit(node.receiver); |
2899 receiver = pop(); | 2899 receiver = pop(); |
2900 } | 2900 } |
2901 | 2901 |
2902 List<HInstruction> inputs = <HInstruction>[]; | 2902 List<HInstruction> inputs = <HInstruction>[]; |
2903 Set<ClassElement> interceptedClasses = | |
2904 getInterceptedClassesOn(node, selector); | |
2905 if (interceptedClasses != null) { | |
2906 inputs.add(invokeInterceptor(interceptedClasses, receiver, node)); | |
2907 } | |
2908 inputs.add(receiver); | |
2909 | |
2910 addDynamicSendArgumentsToList(node, inputs); | 2903 addDynamicSendArgumentsToList(node, inputs); |
2911 | 2904 |
2912 pushWithPosition(new HInvokeDynamicMethod(selector, inputs), node); | 2905 HInvokeDynamicMethod invoke = buildInvokeDynamic( |
| 2906 node, selector, receiver, inputs); |
| 2907 pushWithPosition(invoke, node); |
2913 | 2908 |
2914 if (isNotEquals) { | 2909 if (isNotEquals) { |
2915 HNot not = new HNot(popBoolified()); | 2910 HNot not = new HNot(popBoolified()); |
2916 push(not); | 2911 push(not); |
2917 } | 2912 } |
2918 } | 2913 } |
2919 | 2914 |
2920 visitClosureSend(Send node) { | 2915 visitClosureSend(Send node) { |
2921 Selector selector = elements.getSelector(node); | 2916 Selector selector = elements.getSelector(node); |
2922 assert(node.receiver == null); | 2917 assert(node.receiver == null); |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3638 } | 3633 } |
3639 } | 3634 } |
3640 | 3635 |
3641 HInvokeDynamicMethod buildInvokeDynamic(Node node, | 3636 HInvokeDynamicMethod buildInvokeDynamic(Node node, |
3642 Selector selector, | 3637 Selector selector, |
3643 HInstruction receiver, | 3638 HInstruction receiver, |
3644 List<HInstruction> arguments) { | 3639 List<HInstruction> arguments) { |
3645 Set<ClassElement> interceptedClasses = | 3640 Set<ClassElement> interceptedClasses = |
3646 getInterceptedClassesOn(node, selector); | 3641 getInterceptedClassesOn(node, selector); |
3647 List<HInstruction> inputs = <HInstruction>[]; | 3642 List<HInstruction> inputs = <HInstruction>[]; |
3648 if (interceptedClasses != null) { | 3643 bool isIntercepted = interceptedClasses != null; |
| 3644 if (isIntercepted) { |
| 3645 assert(!interceptedClasses.isEmpty); |
3649 inputs.add(invokeInterceptor(interceptedClasses, receiver, node)); | 3646 inputs.add(invokeInterceptor(interceptedClasses, receiver, node)); |
3650 } | 3647 } |
3651 inputs.add(receiver); | 3648 inputs.add(receiver); |
3652 inputs.addAll(arguments); | 3649 inputs.addAll(arguments); |
3653 return new HInvokeDynamicMethod(selector, inputs); | 3650 return new HInvokeDynamicMethod(selector, inputs, isIntercepted); |
3654 } | 3651 } |
3655 | 3652 |
3656 visitSendSet(SendSet node) { | 3653 visitSendSet(SendSet node) { |
3657 Element element = elements[node]; | 3654 Element element = elements[node]; |
3658 if (!Elements.isUnresolved(element) && element.impliesType()) { | 3655 if (!Elements.isUnresolved(element) && element.impliesType()) { |
3659 Identifier selector = node.selector; | 3656 Identifier selector = node.selector; |
3660 generateThrowNoSuchMethod(node, selector.source.slowToString(), | 3657 generateThrowNoSuchMethod(node, selector.source.slowToString(), |
3661 argumentNodes: node.arguments); | 3658 argumentNodes: node.arguments); |
3662 return; | 3659 return; |
3663 } | 3660 } |
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5095 new HSubGraphBlockInformation(elseBranch.graph)); | 5092 new HSubGraphBlockInformation(elseBranch.graph)); |
5096 | 5093 |
5097 HBasicBlock conditionStartBlock = conditionBranch.block; | 5094 HBasicBlock conditionStartBlock = conditionBranch.block; |
5098 conditionStartBlock.setBlockFlow(info, joinBlock); | 5095 conditionStartBlock.setBlockFlow(info, joinBlock); |
5099 SubGraph conditionGraph = conditionBranch.graph; | 5096 SubGraph conditionGraph = conditionBranch.graph; |
5100 HIf branch = conditionGraph.end.last; | 5097 HIf branch = conditionGraph.end.last; |
5101 assert(branch is HIf); | 5098 assert(branch is HIf); |
5102 branch.blockInformation = conditionStartBlock.blockFlow; | 5099 branch.blockInformation = conditionStartBlock.blockFlow; |
5103 } | 5100 } |
5104 } | 5101 } |
OLD | NEW |