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

Unified Diff: runtime/vm/flow_graph_builder.h

Issue 10702092: Simplify adding of computations to the flow graph. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »
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 3395428180f5ebf94d8a75939c355f6df1595d40..62a97b0b4021962f38f0d096d25420261be3998c 100644
--- a/runtime/vm/flow_graph_builder.h
+++ b/runtime/vm/flow_graph_builder.h
@@ -114,7 +114,12 @@ class EffectGraphVisitor : public AstNodeVisitor {
// Append a graph fragment to this graph. Assumes this graph is open.
void Append(const EffectGraphVisitor& other_fragment);
- // Append a single instruction. Assumes this graph is open.
+ // Append a computation with one use. Assumes this graph is open.
+ UseVal* Bind(Computation* computation);
+ // Append a computation with no uses. Assumes this graph is open.
+ void Do(Computation* computation);
+ // Append a single (non-Bind, non-Do) instruction. Assumes this graph is
+ // open.
void AddInstruction(Instruction* instruction);
// Append a 'diamond' branch and join to this graph, depending on which
@@ -140,7 +145,7 @@ class EffectGraphVisitor : public AstNodeVisitor {
// Creates an instantiated type argument vector used in preparation of an
// allocation call.
// May be called only if allocating an object of a parameterized class.
- BindInstr* BuildInstantiatedTypeArguments(
+ Value* BuildInstantiatedTypeArguments(
intptr_t token_pos,
const AbstractTypeArguments& type_arguments);
@@ -196,7 +201,7 @@ class EffectGraphVisitor : public AstNodeVisitor {
virtual void CompiletimeStringInterpolation(const Function& interpol_func,
const Array& literals);
- BindInstr* BuildObjectAllocation(ConstructorCallNode* node);
+ Value* BuildObjectAllocation(ConstructorCallNode* node);
void BuildConstructorCall(ConstructorCallNode* node, Value* alloc_value);
void BuildStoreContext(const LocalVariable& variable);
@@ -212,7 +217,7 @@ class EffectGraphVisitor : public AstNodeVisitor {
// Specify a computation as the final result. Adds a Do instruction to
// the graph, but normally overridden in subclasses.
virtual void ReturnComputation(Computation* computation) {
- AddInstruction(new DoInstr(computation));
+ Do(computation);
}
// Shared global state.
@@ -267,9 +272,7 @@ class ValueGraphVisitor : public EffectGraphVisitor {
// the graph and returns its temporary value (i.e., set the output
// parameters).
virtual void ReturnComputation(Computation* computation) {
- BindInstr* defn = new BindInstr(computation);
- AddInstruction(defn);
- ReturnValue(new UseVal(defn));
+ ReturnValue(Bind(computation));
}
virtual void CompiletimeStringInterpolation(const Function& interpol_func,
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698