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

Unified Diff: runtime/vm/flow_graph_builder.h

Issue 9622002: Handle instance field and indexed increment operations. (Closed) Base URL: https://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
« 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 b2d5377ce946e3e76262519337a7b96573883389..405079bdadb3b61d1e9289f6dadd7b4c3ff085e4 100644
--- a/runtime/vm/flow_graph_builder.h
+++ b/runtime/vm/flow_graph_builder.h
@@ -94,14 +94,30 @@ class EffectGraphVisitor : public AstNodeVisitor {
intptr_t next_temp_index,
ZoneGrowableArray<Value*>* values);
+ // Build the load part of a instance field increment. Translates the
+ // receiver and loads the value. The receiver will be named with
+ // start_index, the temporary index of the value is returned (always
+ // start_index+1).
+ int BuildIncrOpFieldLoad(IncrOpInstanceFieldNode* node, int start_index);
+
+ // Build the load part of an indexed increment. Translates the receiver
+ // and index and loads the value. The receiver will be named with
+ // start_index, the index with start_index+1, and the temporary index of
+ // the value is returned (always start_index+2).
+ int BuildIncrOpIndexedLoad(IncrOpIndexedNode* node, int start_index);
+
+ // Build the increment part of an increment operation (add or subtract 1).
+ // The original value is expected to be named with start_index-1, and the
+ // result will be named with start_index.
+ void BuildIncrOpIncrement(Token::Kind kind,
Kevin Millikin (Google) 2012/03/07 13:44:55 I suspect that there is a more general helper (for
+ intptr_t node_id,
+ intptr_t token_index,
+ int start_index);
+
void CloseFragment() { exit_ = NULL; }
intptr_t AllocateTempIndex() { return temp_index_++; }
private:
- // Specify a value as the final result. Does nothing in an effect context
- // but is normally overridden by subclasses.
- virtual void ReturnValue(Value* value) { }
-
// Specify a computation as the final result. Adds a Do instruction to
// the graph, but normally overridden in subclasses.
virtual void ReturnComputation(Computation* computation) {
@@ -133,6 +149,8 @@ class ValueGraphVisitor : public EffectGraphVisitor {
// Visit functions overridden by this class.
virtual void VisitLiteralNode(LiteralNode* node);
virtual void VisitLoadLocalNode(LoadLocalNode* node);
+ virtual void VisitIncrOpInstanceFieldNode(IncrOpInstanceFieldNode* node);
+ virtual void VisitIncrOpIndexedNode(IncrOpIndexedNode* node);
Value* value() const { return value_; }
@@ -184,10 +202,10 @@ class ArgumentGraphVisitor : public ValueGraphVisitor {
//
// We expect that AstNode in test contexts either have only nonlocal exits
// or else control flow has both true and false successors.
-class TestGraphVisitor : public EffectGraphVisitor {
+class TestGraphVisitor : public ValueGraphVisitor {
public:
TestGraphVisitor(FlowGraphBuilder* owner, intptr_t temp_index)
- : EffectGraphVisitor(owner, temp_index),
+ : ValueGraphVisitor(owner, temp_index),
true_successor_address_(NULL),
false_successor_address_(NULL) {
}
@@ -221,7 +239,7 @@ class TestGraphVisitor : public EffectGraphVisitor {
private:
// Construct and concatenate a Branch instruction to this graph fragment.
// Closes the fragment and sets the output parameters.
- void ReturnValue(Value* value);
+ virtual void ReturnValue(Value* value);
// Specify a computation as the final result. Adds a Bind instruction to
// the graph and branches on its value.
« 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