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

Unified Diff: runtime/vm/precompiler.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 | « runtime/vm/object.cc ('k') | 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 d2d0ef01bc064c4cf65eec399456ea59e3173d33..f061da02c6905080a973bca7316e9dec985b45da 100644
--- a/runtime/vm/precompiler.cc
+++ b/runtime/vm/precompiler.cc
@@ -47,21 +47,23 @@ RawError* Precompiler::CompileAll(
Precompiler::Precompiler(Thread* thread, bool reset_fields) :
- thread_(thread),
- zone_(thread->zone()),
- isolate_(thread->isolate()),
- reset_fields_(reset_fields),
- changed_(false),
- function_count_(0),
- class_count_(0),
- selector_count_(0),
- dropped_function_count_(0),
- libraries_(GrowableObjectArray::Handle(Z, I->object_store()->libraries())),
- pending_functions_(GrowableObjectArray::Handle(Z,
- GrowableObjectArray::New())),
- collected_closures_(GrowableObjectArray::Handle(Z, I->collected_closures())),
- sent_selectors_(),
- error_(Error::Handle(Z)) {
+ thread_(thread),
+ zone_(thread->zone()),
+ isolate_(thread->isolate()),
+ reset_fields_(reset_fields),
+ changed_(false),
+ function_count_(0),
+ class_count_(0),
+ selector_count_(0),
+ dropped_function_count_(0),
+ libraries_(GrowableObjectArray::Handle(Z, I->object_store()->libraries())),
+ pending_functions_(
+ GrowableObjectArray::Handle(Z, GrowableObjectArray::New())),
+ collected_closures_(
+ GrowableObjectArray::Handle(Z, GrowableObjectArray::New())),
+ sent_selectors_(),
+ error_(Error::Handle(Z)) {
+ I->set_collected_closures(collected_closures_);
}
@@ -665,10 +667,20 @@ void Precompiler::DropUncompiledFunctions() {
closures = cls.closures();
if (!closures.IsNull()) {
+ retained_functions = GrowableObjectArray::New();
for (intptr_t j = 0; j < closures.Length(); j++) {
function ^= closures.At(j);
- ASSERT(function.HasCode());
+ if (function.HasCode()) {
+ retained_functions.Add(function);
+ } else {
+ dropped_function_count_++;
+ if (FLAG_trace_precompiler) {
+ THR_Print("Precompilation dropping %s\n",
+ function.ToLibNamePrefixedQualifiedCString());
+ }
+ }
}
+ cls.set_closures(retained_functions);
}
}
}
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698