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

Unified Diff: runtime/vm/flow_graph_builder.h

Issue 63903005: Use the VM's graph builder nesting stack for loop depth and context level. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | runtime/vm/flow_graph_builder.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.h
diff --git a/runtime/vm/flow_graph_builder.h b/runtime/vm/flow_graph_builder.h
index f787d4629e3e379ad12db4cfe43b90841ce62363..f9adcd6e935b723714c5f9f5bd14ed89423797f2 100644
--- a/runtime/vm/flow_graph_builder.h
+++ b/runtime/vm/flow_graph_builder.h
@@ -25,6 +25,9 @@ class LocalVariable;
class ParsedFunction;
class String;
+class NestedStatement;
+class TestGraphVisitor;
+
// List of recognized list factories:
// (factory-name-symbol, result-cid, fingerprint).
// TODO(srdjan): Store the values in the snapshot instead.
@@ -106,8 +109,6 @@ class InlineExitCollector: public ZoneAllocated {
};
-class NestedStatement;
-
// Build a flow graph from a parsed function's AST.
class FlowGraphBuilder: public ValueObject {
public:
@@ -128,8 +129,7 @@ class FlowGraphBuilder: public ValueObject {
intptr_t AllocateBlockId() { return ++last_used_block_id_; }
void SetInitialBlockId(intptr_t id) { last_used_block_id_ = id; }
- void set_context_level(intptr_t value) { context_level_ = value; }
- intptr_t context_level() const { return context_level_; }
+ intptr_t context_level() const;
void IncrementLoopDepth() { ++loop_depth_; }
void DecrementLoopDepth() { --loop_depth_; }
@@ -198,7 +198,6 @@ class FlowGraphBuilder: public ValueObject {
ZoneGrowableArray<const Field*>* guarded_fields_;
intptr_t last_used_block_id_;
- intptr_t context_level_;
intptr_t try_index_;
intptr_t catch_try_index_;
intptr_t loop_depth_;
@@ -221,44 +220,6 @@ class FlowGraphBuilder: public ValueObject {
};
-// Base class for a stack of enclosing statements of interest (e.g.,
-// blocks (breakable) and loops (continuable)).
-class NestedStatement : public ValueObject {
- public:
- NestedStatement(FlowGraphBuilder* owner, const SourceLabel* label)
- : owner_(owner),
- label_(label),
- outer_(owner->nesting_stack_),
- break_target_(NULL) {
- // Push on the owner's nesting stack.
- owner->nesting_stack_ = this;
- }
-
- virtual ~NestedStatement() {
- // Pop from the owner's nesting stack.
- ASSERT(owner_->nesting_stack_ == this);
- owner_->nesting_stack_ = outer_;
- }
-
- FlowGraphBuilder* owner() const { return owner_; }
- const SourceLabel* label() const { return label_; }
- NestedStatement* outer() const { return outer_; }
- JoinEntryInstr* break_target() const { return break_target_; }
-
- virtual JoinEntryInstr* BreakTargetFor(SourceLabel* label);
- virtual JoinEntryInstr* ContinueTargetFor(SourceLabel* label);
-
- private:
- FlowGraphBuilder* owner_;
- const SourceLabel* label_;
- NestedStatement* outer_;
-
- JoinEntryInstr* break_target_;
-};
-
-
-class TestGraphVisitor;
-
// Translate an AstNode to a control-flow graph fragment for its effects
// (e.g., a statement or an expression in an effect context). Implements a
// function from an AstNode and next temporary index to a graph fragment
@@ -402,8 +363,8 @@ class EffectGraphVisitor : public AstNodeVisitor {
bool MustSaveRestoreContext(SequenceNode* node) const;
- // Moves parent context into the context register.
- void UnchainContext();
+ // Moves the nth parent context into the context register.
+ void UnchainContexts(intptr_t n);
void CloseFragment() { exit_ = NULL; }
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | runtime/vm/flow_graph_builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698