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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 1400193003: Don't assume at least one closure function is encountered before tree-shaking. Allow… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index 87cdd133fae022dc37852f1e991fdd10bc10dfb8..ea31f9653e4c77fce2329fbcef353c204a2d29d2 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -2530,16 +2530,17 @@ void EffectGraphVisitor::VisitStringInterpolateNode(
static void CollectClosureFunction(const Function& function) {
if (function.HasCode()) return;
+ // Although this is only called when precompiling, this can happen before
+ // Dart_Precompile as part of loading code, so check for a non-null work
+ // list.
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
- if (isolate->collected_closures() == GrowableObjectArray::null()) {
- isolate->set_collected_closures(
- GrowableObjectArray::Handle(GrowableObjectArray::New()));
- }
- const GrowableObjectArray& functions =
- GrowableObjectArray::Handle(thread->zone(),
- isolate->collected_closures());
- functions.Add(function);
+ if (isolate->collected_closures() != GrowableObjectArray::null()) {
+ const GrowableObjectArray& functions =
+ GrowableObjectArray::Handle(thread->zone(),
+ isolate->collected_closures());
+ functions.Add(function);
+ }
}
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698