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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 18111006: Collect edge count profiling data and reorder basic blocks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated review comments. Created 7 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_compiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index 3a33d40f8165c95042250b31ea513ed091479d1a..ce28a043b6ce700e8297ffc703f5f4a76b0d79c1 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -82,18 +82,27 @@ void InlineExitCollector::PrepareGraphs(FlowGraph* callee_graph) {
// Attach the outer environment on each instruction in the callee graph.
ASSERT(call_->env() != NULL);
+ // Scale the edge weights by the call count for the inlined function.
+ double scale_factor = static_cast<double>(call_->CallCount())
+ / static_cast<double>(caller_graph_->graph_entry()->entry_count());
for (BlockIterator block_it = callee_graph->postorder_iterator();
!block_it.Done();
block_it.Advance()) {
- for (ForwardInstructionIterator it(block_it.Current());
- !it.Done();
- it.Advance()) {
- Instruction* instr = it.Current();
+ BlockEntryInstr* block = block_it.Current();
+ if (block->IsTargetEntry()) {
+ block->AsTargetEntry()->adjust_edge_weight(scale_factor);
+ }
+ Instruction* instr = block;
+ for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) {
+ instr = it.Current();
// TODO(zerny): Avoid creating unnecessary environments. Note that some
// optimizations need deoptimization info for non-deoptable instructions,
// eg, LICM on GOTOs.
if (instr->env() != NULL) call_->env()->DeepCopyToOuter(instr);
}
+ if (instr->IsGoto()) {
+ instr->AsGoto()->adjust_edge_weight(scale_factor);
+ }
}
}
@@ -3728,7 +3737,7 @@ FlowGraph* FlowGraphBuilder::BuildGraph() {
void FlowGraphBuilder::PruneUnreachable() {
ASSERT(osr_id_ != Isolate::kNoDeoptId);
BitVector* block_marks = new BitVector(last_used_block_id_ + 1);
- bool found = graph_entry_->PruneUnreachable(this, graph_entry_, osr_id_,
+ bool found = graph_entry_->PruneUnreachable(this, graph_entry_, NULL, osr_id_,
block_marks);
ASSERT(found);
}
« no previous file with comments | « runtime/vm/flow_graph.cc ('k') | runtime/vm/flow_graph_compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698