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

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

Issue 1291333002: Revert "dart2js cps: Compile some loops as 'for' loops." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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_nodes.dart
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
index ed91773ef1aadac8ce238a4c89f7138e44e7e123..8f0e85666c0f69773ef1daf68001d334d27bb93c 100644
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_nodes.dart
@@ -446,7 +446,7 @@ class FunctionExpression extends Expression {
}
}
-/// A [LabeledStatement] or [WhileTrue] or [For].
+/// A [LabeledStatement] or [WhileTrue] or [WhileCondition].
abstract class JumpTarget extends Statement {
Label get label;
Statement get body;
@@ -472,7 +472,7 @@ class LabeledStatement extends JumpTarget {
}
}
-/// A [WhileTrue] or [For] loop.
+/// A [WhileTrue] or [WhileCondition] loop.
abstract class Loop extends JumpTarget {
}
@@ -496,36 +496,30 @@ class WhileTrue extends Loop {
}
/**
- * A loop with a condition and update expressions. If there are any update
- * expressions, this generates a for loop, otherwise a while loop.
- *
- * When the condition is false, control resumes at the [next] statement.
+ * A while loop with a condition. If the condition is false, control resumes
+ * at the [next] statement.
*
* It is NOT valid to target this statement with a [Break].
* The only way to reach [next] is for the condition to evaluate to false.
*
- * [For] statements are introduced in the [LoopRewriter] and are
+ * [WhileCondition] statements are introduced in the [LoopRewriter] and is
* assumed not to occur before then.
*/
-class For extends Loop {
+class WhileCondition extends Loop {
final Label label;
Expression condition;
- List<Expression> updates;
Statement body;
Statement next;
- For(this.label,
- this.condition,
- this.updates,
- this.body,
- this.next) {
+ WhileCondition(this.label, this.condition, this.body,
+ this.next) {
assert(label.binding == null);
label.binding = this;
}
- accept(StatementVisitor visitor) => visitor.visitFor(this);
+ accept(StatementVisitor visitor) => visitor.visitWhileCondition(this);
accept1(StatementVisitor1 visitor, arg) {
- return visitor.visitFor(this, arg);
+ return visitor.visitWhileCondition(this, arg);
}
}
@@ -553,7 +547,7 @@ class Break extends Jump {
}
/**
- * A continue to an enclosing [WhileTrue] or [For] loop.
+ * A continue to an enclosing [WhileTrue] or [WhileCondition] loop.
* The continue targets the loop's body.
*/
class Continue extends Jump {
@@ -1019,7 +1013,7 @@ abstract class StatementVisitor<S> {
S visitContinue(Continue node);
S visitIf(If node);
S visitWhileTrue(WhileTrue node);
- S visitFor(For node);
+ S visitWhileCondition(WhileCondition node);
S visitExpressionStatement(ExpressionStatement node);
S visitTry(Try node);
S visitUnreachable(Unreachable node);
@@ -1036,7 +1030,7 @@ abstract class StatementVisitor1<S, A> {
S visitContinue(Continue node, A arg);
S visitIf(If node, A arg);
S visitWhileTrue(WhileTrue node, A arg);
- S visitFor(For node, A arg);
+ S visitWhileCondition(WhileCondition node, A arg);
S visitExpressionStatement(ExpressionStatement node, A arg);
S visitTry(Try node, A arg);
S visitUnreachable(Unreachable node, A arg);
@@ -1146,9 +1140,8 @@ abstract class RecursiveVisitor implements StatementVisitor, ExpressionVisitor {
visitStatement(node.body);
}
- visitFor(For node) {
+ visitWhileCondition(WhileCondition node) {
visitExpression(node.condition);
- node.updates.forEach(visitExpression);
visitStatement(node.body);
visitStatement(node.next);
}
@@ -1378,9 +1371,8 @@ class RecursiveTransformer extends Transformer {
return node;
}
- visitFor(For node) {
+ visitWhileCondition(WhileCondition node) {
node.condition = visitExpression(node.condition);
- _replaceExpressions(node.updates);
node.body = visitStatement(node.body);
node.next = visitStatement(node.next);
return node;
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/tree_ir_integrity.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698