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

Unified Diff: runtime/vm/flow_graph_inliner.cc

Issue 790213004: Add inlining ranges/intervals to code objects so that we can map a pc to the inlined stack. The map… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years 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_inliner.cc
===================================================================
--- runtime/vm/flow_graph_inliner.cc (revision 42443)
+++ runtime/vm/flow_graph_inliner.cc (working copy)
@@ -474,10 +474,11 @@
class CallSiteInliner : public ValueObject {
public:
- explicit CallSiteInliner(FlowGraph* flow_graph)
- : caller_graph_(flow_graph),
+ explicit CallSiteInliner(FlowGraphInliner* inliner)
+ : inliner_(inliner),
+ caller_graph_(inliner->flow_graph()),
inlined_(false),
- initial_size_(flow_graph->InstructionCount()),
+ initial_size_(inliner->flow_graph()->InstructionCount()),
inlined_size_(0),
inlined_recursive_call_(false),
inlining_depth_(1),
@@ -811,7 +812,7 @@
}
// Inline dispatcher methods regardless of the current depth.
- intptr_t depth =
+ const intptr_t depth =
(function.IsInvokeFieldDispatcher() ||
function.IsNoSuchMethodDispatcher()) ? 0 : inlining_depth_;
collected_call_sites_->FindCallSites(callee_graph, depth, &inlined_info_);
@@ -843,6 +844,8 @@
// caller's list of deferred prefixes.
caller_graph()->AddToDeferredPrefixes(callee_graph->deferred_prefixes());
+ FlowGraphInliner::SetInliningId(*callee_graph,
+ inliner_->NextInlineId(callee_graph->parsed_function()->function()));
// We allocate a ZoneHandle for the unoptimized code so that it cannot be
// disconnected from its function during the rest of compilation.
Code::ZoneHandle(unoptimized_code.raw());
@@ -1230,6 +1233,7 @@
return argument_names_count == match_count;
}
+ FlowGraphInliner* inliner_;
FlowGraph* caller_graph_;
bool inlined_;
const intptr_t initial_size_;
@@ -1730,6 +1734,24 @@
}
+// TODO(srdjan): This is only needed when disassembling and/or profiling.
+void FlowGraphInliner::SetInliningId(const FlowGraph& flow_graph,
+ intptr_t inlining_id) {
+ for (BlockIterator block_it = flow_graph.postorder_iterator();
+ !block_it.Done();
+ block_it.Advance()) {
+ for (ForwardInstructionIterator it(block_it.Current());
+ !it.Done();
+ it.Advance()) {
+ Instruction* current = it.Current();
+ // Do not overwrite owner function.
+ ASSERT(!current->has_inlining_id());
+ current->set_inlining_id(inlining_id);
+ }
+ }
+}
+
+
bool FlowGraphInliner::AlwaysInline(const Function& function) {
const char* kAlwaysInlineAnnotation = "AlwaysInline";
if (FLAG_enable_inlining_annotations &&
@@ -1771,7 +1793,7 @@
printer.PrintBlocks();
}
- CallSiteInliner inliner(flow_graph_);
+ CallSiteInliner inliner(this);
inliner.InlineCalls();
if (FLAG_print_inlining_tree) {
inliner.PrintInlinedInfo(top);
@@ -1791,4 +1813,12 @@
}
}
+
+intptr_t FlowGraphInliner::NextInlineId(const Function& function) {
+ const intptr_t id = inline_id_to_function_->length();
+ inline_id_to_function_->Add(&function);
+ return id;
+}
+
+
} // namespace dart

Powered by Google App Engine
This is Rietveld 408576698