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

Unified Diff: pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart

Issue 853083005: Revert "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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
index 2cf117256d297e5931e77e8e0916c9460e0b6c97..f6eacc4a72a668e8ebc78c5844abf31f7c991e3b 100644
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
@@ -359,34 +359,22 @@ class Builder extends cps_ir.Visitor<Node> {
}
Statement visitLetCont(cps_ir.LetCont node) {
- // Introduce labels for continuations that need them.
- for (cps_ir.Continuation continuation in node.continuations) {
- if (continuation.hasMultipleUses) {
- labels[continuation] = new Label();
- }
+ Label label;
+ if (node.continuation.hasMultipleUses) {
+ label = new Label();
+ labels[node.continuation] = label;
}
Statement body = visit(node.body);
- // Continuations are bound at the same level, but they have to be
- // translated as if nested. This is because the body can invoke any
- // of them from anywhere, so it must be nested inside all of them.
- //
- // The continuation bodies are not always translated directly here because
- // they may have been already translated:
+ // The continuation's body is not always translated directly here because
+ // it may have been already translated:
// * For singly-used continuations, the continuation's body is
// translated at the site of the continuation invocation.
// * For recursive continuations, there is a single non-recursive
// invocation. The continuation's body is translated at the site
// of the non-recursive continuation invocation.
// See visitInvokeContinuation for the implementation.
- Statement current = body;
- for (cps_ir.Continuation continuation in node.continuations.reversed) {
- Label label = labels[continuation];
- if (label != null && !continuation.isRecursive) {
- current =
- new LabeledStatement(label, current, visit(continuation.body));
- }
- }
- return current;
+ if (label == null || node.continuation.isRecursive) return body;
+ return new LabeledStatement(label, body, visit(node.continuation.body));
}
Statement visitInvokeStatic(cps_ir.InvokeStatic node) {
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/type_propagation.dart ('k') | tests/compiler/dart2js/backend_dart/opt_constprop_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698