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

Unified Diff: runtime/vm/compiler.cc

Issue 12529008: Collect type feedback for fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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/compiler.cc
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
index bc4444030a93d7b96b96c1b496a5f026b73960fc..0d5790063a044225a883bba9ce0f9408016d1196 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -167,6 +167,8 @@ static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function,
FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph);
}
+ const ZoneGrowableArray<Field*>* guarded_fields = NULL;
+
if (optimized) {
TimerScope timer(FLAG_compiler_stats,
&CompilerStats::graphoptimizer_timer,
@@ -193,6 +195,8 @@ static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function,
DEBUG_ASSERT(flow_graph->VerifyUseLists());
}
+ guarded_fields = &flow_graph->FieldDependencies();
+
// Propagate types and eliminate more type tests.
if (FLAG_propagate_types) {
FlowGraphTypePropagator propagator(flow_graph);
@@ -221,6 +225,8 @@ static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function,
// Propagate types and eliminate even more type tests.
if (FLAG_propagate_types) {
+ // Recompute types after constant propagation to infer more precise
+ // types for uses that were previously reached by now eliminated phis.
FlowGraphTypePropagator propagator(flow_graph);
propagator.Propagate();
DEBUG_ASSERT(flow_graph->VerifyUseLists());
@@ -259,6 +265,14 @@ static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function,
}
// The final canonicalization pass before the code generation.
+ if (FLAG_propagate_types) {
+ // Propagate types one more time after code movement phases.
+ // This recomputes types of values that became dominated by
+ // hoisted checks.
+ FlowGraphTypePropagator propagator(flow_graph);
+ propagator.Propagate();
+ DEBUG_ASSERT(flow_graph->VerifyUseLists());
+ }
optimizer.Canonicalize();
DEBUG_ASSERT(flow_graph->VerifyUseLists());
@@ -296,6 +310,7 @@ static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function,
graph_compiler.FinalizeExceptionHandlers(code);
graph_compiler.FinalizeComments(code);
graph_compiler.FinalizeStaticCallTargetsTable(code);
+
if (optimized) {
CodePatcher::PatchEntry(Code::Handle(function.CurrentCode()));
function.SetCode(code);
@@ -303,6 +318,11 @@ static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function,
OS::Print("--> patching entry %#"Px"\n",
Code::Handle(function.unoptimized_code()).EntryPoint());
}
+
+ for (intptr_t i = 0; i < guarded_fields->length(); i++) {
+ const Field& field = *(*guarded_fields)[i];
+ field.RegisterDependentCode(code);
+ }
} else {
function.set_unoptimized_code(code);
function.SetCode(code);

Powered by Google App Engine
This is Rietveld 408576698