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

Unified Diff: runtime/vm/flow_graph_builder.h

Issue 10911004: Reapply "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 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
srdjan 2012/09/05 17:40:05 Why is this needed? From code it seems that you on
zerny-google 2012/09/07 14:08:43 We will need it to specialize inlining calls in a
+ };
+
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()) {
srdjan 2012/09/05 17:40:05 Why not check for exits_ != NULL instead?
zerny-google 2012/09/07 14:08:43 The exits array might make sense outside an inlini
+ 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.
srdjan 2012/09/05 17:40:05 The comment is not clear, please revise. Maybe des
zerny-google 2012/09/07 14:08:43 Could you clarify this Kevin?
+ 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