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

Unified Diff: frog/leg/ssa/nodes.dart

Issue 9718034: Continue for simple loops (while/for). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments. Created 8 years, 9 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
« no previous file with comments | « frog/leg/ssa/codegen.dart ('k') | frog/leg/ssa/tracer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/ssa/nodes.dart
diff --git a/frog/leg/ssa/nodes.dart b/frog/leg/ssa/nodes.dart
index 4d7c3a17a1d247b60e48eec0937e55663c1e930f..5f34feb86b343434c31f7caaee8abe1a2a538c4f 100644
--- a/frog/leg/ssa/nodes.dart
+++ b/frog/leg/ssa/nodes.dart
@@ -13,6 +13,7 @@ interface HVisitor<R> {
R visitBoundsCheck(HBoundsCheck node);
R visitBreak(HBreak node);
R visitConstant(HConstant node);
+ R visitContinue(HContinue node);
R visitDivide(HDivide node);
R visitEquals(HEquals node);
R visitExit(HExit node);
@@ -256,6 +257,7 @@ class HBaseVisitor extends HGraphVisitor implements HVisitor {
visitBoolify(HBoolify node) => visitInstruction(node);
visitBoundsCheck(HBoundsCheck node) => visitCheck(node);
visitBreak(HBreak node) => visitGoto(node);
+ visitContinue(HContinue node) => visitGoto(node);
visitCheck(HCheck node) => visitInstruction(node);
visitConstant(HConstant node) => visitInstruction(node);
visitDivide(HDivide node) => visitBinaryArithmetic(node);
@@ -653,26 +655,26 @@ class HBasicBlock extends HInstructionList implements Hashable {
}
}
-class HBlockInformation {
- // Just a marker class.
-}
-
-class HLabeledBlockInformation extends HBlockInformation {
+class HLabeledBlockInformation {
final SubGraph body;
final HBasicBlock joinBlock;
final List<LabelElement> labels;
final TargetElement target;
+ final bool isContinue;
HLabeledBlockInformation(this.body, this.joinBlock,
- List<LabelElement> labels) :
+ List<LabelElement> labels,
+ [this.isContinue = false]) :
this.labels = labels, this.target = labels[0].target;
- // For creating block information when there are no explicit labels.
- HLabeledBlockInformation.implicit(this.body, this.joinBlock, this.target) :
- this.labels = const<LabelElement>[];
+ HLabeledBlockInformation.implicit(this.body,
+ this.joinBlock,
+ this.target,
+ [this.isContinue = false])
+ : this.labels = const<LabelElement>[];
}
-class HLoopInformation extends HBlockInformation {
+class HLoopInformation {
final HBasicBlock header;
final List<HBasicBlock> blocks;
final List<HBasicBlock> backEdges;
@@ -1611,15 +1613,23 @@ class HGoto extends HControlFlow {
}
class HBreak extends HGoto {
- // Target is either a LabelElement or a TargetElement.
final TargetElement target;
final LabelElement label;
HBreak(this.target) : label = null;
HBreak.toLabel(LabelElement label) : label = label, target = label.target;
- toString() => (target is LabelElement) ? 'break ${label.labelName}' : 'break';
+ toString() => (label !== null) ? 'break ${label.labelName}' : 'break';
accept(HVisitor visitor) => visitor.visitBreak(this);
}
+class HContinue extends HGoto {
+ final TargetElement target;
+ final LabelElement label;
+ HContinue(this.target) : label = null;
+ HContinue.toLabel(LabelElement label) : label = label, target = label.target;
+ toString() => (label !== null) ? 'continue ${label.labelName}' : 'continue';
+ accept(HVisitor visitor) => visitor.visitContinue(this);
+}
+
class HTry extends HControlFlow {
HParameterValue exception;
HBasicBlock finallyBlock;
« no previous file with comments | « frog/leg/ssa/codegen.dart ('k') | frog/leg/ssa/tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698