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

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

Issue 11415287: noSuchMethod generated for super calls (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 2615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2626 2626
2627 void pushInvokeHelper4(Element helper, HInstruction a0, HInstruction a1, 2627 void pushInvokeHelper4(Element helper, HInstruction a0, HInstruction a1,
2628 HInstruction a2, HInstruction a3) { 2628 HInstruction a2, HInstruction a3) {
2629 HInstruction reference = new HStatic(helper); 2629 HInstruction reference = new HStatic(helper);
2630 add(reference); 2630 add(reference);
2631 List<HInstruction> inputs = <HInstruction>[reference, a0, a1, a2, a3]; 2631 List<HInstruction> inputs = <HInstruction>[reference, a0, a1, a2, a3];
2632 HInstruction result = new HInvokeStatic(inputs); 2632 HInstruction result = new HInvokeStatic(inputs);
2633 push(result); 2633 push(result);
2634 } 2634 }
2635 2635
2636 void pushInvokeHelper5(Element helper, HInstruction a0, HInstruction a1,
2637 HInstruction a2, HInstruction a3, HInstruction a4) {
2638 HInstruction reference = new HStatic(helper);
2639 add(reference);
2640 List<HInstruction> inputs = <HInstruction>[reference, a0, a1, a2, a3, a4];
2641 HInstruction result = new HInvokeStatic(inputs);
2642 push(result);
2643 }
2644
2636 visitOperatorSend(node) { 2645 visitOperatorSend(node) {
2637 assert(node.selector is Operator); 2646 assert(node.selector is Operator);
2638 if (!methodInterceptionEnabled) { 2647 if (!methodInterceptionEnabled) {
2639 visitDynamicSend(node); 2648 visitDynamicSend(node);
2640 return; 2649 return;
2641 } 2650 }
2642 2651
2643 Operator op = node.selector; 2652 Operator op = node.selector;
2644 if (const SourceString("[]") == op.source) { 2653 if (const SourceString("[]") == op.source) {
2645 HStatic target = new HStatic(interceptors.getIndexInterceptor()); 2654 HStatic target = new HStatic(interceptors.getIndexInterceptor());
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
3024 } else if (name == const SourceString('JS_CALL_IN_ISOLATE')) { 3033 } else if (name == const SourceString('JS_CALL_IN_ISOLATE')) {
3025 handleForeignJsCallInIsolate(node); 3034 handleForeignJsCallInIsolate(node);
3026 } else if (name == const SourceString('DART_CLOSURE_TO_JS')) { 3035 } else if (name == const SourceString('DART_CLOSURE_TO_JS')) {
3027 handleForeignDartClosureToJs(node); 3036 handleForeignDartClosureToJs(node);
3028 } else { 3037 } else {
3029 throw "Unknown foreign: ${selector}"; 3038 throw "Unknown foreign: ${selector}";
3030 } 3039 }
3031 } 3040 }
3032 3041
3033 generateSuperNoSuchMethodSend(Send node) { 3042 generateSuperNoSuchMethodSend(Send node) {
3043 Selector selector = elements.getSelector(node);
3044 SourceString name = selector.name;
3045 compiler.enqueuer.codegen.registerDynamicInvocation(name, selector);
ngeoffray 2012/12/06 22:46:09 Why do you need this? Because you're creating an i
Johnni Winther 2012/12/11 14:26:41 Removed.
3046
3034 ClassElement cls = work.element.getEnclosingClass(); 3047 ClassElement cls = work.element.getEnclosingClass();
3035 Element element = cls.lookupSuperMember(Compiler.NO_SUCH_METHOD); 3048 Element element = cls.lookupSuperMember(Compiler.NO_SUCH_METHOD);
3036 HStatic target = new HStatic(element); 3049 HStatic target = new HStatic(element);
3037 add(target); 3050 add(target);
3038 HInstruction self = localsHandler.readThis(); 3051 HInstruction self = localsHandler.readThis();
3039 Identifier identifier = node.selector.asIdentifier(); 3052 Constant nameConstant = constantSystem.createString(
3040 String name = identifier.source.slowToString(); 3053 new DartString.literal(name.slowToString()), node);
3041 // TODO(ahe): Add the arguments to this list. 3054
3042 push(new HLiteralList([])); 3055 String internalName = backend.namer.instanceMethodInvocationName(
3043 Constant nameConstant = 3056 currentLibrary, name, selector);
3044 constantSystem.createString(new DartString.literal(name), node); 3057 Constant internalNameConstant =
3058 constantSystem.createString(new DartString.literal(internalName), node);
3059
3060 Element createInvocationMirror =
3061 compiler.findHelper(Compiler.CREATE_INVOCATION_MIRROR);
3062
3063 var arguments = new List<HInstruction>();
3064 addGenericSendArgumentsToList(node.arguments, arguments);
3065 var argumentsInstruction = new HLiteralList(arguments);
3066 add(argumentsInstruction);
3067
3068 var argumentNames = new List<HInstruction>();
3069 for (SourceString argumentName in selector.namedArguments) {
3070 Constant argumentNameConstant =
3071 constantSystem.createString(new DartString.literal(
3072 argumentName.slowToString()), node);
3073 argumentNames.add(graph.addConstant(argumentNameConstant));
3074 }
3075 var argumentNamesInstruction = new HLiteralList(argumentNames);
3076 add(argumentNamesInstruction);
3077
3078 Constant kindConstant =
3079 constantSystem.createInt(selector.invocationMirrorKind);
3080
3081 pushInvokeHelper5(createInvocationMirror,
3082 graph.addConstant(nameConstant),
3083 graph.addConstant(internalNameConstant),
3084 graph.addConstant(kindConstant),
3085 argumentsInstruction,
3086 argumentNamesInstruction);
3087
3045 var inputs = <HInstruction>[ 3088 var inputs = <HInstruction>[
3046 target, 3089 target,
3047 self, 3090 self,
3048 graph.addConstant(nameConstant),
3049 pop()]; 3091 pop()];
3050 push(new HInvokeSuper(inputs)); 3092 push(new HInvokeSuper(inputs));
3051 } 3093 }
3052 3094
3053 visitSend(Send node) { 3095 visitSend(Send node) {
3054 Element element = elements[node]; 3096 Element element = elements[node];
3055 if (element != null && identical(element, work.element)) { 3097 if (element != null && identical(element, work.element)) {
3056 graph.isRecursiveMethod = true; 3098 graph.isRecursiveMethod = true;
3057 } 3099 }
3058 super.visitSend(node); 3100 super.visitSend(node);
(...skipping 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after
4957 new HSubGraphBlockInformation(elseBranch.graph)); 4999 new HSubGraphBlockInformation(elseBranch.graph));
4958 5000
4959 HBasicBlock conditionStartBlock = conditionBranch.block; 5001 HBasicBlock conditionStartBlock = conditionBranch.block;
4960 conditionStartBlock.setBlockFlow(info, joinBlock); 5002 conditionStartBlock.setBlockFlow(info, joinBlock);
4961 SubGraph conditionGraph = conditionBranch.graph; 5003 SubGraph conditionGraph = conditionBranch.graph;
4962 HIf branch = conditionGraph.end.last; 5004 HIf branch = conditionGraph.end.last;
4963 assert(branch is HIf); 5005 assert(branch is HIf);
4964 branch.blockInformation = conditionStartBlock.blockFlow; 5006 branch.blockInformation = conditionStartBlock.blockFlow;
4965 } 5007 }
4966 } 5008 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698