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

Unified Diff: runtime/vm/scopes.h

Issue 9907001: Implement JumpNode for break/continue in for loops. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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
« runtime/vm/flow_graph_builder.cc ('K') | « runtime/vm/flow_graph_builder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scopes.h
===================================================================
--- runtime/vm/scopes.h (revision 5935)
+++ runtime/vm/scopes.h (working copy)
@@ -11,6 +11,7 @@
namespace dart {
+class JoinEntryInstr;
class LocalScope;
class LocalVariable;
class SourceLabel;
@@ -114,7 +115,11 @@
owner_(NULL),
kind_(kind),
continue_label_(),
- break_label_() {
+ break_label_(),
+ is_break_jump_target_(false),
+ join_for_break_(NULL),
+ is_continue_jump_target_(false),
+ join_for_continue_(NULL) {
}
static SourceLabel* New(intptr_t token_index, String* name, Kind kind) {
@@ -139,6 +144,35 @@
Label* break_label() { return &break_label_; }
Label* continue_label() { return &continue_label_; }
+ void SetIsJumpTarget(Token::Kind jump_kind) {
+ ASSERT((jump_kind == Token::kBREAK) || (jump_kind == Token::kCONTINUE));
+ if (jump_kind == Token::kBREAK) {
+ is_break_jump_target_ = true;
+ } else {
+ is_continue_jump_target_ = true;
+ }
+ }
+ bool is_break_jump_target() const { return is_break_jump_target_; }
+ bool is_continue_jump_target() const { return is_continue_jump_target_; }
+
+ void set_join_for_continue(JoinEntryInstr* join) {
+ ASSERT(join_for_continue_ == NULL);
+ join_for_continue_ = join;
+ }
+
+ JoinEntryInstr* join_for_continue() const {
+ return join_for_continue_;
+ }
+
+ void set_join_for_break(JoinEntryInstr* join) {
+ ASSERT(join_for_break_ == NULL);
+ join_for_break_ = join;
+ }
+
+ JoinEntryInstr* join_for_break() const {
+ return join_for_break_;
+ }
+
// Returns the function level of the scope in which the label is defined.
int FunctionLevel() const;
@@ -152,6 +186,10 @@
Kind kind_;
Label continue_label_;
Label break_label_;
+ bool is_break_jump_target_;
+ JoinEntryInstr* join_for_break_;
+ bool is_continue_jump_target_;
+ JoinEntryInstr* join_for_continue_;
static const char* kDefaultLabelName;
DISALLOW_COPY_AND_ASSIGN(SourceLabel);
« runtime/vm/flow_graph_builder.cc ('K') | « runtime/vm/flow_graph_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698