| 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();
|
| }
|
|
|
|
|