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

Side by Side Diff: frog/leg/ssa/builder.dart

Issue 9166010: Implement super calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class Interceptors { 5 class Interceptors {
6 Compiler compiler; 6 Compiler compiler;
7 Interceptors(Compiler this.compiler); 7 Interceptors(Compiler this.compiler);
8 8
9 SourceString mapOperatorToMethodName(Operator op) { 9 SourceString mapOperatorToMethodName(Operator op) {
10 String name = op.source.stringValue; 10 String name = op.source.stringValue;
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 compiler.registerInstantiatedClass(globalizedClosureElement); 544 compiler.registerInstantiatedClass(globalizedClosureElement);
545 push(new HForeignNew(globalizedClosureElement, <HInstruction>[])); 545 push(new HForeignNew(globalizedClosureElement, <HInstruction>[]));
546 } 546 }
547 547
548 visitIdentifier(Identifier node) { 548 visitIdentifier(Identifier node) {
549 if (node.isThis()) { 549 if (node.isThis()) {
550 if (thisDefinition === null) { 550 if (thisDefinition === null) {
551 compiler.unimplemented("Ssa.visitIdentifier.", node: node); 551 compiler.unimplemented("Ssa.visitIdentifier.", node: node);
552 } 552 }
553 stack.add(thisDefinition); 553 stack.add(thisDefinition);
554 } else if (node.isSuper()) {
555 // super should not be visited as an identifier.
556 compiler.internalError("unexpected identifier: super", node: node);
554 } else { 557 } else {
555 Element element = elements[node]; 558 Element element = elements[node];
556 compiler.ensure(element !== null); 559 compiler.ensure(element !== null);
557 HInstruction def = definitions[element]; 560 HInstruction def = definitions[element];
558 if (def === null) { 561 if (def === null) {
559 compiler.unimplemented("Ssa.visitIdentifier.", node: node); 562 compiler.unimplemented("Ssa.visitIdentifier.", node: node);
560 } 563 }
561 stack.add(def); 564 stack.add(def);
562 } 565 }
563 } 566 }
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 Expression expression = link.head; 985 Expression expression = link.head;
983 disableMethodInterception(); 986 disableMethodInterception();
984 visit(expression); 987 visit(expression);
985 enableMethodInterception(); 988 enableMethodInterception();
986 break; 989 break;
987 default: 990 default:
988 throw "Unknown foreign: ${node.selector}"; 991 throw "Unknown foreign: ${node.selector}";
989 } 992 }
990 } 993 }
991 994
995 visitSuperSend(Send node) {
996 Element element = elements[node];
997 HStatic target = new HStatic(element);
998 HThis context = thisDefinition;
999 if (context === null) {
1000 compiler.unimplemented("Ssa.visitSuperSend without thisDefinition.",
1001 node: node);
1002 }
1003 add(target);
1004 var inputs = <HInstruction>[target, context];
1005 addVisitedSendArgumentsToList(node.arguments, inputs);
1006 push(new HInvokeSuper(inputs));
1007 }
1008
992 visitStaticSend(Send node) { 1009 visitStaticSend(Send node) {
993 Element element = elements[node]; 1010 Element element = elements[node];
994 HStatic target = new HStatic(element); 1011 HStatic target = new HStatic(element);
995 add(target); 1012 add(target);
996 var inputs = <HInstruction>[]; 1013 var inputs = <HInstruction>[];
997 inputs.add(target); 1014 inputs.add(target);
998 addVisitedSendArgumentsToList(node.arguments, inputs); 1015 addVisitedSendArgumentsToList(node.arguments, inputs);
999 push(new HInvokeStatic(inputs)); 1016 push(new HInvokeStatic(inputs));
1000 } 1017 }
1001 1018
1002 visitSend(Send node) { 1019 visitSend(Send node) {
1003 if (node.selector is Operator) { 1020 if (node.selector is Operator) {
1004 visitOperatorSend(node); 1021 visitOperatorSend(node);
1005 } else if (node.isPropertyAccess) { 1022 } else if (node.isPropertyAccess) {
1006 generateGetter(node, elements[node]); 1023 generateGetter(node, elements[node]);
1007 } else if (Elements.isClosureSend(node, elements)) { 1024 } else if (Elements.isClosureSend(node, elements)) {
1008 visitClosureSend(node); 1025 visitClosureSend(node);
1026 } else if (node.isSuperCall) {
1027 visitSuperSend(node);
1009 } else { 1028 } else {
1010 Element element = elements[node]; 1029 Element element = elements[node];
1011 if (element === null) { 1030 if (element === null) {
1012 // Example: f() with 'f' unbound. 1031 // Example: f() with 'f' unbound.
1013 // This can only happen inside an instance method. 1032 // This can only happen inside an instance method.
1014 visitDynamicSend(node); 1033 visitDynamicSend(node);
1015 } else if (element.isInstanceMember()) { 1034 } else if (element.isInstanceMember()) {
1016 // Example: f() with 'f' bound to instance method. 1035 // Example: f() with 'f' bound to instance method.
1017 visitDynamicSend(node); 1036 visitDynamicSend(node);
1018 } else if (element.kind === ElementKind.FOREIGN) { 1037 } else if (element.kind === ElementKind.FOREIGN) {
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 } 1403 }
1385 1404
1386 visitCatchBlock(CatchBlock node) { 1405 visitCatchBlock(CatchBlock node) {
1387 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node); 1406 compiler.unimplemented('SsaBuilder.visitCatchBlock', node: node);
1388 } 1407 }
1389 1408
1390 visitTypedef(Typedef node) { 1409 visitTypedef(Typedef node) {
1391 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); 1410 compiler.unimplemented('SsaBuilder.visitTypedef', node: node);
1392 } 1411 }
1393 } 1412 }
OLDNEW
« frog/leg/resolver.dart ('K') | « frog/leg/resolver.dart ('k') | frog/leg/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698