Chromium Code Reviews| Index: runtime/vm/object.cc |
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
| index b78a45279e14ebc914ea0cd0dbe4f3ee74655282..f3c7f07b32acf566692d2f7b356532ee4f832888 100644 |
| --- a/runtime/vm/object.cc |
| +++ b/runtime/vm/object.cc |
| @@ -11343,6 +11343,51 @@ RawError* Library::CompileAll() { |
| } |
| +RawError* Library::ParseAll() { |
| + 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(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); |
| + if (!error.IsNull()) { |
| + return error.raw(); |
| + } |
| + error = Compiler::ParseAllFunctions(cls); |
| + if (!error.IsNull()) { |
| + return error.raw(); |
| + } |
| + } |
| + } |
| + |
| + // Inner functions get added to the closures array. As part of compilation |
|
hausner
2016/09/09 16:31:07
I don't think iterating over inner functions is ne
siva
2016/09/23 00:04:04
But I guess it is representative of what we would
hausner
2016/09/23 21:57:20
Sure. On the other hand, in an AOT compiler we wou
|
| + // 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::ParseFunction(thread, func); |
| + if (!error.IsNull()) { |
| + return error.raw(); |
| + } |
| + func.ClearICDataArray(); |
| + func.ClearCode(); |
| + } |
| + } |
| + return error.raw(); |
| +} |
| + |
| + |
| // Return Function::null() if function does not exist in libs. |
| RawFunction* Library::GetFunction(const GrowableArray<Library*>& libs, |
| const char* class_name, |