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

Unified Diff: runtime/vm/flow_graph_builder.h

Issue 11953076: Move code around in preparation for better inlining. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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
Index: runtime/vm/flow_graph_builder.h
diff --git a/runtime/vm/flow_graph_builder.h b/runtime/vm/flow_graph_builder.h
index 9ecc1d104200492d9e301003c6c9417abeae90ac..b30ad92d6433bff5a3e0bbd623fe520954ff3310 100644
--- a/runtime/vm/flow_graph_builder.h
+++ b/runtime/vm/flow_graph_builder.h
@@ -19,7 +19,28 @@ class ParsedFunction;
// An abstraction of the graph context in which an inlined call occurs.
class InliningContext: public ZoneAllocated {
public:
+ // Create the appropriate inlining context for the flow graph context of a
+ // call.
+ static InliningContext* Create(Definition* call);
+
virtual void AddExit(ReturnInstr* exit) = 0;
+
+ // Inline a flow graph at a call site.
+ //
+ // Assumes the callee graph was computed by BuildGraph with an inlining
+ // context and transformed to SSA with ComputeSSA with a correct virtual
+ // register number, and that the use lists have been correctly computed.
+ //
+ // After inlining the caller graph will correctly have adjusted the
+ // pre/post orders, the dominator tree and the use lists.
+ virtual void ReplaceCall(FlowGraph* caller_graph,
+ Definition* call,
+ FlowGraph* callee_graph) = 0;
+
+ protected:
+ static void PrepareGraphs(FlowGraph* caller_graph,
+ Definition* call,
+ FlowGraph* callee_graph);
};
@@ -30,6 +51,18 @@ class ValueInliningContext: public InliningContext {
public:
ValueInliningContext() : exits_(4) { }
+ virtual void AddExit(ReturnInstr* exit);
+
+ virtual void ReplaceCall(FlowGraph* caller_graph,
+ Definition* call,
+ FlowGraph* callee_graph);
+
+ private:
+ struct Data {
+ BlockEntryInstr* exit_block;
+ ReturnInstr* exit_return;
+ };
+
BlockEntryInstr* ExitBlockAt(intptr_t i) const {
ASSERT(exits_[i].exit_block != NULL);
return exits_[i].exit_block;
@@ -41,17 +74,8 @@ class ValueInliningContext: public InliningContext {
return exits_[i].exit_return->value();
}
- intptr_t NumExits() { return exits_.length(); }
- virtual void AddExit(ReturnInstr* exit);
- void SortExits();
-
- private:
- struct Data {
- BlockEntryInstr* exit_block;
- ReturnInstr* exit_return;
- };
-
static int LowestBlockIdFirst(const Data* a, const Data* b);
+ void SortExits();
GrowableArray<Data> exits_;
};

Powered by Google App Engine
This is Rietveld 408576698