Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 11879047: Add a new class InvokeDynamicSpecializer and subclasses that know what input types are beneficial f… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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);
kasperl 2013/01/16 07:26:03 That's a lot of indentation.
ngeoffray 2013/01/16 09:02:54 Done.
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
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;
kasperl 2013/01/16 07:26:03 I guess the set cannot be empty?
ngeoffray 2013/01/16 09:02:54 Indeed, it cannot be empty, I added an assert.
3644 if (isIntercepted) {
3649 inputs.add(invokeInterceptor(interceptedClasses, receiver, node)); 3645 inputs.add(invokeInterceptor(interceptedClasses, receiver, node));
3650 } 3646 }
3651 inputs.add(receiver); 3647 inputs.add(receiver);
3652 inputs.addAll(arguments); 3648 inputs.addAll(arguments);
3653 return new HInvokeDynamicMethod(selector, inputs); 3649 return new HInvokeDynamicMethod(selector, inputs, isIntercepted);
3654 } 3650 }
3655 3651
3656 visitSendSet(SendSet node) { 3652 visitSendSet(SendSet node) {
3657 Element element = elements[node]; 3653 Element element = elements[node];
3658 if (!Elements.isUnresolved(element) && element.impliesType()) { 3654 if (!Elements.isUnresolved(element) && element.impliesType()) {
3659 Identifier selector = node.selector; 3655 Identifier selector = node.selector;
3660 generateThrowNoSuchMethod(node, selector.source.slowToString(), 3656 generateThrowNoSuchMethod(node, selector.source.slowToString(),
3661 argumentNodes: node.arguments); 3657 argumentNodes: node.arguments);
3662 return; 3658 return;
3663 } 3659 }
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
5095 new HSubGraphBlockInformation(elseBranch.graph)); 5091 new HSubGraphBlockInformation(elseBranch.graph));
5096 5092
5097 HBasicBlock conditionStartBlock = conditionBranch.block; 5093 HBasicBlock conditionStartBlock = conditionBranch.block;
5098 conditionStartBlock.setBlockFlow(info, joinBlock); 5094 conditionStartBlock.setBlockFlow(info, joinBlock);
5099 SubGraph conditionGraph = conditionBranch.graph; 5095 SubGraph conditionGraph = conditionBranch.graph;
5100 HIf branch = conditionGraph.end.last; 5096 HIf branch = conditionGraph.end.last;
5101 assert(branch is HIf); 5097 assert(branch is HIf);
5102 branch.blockInformation = conditionStartBlock.blockFlow; 5098 branch.blockInformation = conditionStartBlock.blockFlow;
5103 } 5099 }
5104 } 5100 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698