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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart

Issue 848363002: Allow LetCont to bind multiple continuations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dart2js.ir_builder; 5 part of dart2js.ir_builder;
6 6
7 /** 7 /**
8 * This task iterates through all resolved elements and builds [ir.Node]s. The 8 * This task iterates through all resolved elements and builds [ir.Node]s. The
9 * nodes are stored in the [nodes] map and accessible through [hasIr] and 9 * nodes are stored in the [nodes] map and accessible through [hasIr] and
10 * [getIr]. 10 * [getIr].
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 // continuation's binding. The continuation is bound just outside the 461 // continuation's binding. The continuation is bound just outside the
462 // body to satisfy this property without extra analysis. 462 // body to satisfy this property without extra analysis.
463 // As a consequence, the break continuation needs parameters for all 463 // As a consequence, the break continuation needs parameters for all
464 // local variables in scope at the exit from the body. 464 // local variables in scope at the exit from the body.
465 List<ir.Parameter> parameters = 465 List<ir.Parameter> parameters =
466 new List<ir.Parameter>.generate(irBuilder.environment.length, (i) { 466 new List<ir.Parameter>.generate(irBuilder.environment.length, (i) {
467 return new ir.Parameter(irBuilder.environment.index2variable[i]); 467 return new ir.Parameter(irBuilder.environment.index2variable[i]);
468 }); 468 });
469 joinContinuation = new ir.Continuation(parameters); 469 joinContinuation = new ir.Continuation(parameters);
470 irBuilder.invokeFullJoin(joinContinuation, jumps, recursive: false); 470 irBuilder.invokeFullJoin(joinContinuation, jumps, recursive: false);
471 irBuilder.add(new ir.LetCont(joinContinuation, innerBuilder._root)); 471 irBuilder.add(new ir.LetCont(<ir.Continuation>[joinContinuation],
472 innerBuilder._root));
472 for (int i = 0; i < irBuilder.environment.length; ++i) { 473 for (int i = 0; i < irBuilder.environment.length; ++i) {
473 irBuilder.environment.index2value[i] = parameters[i]; 474 irBuilder.environment.index2value[i] = parameters[i];
474 } 475 }
475 } else { 476 } else {
476 if (innerBuilder._root != null) { 477 if (innerBuilder._root != null) {
477 irBuilder.add(innerBuilder._root); 478 irBuilder.add(innerBuilder._root);
478 irBuilder._current = innerBuilder._current; 479 irBuilder._current = innerBuilder._current;
479 irBuilder.environment = innerBuilder.environment; 480 irBuilder.environment = innerBuilder.environment;
480 } 481 }
481 } 482 }
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 ir.Primitive arg; 933 ir.Primitive arg;
933 if (ast.Operator.INCREMENT_OPERATORS.contains(op.source)) { 934 if (ast.Operator.INCREMENT_OPERATORS.contains(op.source)) {
934 arg = irBuilder.buildIntegerLiteral(1); 935 arg = irBuilder.buildIntegerLiteral(1);
935 } else { 936 } else {
936 arg = visit(getAssignArgument()); 937 arg = visit(getAssignArgument());
937 } 938 }
938 valueToStore = new ir.Parameter(null); 939 valueToStore = new ir.Parameter(null);
939 ir.Continuation k = new ir.Continuation([valueToStore]); 940 ir.Continuation k = new ir.Continuation([valueToStore]);
940 ir.Expression invoke = 941 ir.Expression invoke =
941 new ir.InvokeMethod(originalValue, operatorSelector, k, [arg]); 942 new ir.InvokeMethod(originalValue, operatorSelector, k, [arg]);
942 irBuilder.add(new ir.LetCont(k, invoke)); 943 irBuilder.add(new ir.LetCont(<ir.Continuation>[k], invoke));
943 } 944 }
944 945
945 if (Elements.isLocal(element)) { 946 if (Elements.isLocal(element)) {
946 irBuilder.buildLocalSet(element, valueToStore); 947 irBuilder.buildLocalSet(element, valueToStore);
947 } else if ((!node.isSuperCall && Elements.isErroneousElement(element)) || 948 } else if ((!node.isSuperCall && Elements.isErroneousElement(element)) ||
948 Elements.isStaticOrTopLevel(element)) { 949 Elements.isStaticOrTopLevel(element)) {
949 irBuilder.buildStaticSet( 950 irBuilder.buildStaticSet(
950 element, elements.getSelector(node), valueToStore); 951 element, elements.getSelector(node), valueToStore);
951 } else { 952 } else {
952 // Setter or index-setter invocation 953 // Setter or index-setter invocation
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 currentFunction = elements[node]; 1129 currentFunction = elements[node];
1129 if (node.initializers != null) { 1130 if (node.initializers != null) {
1130 insideInitializer = true; 1131 insideInitializer = true;
1131 visit(node.initializers); 1132 visit(node.initializers);
1132 insideInitializer = false; 1133 insideInitializer = false;
1133 } 1134 }
1134 visit(node.body); 1135 visit(node.body);
1135 currentFunction = oldFunction; 1136 currentFunction = oldFunction;
1136 } 1137 }
1137 } 1138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698