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

Unified Diff: runtime/vm/object.cc

Issue 1491503003: VM: In CompileAll, don't iterate collected closures for every class (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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/compiler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 4949390b70f3f35385b9d5bf04c426d35df03c11..24894f1f560b61402e241a67013db129c2ce01ca 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -10982,11 +10982,13 @@ RawNamespace* Namespace::New(const Library& library,
RawError* Library::CompileAll() {
- Error& error = Error::Handle();
+ Thread* thread = Thread::Current();
+ Zone* zone = thread->zone();
+ Error& error = Error::Handle(zone);
const GrowableObjectArray& libs = GrowableObjectArray::Handle(
Isolate::Current()->object_store()->libraries());
- Library& lib = Library::Handle();
- Class& cls = Class::Handle();
+ Library& lib = Library::Handle(zone);
+ Class& cls = Class::Handle(zone);
for (int i = 0; i < libs.Length(); i++) {
lib ^= libs.At(i);
ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate);
@@ -11002,6 +11004,24 @@ RawError* Library::CompileAll() {
}
}
}
+
+ // Inner functions get added to the closures array. As part of compilation
+ // more closures can be added to the end of the array. Compile all the
+ // closures until we have reached the end of the "worklist".
+ const GrowableObjectArray& closures = GrowableObjectArray::Handle(zone,
+ Isolate::Current()->object_store()->closure_functions());
+ Function& func = Function::Handle(zone);
+ for (int i = 0; i < closures.Length(); i++) {
+ func ^= closures.At(i);
+ if (!func.HasCode()) {
+ error = Compiler::CompileFunction(thread, func);
+ if (!error.IsNull()) {
+ return error.raw();
+ }
+ func.ClearICDataArray();
+ func.ClearCode();
+ }
+ }
return error.raw();
}
« no previous file with comments | « runtime/vm/compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698