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

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: ensure that not-null constraints are recomputed correctly 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..537f32fe914cc9458b9f724c73422db821ab9436 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -111,7 +111,6 @@ static void InstallUnoptimizedCode(const Function& function) {
}
}
srdjan 2013/03/18 18:54:35 why the deleted line?
Vyacheslav Egorov (Google) 2013/03/18 19:41:18 Done.
-
// Return false if bailed out.
static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function,
bool optimized) {
@@ -167,6 +166,8 @@ static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function,
FlowGraphPrinter::PrintGraph("Before Optimizations", flow_graph);
}
+ ZoneGrowableArray<Field*>* guarded_fields = NULL;
+
if (optimized) {
TimerScope timer(FLAG_compiler_stats,
&CompilerStats::graphoptimizer_timer,
@@ -193,6 +194,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 +224,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 +264,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 +309,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 +317,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