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

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

Issue 9391004: Implement cycle-checking and code generation for redirecting constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 10 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
« no previous file with comments | « frog/leg/resolver.dart ('k') | frog/leg/tree/nodes.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 * Run through the initializers and inline all field initializers. Returns the 620 * Run through the initializers and inline all field initializers. Returns the
621 * next constructor to analyze. 621 * next constructor to analyze.
622 */ 622 */
623 FunctionElement analyzeInitializers(Link<Node> initializers) { 623 FunctionElement analyzeInitializers(Link<Node> initializers) {
624 FunctionElement nextConstructor; 624 FunctionElement nextConstructor;
625 for (Link<Node> link = initializers; !link.isEmpty(); link = link.tail) { 625 for (Link<Node> link = initializers; !link.isEmpty(); link = link.tail) {
626 assert(link.head is Send); 626 assert(link.head is Send);
627 if (link.head is !SendSet) { 627 if (link.head is !SendSet) {
628 // A super initializer or constructor redirection. 628 // A super initializer or constructor redirection.
629 Send call = link.head; 629 Send call = link.head;
630 if (Initializers.isSuperConstructorCall(call)) { 630 assert(Initializers.isSuperConstructorCall(call) ||
631 assert(nextConstructor === null); 631 Initializers.isConstructorRedirect(call));
632 nextConstructor = elements[call]; 632 assert(nextConstructor === null);
633 // Visit arguments and map the corresponding parameter value to 633 nextConstructor = elements[call];
634 // the resulting HInstruction value. 634 // Visit arguments and map the corresponding parameter value to
635 forEachArgument(call, nextConstructor, (parameter, node) { 635 // the resulting HInstruction value.
636 visit(node); 636 forEachArgument(call, nextConstructor, (parameter, node) {
637 HInstruction value = pop(); 637 visit(node);
638 localsHandler.updateLocal(parameter, value); 638 HInstruction value = pop();
639 }); 639 localsHandler.updateLocal(parameter, value);
640 } else { 640 });
641 compiler.unimplemented('SsaBuilder.buildFactory redirect');
642 }
643 } else { 641 } else {
644 // A field initializer. 642 // A field initializer.
645 SendSet init = link.head; 643 SendSet init = link.head;
646 Link<Node> arguments = init.arguments; 644 Link<Node> arguments = init.arguments;
647 assert(!arguments.isEmpty() && arguments.tail.isEmpty()); 645 assert(!arguments.isEmpty() && arguments.tail.isEmpty());
648 visit(arguments.head); 646 visit(arguments.head);
649 // We treat the init field-elements like locals. In the context of 647 // We treat the init field-elements like locals. In the context of
650 // the factory this is correct, and simplifies dealing with 648 // the factory this is correct, and simplifies dealing with
651 // parameter-initializers (like A(this.x)). 649 // parameter-initializers (like A(this.x)).
652 localsHandler.updateLocal(elements[init], pop()); 650 localsHandler.updateLocal(elements[init], pop());
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after
2067 } 2065 }
2068 2066
2069 visitCatchBlock(CatchBlock node) { 2067 visitCatchBlock(CatchBlock node) {
2070 visit(node.block); 2068 visit(node.block);
2071 } 2069 }
2072 2070
2073 visitTypedef(Typedef node) { 2071 visitTypedef(Typedef node) {
2074 compiler.unimplemented('SsaBuilder.visitTypedef', node: node); 2072 compiler.unimplemented('SsaBuilder.visitTypedef', node: node);
2075 } 2073 }
2076 } 2074 }
OLDNEW
« no previous file with comments | « frog/leg/resolver.dart ('k') | frog/leg/tree/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698