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

Unified Diff: runtime/vm/flow_graph_builder.h

Issue 10893027: Inlining of static calls with trivial function bodies. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | « runtime/vm/flow_graph.cc ('k') | 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 3efa3b30cc39dfb4d7155539b02d6629bbafe723..2e9dc9fc7631afba57c59b9bd651e89ae1418269 100644
--- a/runtime/vm/flow_graph_builder.h
+++ b/runtime/vm/flow_graph_builder.h
@@ -21,7 +21,15 @@ class FlowGraphBuilder: public ValueObject {
public:
explicit FlowGraphBuilder(const ParsedFunction& parsed_function);
+ enum InliningContext {
+ kNotInlining,
+ kValueContext,
+ kEffectContext,
+ kTestContext
+ };
+
FlowGraph* BuildGraph();
+ FlowGraph* BuildGraphForInlining(InliningContext context);
const ParsedFunction& parsed_function() const { return parsed_function_; }
@@ -49,6 +57,14 @@ class FlowGraphBuilder: public ValueObject {
return stack_local_count_;
}
+ bool InInliningContext() const { return inlining_context_ != kNotInlining; }
+ void AddReturnExit(ReturnInstr* return_instr) {
+ if (InInliningContext()) {
+ ASSERT(exits_ != NULL);
+ exits_->Add(return_instr);
+ }
+ }
+
private:
intptr_t parameter_count() const {
return copied_parameter_count_ + non_copied_parameter_count_;
@@ -67,6 +83,8 @@ class FlowGraphBuilder: public ValueObject {
intptr_t last_used_try_index_;
intptr_t try_index_;
GraphEntryInstr* graph_entry_;
+ InliningContext inlining_context_;
+ ZoneGrowableArray<ReturnInstr*>* exits_;
DISALLOW_IMPLICIT_CONSTRUCTORS(FlowGraphBuilder);
};
@@ -104,6 +122,7 @@ class EffectGraphVisitor : public AstNodeVisitor {
bool is_open() const { return is_empty() || exit_ != NULL; }
void Bailout(const char* reason);
+ void InlineBailout(const char* reason);
// Append a graph fragment to this graph. Assumes this graph is open.
void Append(const EffectGraphVisitor& other_fragment);
@@ -134,6 +153,13 @@ class EffectGraphVisitor : public AstNodeVisitor {
// graph.
PushArgumentInstr* PushArgument(Value* value);
+ // This implementation shares state among visitors by using the builder.
+ // The implementation is incorrect if a visitor that hits a return is not
+ // actually added to the graph.
+ void AddReturnExit(ReturnInstr* return_instr) {
+ owner()->AddReturnExit(return_instr);
+ }
+
protected:
Computation* BuildStoreLocal(const LocalVariable& local, Value* value);
Computation* BuildLoadLocal(const LocalVariable& local);
« no previous file with comments | « runtime/vm/flow_graph.cc ('k') | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698