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

Unified Diff: runtime/vm/compiler.cc

Issue 11236063: Restructure code generation timers and add sub-timers for inlining phases. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 | « no previous file | runtime/vm/compiler_stats.h » ('j') | runtime/vm/compiler_stats.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/compiler.cc
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
index 7de8b38f3924df466386dca9863fbeba1243dee8..522344d4b9d10d4d384c683aee2f3e5ad0982318 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -156,95 +156,106 @@ static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function,
// Build the flow graph.
FlowGraphBuilder builder(parsed_function);
flow_graph = builder.BuildGraph(FlowGraphBuilder::kNotInlining);
+ }
- // Transform to SSA.
- if (optimized) flow_graph->ComputeSSA(0); // Start at virtual register 0.
+ // Transform to SSA.
+ if (optimized) {
+ TimerScope timer(FLAG_compiler_stats,
+ &CompilerStats::graphssa_timer,
Kevin Millikin (Google) 2012/10/23 07:54:56 Needs to be graph_ssa_timer. Could it be just Com
+ isolate);
+ flow_graph->ComputeSSA(0); // Start at virtual register 0.
+ }
- if (FLAG_print_flow_graph) {
- OS::Print("Before Optimizations\n");
- FlowGraphPrinter printer(*flow_graph);
- printer.PrintBlocks();
- }
+ if (FLAG_print_flow_graph) {
+ OS::Print("Before Optimizations\n");
+ FlowGraphPrinter printer(*flow_graph);
+ printer.PrintBlocks();
+ }
- if (optimized) {
- flow_graph->ComputeUseLists();
+ if (optimized) {
+ TimerScope timer(FLAG_compiler_stats,
+ &CompilerStats::graphoptimizer_timer,
+ isolate);
- FlowGraphOptimizer optimizer(flow_graph);
- optimizer.ApplyICData();
+ flow_graph->ComputeUseLists();
- // Compute the use lists.
- flow_graph->ComputeUseLists();
+ FlowGraphOptimizer optimizer(flow_graph);
+ optimizer.ApplyICData();
- // Inlining (mutates the flow graph)
- if (FLAG_use_inlining) {
- FlowGraphInliner inliner(flow_graph);
- inliner.Inline();
- // Use lists are maintained and validated by the inliner.
- }
+ // Compute the use lists.
+ flow_graph->ComputeUseLists();
- // Propagate types and eliminate more type tests.
- if (FLAG_propagate_types) {
- FlowGraphTypePropagator propagator(flow_graph);
- propagator.PropagateTypes();
- }
+ // Inlining (mutates the flow graph)
+ if (FLAG_use_inlining) {
+ TimerScope timer(FLAG_compiler_stats,
+ &CompilerStats::graphinliner_timer);
+ FlowGraphInliner inliner(flow_graph);
+ inliner.Inline();
+ // Use lists are maintained and validated by the inliner.
+ }
- // Verify that the use lists are still valid.
- DEBUG_ASSERT(flow_graph->ValidateUseLists());
+ // Propagate types and eliminate more type tests.
+ if (FLAG_propagate_types) {
+ FlowGraphTypePropagator propagator(flow_graph);
+ propagator.PropagateTypes();
+ }
- // Propagate sminess from CheckSmi to phis.
- optimizer.PropagateSminess();
+ // Verify that the use lists are still valid.
+ DEBUG_ASSERT(flow_graph->ValidateUseLists());
- // Use propagated class-ids to optimize further.
- optimizer.ApplyClassIds();
+ // Propagate sminess from CheckSmi to phis.
+ optimizer.PropagateSminess();
- // Do optimizations that depend on the propagated type information.
- // TODO(srdjan): Should this be called CanonicalizeComputations?
- optimizer.OptimizeComputations();
+ // Use propagated class-ids to optimize further.
+ optimizer.ApplyClassIds();
- // Unbox doubles.
- flow_graph->ComputeUseLists();
- optimizer.SelectRepresentations();
+ // Do optimizations that depend on the propagated type information.
+ // TODO(srdjan): Should this be called CanonicalizeComputations?
+ optimizer.OptimizeComputations();
- if (FLAG_constant_propagation ||
- FLAG_common_subexpression_elimination) {
- flow_graph->ComputeUseLists();
- }
- if (FLAG_constant_propagation) {
- ConstantPropagator::Optimize(flow_graph);
- // A canonicalization pass to remove e.g. smi checks on smi constants.
- optimizer.OptimizeComputations();
- }
- if (FLAG_common_subexpression_elimination) {
- if (DominatorBasedCSE::Optimize(flow_graph)) {
- // Do another round of CSE to take secondary effects into account:
- // e.g. when eliminating dependent loads (a.x[0] + a.x[0])
- // TODO(fschneider): Change to a one-pass optimization pass.
- DominatorBasedCSE::Optimize(flow_graph);
- }
- }
- if (FLAG_loop_invariant_code_motion &&
- (parsed_function.function().deoptimization_counter() <
- (FLAG_deoptimization_counter_threshold - 1))) {
- LICM::Optimize(flow_graph);
- }
+ // Unbox doubles.
+ flow_graph->ComputeUseLists();
+ optimizer.SelectRepresentations();
- if (FLAG_range_analysis) {
- // We have to perform range analysis after LICM because it
- // optimistically moves CheckSmi through phis into loop preheaders
- // making some phis smi.
- flow_graph->ComputeUseLists();
- optimizer.InferSmiRanges();
+ if (FLAG_constant_propagation ||
+ FLAG_common_subexpression_elimination) {
+ flow_graph->ComputeUseLists();
+ }
+ if (FLAG_constant_propagation) {
+ ConstantPropagator::Optimize(flow_graph);
+ // A canonicalization pass to remove e.g. smi checks on smi constants.
+ optimizer.OptimizeComputations();
+ }
+ if (FLAG_common_subexpression_elimination) {
+ if (DominatorBasedCSE::Optimize(flow_graph)) {
+ // Do another round of CSE to take secondary effects into account:
+ // e.g. when eliminating dependent loads (a.x[0] + a.x[0])
+ // TODO(fschneider): Change to a one-pass optimization pass.
+ DominatorBasedCSE::Optimize(flow_graph);
}
+ }
+ if (FLAG_loop_invariant_code_motion &&
+ (parsed_function.function().deoptimization_counter() <
+ (FLAG_deoptimization_counter_threshold - 1))) {
+ LICM::Optimize(flow_graph);
+ }
- // Perform register allocation on the SSA graph.
- FlowGraphAllocator allocator(*flow_graph);
- allocator.AllocateRegisters();
+ if (FLAG_range_analysis) {
+ // We have to perform range analysis after LICM because it
+ // optimistically moves CheckSmi through phis into loop preheaders
+ // making some phis smi.
+ flow_graph->ComputeUseLists();
+ optimizer.InferSmiRanges();
+ }
- if (FLAG_print_flow_graph) {
- OS::Print("After Optimizations:\n");
- FlowGraphPrinter printer(*flow_graph);
- printer.PrintBlocks();
- }
+ // Perform register allocation on the SSA graph.
+ FlowGraphAllocator allocator(*flow_graph);
+ allocator.AllocateRegisters();
+
+ if (FLAG_print_flow_graph) {
+ OS::Print("After Optimizations:\n");
+ FlowGraphPrinter printer(*flow_graph);
+ printer.PrintBlocks();
}
}
« no previous file with comments | « no previous file | runtime/vm/compiler_stats.h » ('j') | runtime/vm/compiler_stats.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698