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

Unified Diff: runtime/vm/precompiler.cc

Issue 2009513002: Avoid leaking objects that should be collected after tree-shaking. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merged Created 4 years, 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/precompiler.cc
diff --git a/runtime/vm/precompiler.cc b/runtime/vm/precompiler.cc
index 3d69d951389e1f5ed6fbe250abe78592b257b13d..52c6e88671ddb5564c4a180f095758137688e4ab 100644
--- a/runtime/vm/precompiler.cc
+++ b/runtime/vm/precompiler.cc
@@ -192,62 +192,63 @@ void Precompiler::DoCompileAll(
StackZone stack_zone(T);
zone_ = stack_zone.GetZone();
- // Make sure class hierarchy is stable before compilation so that CHA
- // can be used. Also ensures lookup of entry points won't miss functions
- // because their class hasn't been finalized yet.
- FinalizeAllClasses();
+ { HANDLESCOPE(T);
+ // Make sure class hierarchy is stable before compilation so that CHA
+ // can be used. Also ensures lookup of entry points won't miss functions
+ // because their class hasn't been finalized yet.
+ FinalizeAllClasses();
- // Precompile static initializers to compute result type information.
- PrecompileStaticInitializers();
+ // Precompile static initializers to compute result type information.
+ PrecompileStaticInitializers();
- for (intptr_t round = 0; round < FLAG_precompiler_rounds; round++) {
- if (FLAG_trace_precompiler) {
- THR_Print("Precompiler round %" Pd "\n", round);
- }
-
- if (round > 0) {
- ResetPrecompilerState();
- }
-
- // TODO(rmacnak): We should be able to do a more thorough job and drop
- // some
- // - implicit static closures
- // - field initializers
- // - invoke-field-dispatchers
- // - method-extractors
- // that are needed in early iterations but optimized away in later
- // iterations.
- ClearAllCode();
-
- CollectDynamicFunctionNames();
+ for (intptr_t round = 0; round < FLAG_precompiler_rounds; round++) {
+ if (FLAG_trace_precompiler) {
+ THR_Print("Precompiler round %" Pd "\n", round);
+ }
- // Start with the allocations and invocations that happen from C++.
- AddRoots(embedder_entry_points);
+ if (round > 0) {
+ ResetPrecompilerState();
+ }
- // Compile newly found targets and add their callees until we reach a
- // fixed point.
- Iterate();
+ // TODO(rmacnak): We should be able to do a more thorough job and drop
+ // some
+ // - implicit static closures
+ // - field initializers
+ // - invoke-field-dispatchers
+ // - method-extractors
+ // that are needed in early iterations but optimized away in later
+ // iterations.
+ ClearAllCode();
+
+ CollectDynamicFunctionNames();
+
+ // Start with the allocations and invocations that happen from C++.
+ AddRoots(embedder_entry_points);
+
+ // Compile newly found targets and add their callees until we reach a
+ // fixed point.
+ Iterate();
+ }
+
+ I->set_compilation_allowed(false);
+
+ TraceForRetainedFunctions();
+ DropFunctions();
+ DropFields();
+ TraceTypesFromRetainedClasses();
+ DropTypes();
+ DropTypeArguments();
+
+ // Clear these before dropping classes as they may hold onto otherwise
+ // dead instances of classes we will remove.
+ I->object_store()->set_compile_time_constants(Array::null_array());
+ I->object_store()->set_unique_dynamic_targets(Array::null_array());
+ Class& null_class = Class::Handle(Z);
+ I->object_store()->set_future_class(null_class);
+ I->object_store()->set_completer_class(null_class);
+ I->object_store()->set_stream_iterator_class(null_class);
+ I->object_store()->set_symbol_class(null_class);
}
-
- I->set_compilation_allowed(false);
-
- TraceForRetainedFunctions();
- DropFunctions();
- DropFields();
- TraceTypesFromRetainedClasses();
- DropTypes();
- DropTypeArguments();
-
- // Clear these before dropping classes as they may hold onto otherwise
- // dead instances of classes we will remove.
- I->object_store()->set_compile_time_constants(Array::null_array());
- I->object_store()->set_unique_dynamic_targets(Array::null_array());
- Class& null_class = Class::Handle(Z);
- I->object_store()->set_future_class(null_class);
- I->object_store()->set_completer_class(null_class);
- I->object_store()->set_stream_iterator_class(null_class);
- I->object_store()->set_symbol_class(null_class);
-
DropClasses();
DropLibraries();
@@ -329,6 +330,8 @@ void Precompiler::PrecompileStaticInitializers() {
Field& field_;
Function& function_;
};
+
+ HANDLESCOPE(T);
StaticInitializerVisitor visitor(Z);
VisitClasses(&visitor);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698