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

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

Issue 827763003: Reapply "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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 // continuation's binding. The continuation is bound just outside the 459 // continuation's binding. The continuation is bound just outside the
460 // body to satisfy this property without extra analysis. 460 // body to satisfy this property without extra analysis.
461 // As a consequence, the break continuation needs parameters for all 461 // As a consequence, the break continuation needs parameters for all
462 // local variables in scope at the exit from the body. 462 // local variables in scope at the exit from the body.
463 List<ir.Parameter> parameters = 463 List<ir.Parameter> parameters =
464 new List<ir.Parameter>.generate(irBuilder.environment.length, (i) { 464 new List<ir.Parameter>.generate(irBuilder.environment.length, (i) {
465 return new ir.Parameter(irBuilder.environment.index2variable[i]); 465 return new ir.Parameter(irBuilder.environment.index2variable[i]);
466 }); 466 });
467 joinContinuation = new ir.Continuation(parameters); 467 joinContinuation = new ir.Continuation(parameters);
468 irBuilder.invokeFullJoin(joinContinuation, jumps, recursive: false); 468 irBuilder.invokeFullJoin(joinContinuation, jumps, recursive: false);
469 irBuilder.add(new ir.LetCont(joinContinuation, innerBuilder._root)); 469 irBuilder.add(new ir.LetCont(<ir.Continuation>[joinContinuation],
470 innerBuilder._root));
470 for (int i = 0; i < irBuilder.environment.length; ++i) { 471 for (int i = 0; i < irBuilder.environment.length; ++i) {
471 irBuilder.environment.index2value[i] = parameters[i]; 472 irBuilder.environment.index2value[i] = parameters[i];
472 } 473 }
473 } else { 474 } else {
474 if (innerBuilder._root != null) { 475 if (innerBuilder._root != null) {
475 irBuilder.add(innerBuilder._root); 476 irBuilder.add(innerBuilder._root);
476 irBuilder._current = innerBuilder._current; 477 irBuilder._current = innerBuilder._current;
477 irBuilder.environment = innerBuilder.environment; 478 irBuilder.environment = innerBuilder.environment;
478 } 479 }
479 } 480 }
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 ir.Primitive arg; 931 ir.Primitive arg;
931 if (ast.Operator.INCREMENT_OPERATORS.contains(op.source)) { 932 if (ast.Operator.INCREMENT_OPERATORS.contains(op.source)) {
932 arg = irBuilder.buildIntegerLiteral(1); 933 arg = irBuilder.buildIntegerLiteral(1);
933 } else { 934 } else {
934 arg = visit(getAssignArgument()); 935 arg = visit(getAssignArgument());
935 } 936 }
936 valueToStore = new ir.Parameter(null); 937 valueToStore = new ir.Parameter(null);
937 ir.Continuation k = new ir.Continuation([valueToStore]); 938 ir.Continuation k = new ir.Continuation([valueToStore]);
938 ir.Expression invoke = 939 ir.Expression invoke =
939 new ir.InvokeMethod(originalValue, operatorSelector, k, [arg]); 940 new ir.InvokeMethod(originalValue, operatorSelector, k, [arg]);
940 irBuilder.add(new ir.LetCont(k, invoke)); 941 irBuilder.add(new ir.LetCont(<ir.Continuation>[k], invoke));
941 } 942 }
942 943
943 if (Elements.isLocal(element)) { 944 if (Elements.isLocal(element)) {
944 irBuilder.buildLocalSet(element, valueToStore); 945 irBuilder.buildLocalSet(element, valueToStore);
945 } else if ((!node.isSuperCall && Elements.isErroneous(element)) || 946 } else if ((!node.isSuperCall && Elements.isErroneous(element)) ||
946 Elements.isStaticOrTopLevel(element)) { 947 Elements.isStaticOrTopLevel(element)) {
947 irBuilder.buildStaticSet( 948 irBuilder.buildStaticSet(
948 element, elements.getSelector(node), valueToStore); 949 element, elements.getSelector(node), valueToStore);
949 } else { 950 } else {
950 // Setter or index-setter invocation 951 // Setter or index-setter invocation
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 currentFunction = elements[node]; 1150 currentFunction = elements[node];
1150 if (node.initializers != null) { 1151 if (node.initializers != null) {
1151 insideInitializer = true; 1152 insideInitializer = true;
1152 visit(node.initializers); 1153 visit(node.initializers);
1153 insideInitializer = false; 1154 insideInitializer = false;
1154 } 1155 }
1155 visit(node.body); 1156 visit(node.body);
1156 currentFunction = oldFunction; 1157 currentFunction = oldFunction;
1157 } 1158 }
1158 } 1159 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698