| Index: runtime/vm/object.cc
|
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
|
| index 4949390b70f3f35385b9d5bf04c426d35df03c11..a8f709796407aba53898cd883317b589abc3dd84 100644
|
| --- a/runtime/vm/object.cc
|
| +++ b/runtime/vm/object.cc
|
| @@ -10982,17 +10982,19 @@ 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);
|
| while (it.HasNext()) {
|
| cls = it.GetNextClass();
|
| - error = cls.EnsureIsFinalized(Thread::Current());
|
| + error = cls.EnsureIsFinalized(thread);
|
| if (!error.IsNull()) {
|
| return error.raw();
|
| }
|
| @@ -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();
|
| }
|
|
|
|
|