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

Unified Diff: runtime/vm/compiler.cc

Issue 12317007: Remove two more places where we computed use lists and add verification. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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/flow_graph.h » ('j') | no next file with comments »
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 23dd34346fb29e93aadbf05952bf3077f89d8ffa..26cca9d465ffbdd3f22f27d9e0e9854350542df1 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -54,7 +54,6 @@ DEFINE_FLAG(bool, verify_compiler, false,
DECLARE_FLAG(bool, print_flow_graph);
DECLARE_FLAG(bool, print_flow_graph_optimized);
DECLARE_FLAG(bool, trace_failed_optimization_attempts);
-DECLARE_FLAG(bool, trace_type_propagation);
// Compile a function. Should call only if the function has not been compiled.
// Arg0: function object.
@@ -160,6 +159,7 @@ static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function,
isolate);
// Transform to SSA (virtual register 0 and no inlining arguments).
flow_graph->ComputeSSA(0, NULL);
+ flow_graph->ComputeUseLists();
}
if (FLAG_print_flow_graph ||
@@ -174,10 +174,9 @@ static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function,
&CompilerStats::graphoptimizer_timer,
isolate);
- flow_graph->ComputeUseLists();
-
FlowGraphOptimizer optimizer(flow_graph);
optimizer.ApplyICData();
+ DEBUG_ASSERT(flow_graph->VerifyUseLists());
// Inlining (mutates the flow graph)
if (FLAG_use_inlining) {
@@ -186,57 +185,53 @@ static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function,
FlowGraphInliner inliner(flow_graph);
inliner.Inline();
// Use lists are maintained and validated by the inliner.
- }
-
- if (FLAG_trace_type_propagation) {
- OS::Print("Before type propagation:\n");
- FlowGraphPrinter printer(*flow_graph);
- printer.PrintBlocks();
+ DEBUG_ASSERT(flow_graph->VerifyUseLists());
}
// Propagate types and eliminate more type tests.
if (FLAG_propagate_types) {
FlowGraphTypePropagator propagator(flow_graph);
propagator.Propagate();
+ DEBUG_ASSERT(flow_graph->VerifyUseLists());
}
- if (FLAG_trace_type_propagation) {
- OS::Print("After type propagation:\n");
- FlowGraphPrinter printer(*flow_graph);
- printer.PrintBlocks();
- }
-
- flow_graph->ComputeUseLists();
-
// Use propagated class-ids to optimize further.
optimizer.ApplyClassIds();
+ DEBUG_ASSERT(flow_graph->VerifyUseLists());
// Do optimizations that depend on the propagated type information.
optimizer.Canonicalize();
+ DEBUG_ASSERT(flow_graph->VerifyUseLists());
if (FLAG_constant_propagation) {
ConstantPropagator::Optimize(flow_graph);
+ DEBUG_ASSERT(flow_graph->VerifyUseLists());
// A canonicalization pass to remove e.g. smi checks on smi constants.
optimizer.Canonicalize();
+ DEBUG_ASSERT(flow_graph->VerifyUseLists());
}
// Unbox doubles. Performed after constant propagation to minimize
// interference from phis merging double values and tagged
// values comming from dead paths.
optimizer.SelectRepresentations();
+ DEBUG_ASSERT(flow_graph->VerifyUseLists());
if (FLAG_common_subexpression_elimination) {
if (DominatorBasedCSE::Optimize(flow_graph)) {
+ DEBUG_ASSERT(flow_graph->VerifyUseLists());
// 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);
+ DEBUG_ASSERT(flow_graph->VerifyUseLists());
}
}
if (FLAG_loop_invariant_code_motion &&
(parsed_function.function().deoptimization_counter() <
(FLAG_deoptimization_counter_threshold - 1))) {
LICM::Optimize(flow_graph);
+ DEBUG_ASSERT(flow_graph->VerifyUseLists());
}
if (FLAG_range_analysis) {
@@ -244,10 +239,12 @@ static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function,
// optimistically moves CheckSmi through phis into loop preheaders
// making some phis smi.
optimizer.InferSmiRanges();
+ DEBUG_ASSERT(flow_graph->VerifyUseLists());
}
// The final canonicalization pass before the code generation.
optimizer.Canonicalize();
+ DEBUG_ASSERT(flow_graph->VerifyUseLists());
// Perform register allocation on the SSA graph.
FlowGraphAllocator allocator(*flow_graph);
« no previous file with comments | « no previous file | runtime/vm/flow_graph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698