Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/become.h" | 10 #include "vm/become.h" |
| (...skipping 11325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11336 return error.raw(); | 11336 return error.raw(); |
| 11337 } | 11337 } |
| 11338 func.ClearICDataArray(); | 11338 func.ClearICDataArray(); |
| 11339 func.ClearCode(); | 11339 func.ClearCode(); |
| 11340 } | 11340 } |
| 11341 } | 11341 } |
| 11342 return error.raw(); | 11342 return error.raw(); |
| 11343 } | 11343 } |
| 11344 | 11344 |
| 11345 | 11345 |
| 11346 RawError* Library::ParseAll() { | |
| 11347 Thread* thread = Thread::Current(); | |
| 11348 Zone* zone = thread->zone(); | |
| 11349 Error& error = Error::Handle(zone); | |
| 11350 const GrowableObjectArray& libs = GrowableObjectArray::Handle( | |
| 11351 Isolate::Current()->object_store()->libraries()); | |
| 11352 Library& lib = Library::Handle(zone); | |
| 11353 Class& cls = Class::Handle(zone); | |
| 11354 for (int i = 0; i < libs.Length(); i++) { | |
| 11355 lib ^= libs.At(i); | |
| 11356 ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate); | |
| 11357 while (it.HasNext()) { | |
| 11358 cls = it.GetNextClass(); | |
| 11359 error = cls.EnsureIsFinalized(thread); | |
| 11360 if (!error.IsNull()) { | |
| 11361 return error.raw(); | |
| 11362 } | |
| 11363 error = Compiler::ParseAllFunctions(cls); | |
| 11364 if (!error.IsNull()) { | |
| 11365 return error.raw(); | |
| 11366 } | |
| 11367 } | |
| 11368 } | |
| 11369 | |
| 11370 // 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
| |
| 11371 // more closures can be added to the end of the array. Compile all the | |
| 11372 // closures until we have reached the end of the "worklist". | |
| 11373 const GrowableObjectArray& closures = GrowableObjectArray::Handle(zone, | |
| 11374 Isolate::Current()->object_store()->closure_functions()); | |
| 11375 Function& func = Function::Handle(zone); | |
| 11376 for (int i = 0; i < closures.Length(); i++) { | |
| 11377 func ^= closures.At(i); | |
| 11378 if (!func.HasCode()) { | |
| 11379 error = Compiler::ParseFunction(thread, func); | |
| 11380 if (!error.IsNull()) { | |
| 11381 return error.raw(); | |
| 11382 } | |
| 11383 func.ClearICDataArray(); | |
| 11384 func.ClearCode(); | |
| 11385 } | |
| 11386 } | |
| 11387 return error.raw(); | |
| 11388 } | |
| 11389 | |
| 11390 | |
| 11346 // Return Function::null() if function does not exist in libs. | 11391 // Return Function::null() if function does not exist in libs. |
| 11347 RawFunction* Library::GetFunction(const GrowableArray<Library*>& libs, | 11392 RawFunction* Library::GetFunction(const GrowableArray<Library*>& libs, |
| 11348 const char* class_name, | 11393 const char* class_name, |
| 11349 const char* function_name) { | 11394 const char* function_name) { |
| 11350 Thread* thread = Thread::Current(); | 11395 Thread* thread = Thread::Current(); |
| 11351 Zone* zone = thread->zone(); | 11396 Zone* zone = thread->zone(); |
| 11352 Function& func = Function::Handle(zone); | 11397 Function& func = Function::Handle(zone); |
| 11353 String& class_str = String::Handle(zone); | 11398 String& class_str = String::Handle(zone); |
| 11354 String& func_str = String::Handle(zone); | 11399 String& func_str = String::Handle(zone); |
| 11355 Class& cls = Class::Handle(zone); | 11400 Class& cls = Class::Handle(zone); |
| (...skipping 11409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 22765 return UserTag::null(); | 22810 return UserTag::null(); |
| 22766 } | 22811 } |
| 22767 | 22812 |
| 22768 | 22813 |
| 22769 const char* UserTag::ToCString() const { | 22814 const char* UserTag::ToCString() const { |
| 22770 const String& tag_label = String::Handle(label()); | 22815 const String& tag_label = String::Handle(label()); |
| 22771 return tag_label.ToCString(); | 22816 return tag_label.ToCString(); |
| 22772 } | 22817 } |
| 22773 | 22818 |
| 22774 } // namespace dart | 22819 } // namespace dart |
| OLD | NEW |