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

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
Index: runtime/vm/flow_graph_builder.h
diff --git a/runtime/vm/flow_graph_builder.h b/runtime/vm/flow_graph_builder.h
index 1a3927e3d5f67257f56426162d1cd7edada20159..6fab785c9dacc1bb629a310f80392a04d5abaad9 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 inlining() const { return inlining_context_ != kNotInlining; }
srdjan 2012/08/29 21:31:33 Does this means: can_be_inlined or does it mean th
zerny-google 2012/08/30 07:31:40 It signals that the builder is building a graph to
+ void AddReturnExit(ReturnInstr* return_instr) {
+ if (inlining()) {
+ 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);
@@ -136,6 +155,11 @@ class EffectGraphVisitor : public AstNodeVisitor {
// graph.
PushArgumentInstr* PushArgument(Value* value);
+ // TODO(zerny): This is assuming we actually use all visitors.
Kevin Millikin (Google) 2012/08/29 14:01:04 Not really a TODO, just an assumption.
zerny-google 2012/08/30 07:31:40 Done.
+ void AddReturnExit(ReturnInstr* return_instr) {
+ owner()->AddReturnExit(return_instr);
+ }
+
protected:
Computation* BuildStoreLocal(const LocalVariable& local, Value* value);
Computation* BuildLoadLocal(const LocalVariable& local);

Powered by Google App Engine
This is Rietveld 408576698