| 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/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 9009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9020 }; | 9020 }; |
| 9021 | 9021 |
| 9022 | 9022 |
| 9023 typedef UnorderedHashSet<LibraryUrlTraits> LibraryLoadErrorSet; | 9023 typedef UnorderedHashSet<LibraryUrlTraits> LibraryLoadErrorSet; |
| 9024 | 9024 |
| 9025 | 9025 |
| 9026 RawInstance* Library::TransitiveLoadError() const { | 9026 RawInstance* Library::TransitiveLoadError() const { |
| 9027 if (LoadError() != Instance::null()) { | 9027 if (LoadError() != Instance::null()) { |
| 9028 return LoadError(); | 9028 return LoadError(); |
| 9029 } | 9029 } |
| 9030 Isolate* isolate = Isolate::Current(); | 9030 Thread* thread = Thread::Current(); |
| 9031 Isolate* isolate = thread->isolate(); |
| 9031 ObjectStore* object_store = isolate->object_store(); | 9032 ObjectStore* object_store = isolate->object_store(); |
| 9032 LibraryLoadErrorSet set(object_store->library_load_error_table()); | 9033 LibraryLoadErrorSet set(object_store->library_load_error_table()); |
| 9033 bool present = false; | 9034 bool present = false; |
| 9034 if (set.GetOrNull(*this, &present) != Object::null()) { | 9035 if (set.GetOrNull(*this, &present) != Object::null()) { |
| 9035 object_store->set_library_load_error_table(set.Release()); | 9036 object_store->set_library_load_error_table(set.Release()); |
| 9036 return Instance::null(); | 9037 return Instance::null(); |
| 9037 } | 9038 } |
| 9038 // Ensure we don't repeatedly visit the same library again. | 9039 // Ensure we don't repeatedly visit the same library again. |
| 9039 set.Insert(*this); | 9040 set.Insert(*this); |
| 9040 object_store->set_library_load_error_table(set.Release()); | 9041 object_store->set_library_load_error_table(set.Release()); |
| 9041 intptr_t num_imp = num_imports(); | 9042 intptr_t num_imp = num_imports(); |
| 9042 Library& lib = Library::Handle(isolate); | 9043 Library& lib = Library::Handle(isolate); |
| 9043 Instance& error = Instance::Handle(isolate); | 9044 Instance& error = Instance::Handle(isolate); |
| 9044 for (intptr_t i = 0; i < num_imp; i++) { | 9045 for (intptr_t i = 0; i < num_imp; i++) { |
| 9045 HANDLESCOPE(isolate); | 9046 HANDLESCOPE(thread); |
| 9046 lib = ImportLibraryAt(i); | 9047 lib = ImportLibraryAt(i); |
| 9047 error = lib.TransitiveLoadError(); | 9048 error = lib.TransitiveLoadError(); |
| 9048 if (!error.IsNull()) { | 9049 if (!error.IsNull()) { |
| 9049 break; | 9050 break; |
| 9050 } | 9051 } |
| 9051 } | 9052 } |
| 9052 return error.raw(); | 9053 return error.raw(); |
| 9053 } | 9054 } |
| 9054 | 9055 |
| 9055 | 9056 |
| (...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10305 const Array& imports = Array::Handle(this->imports()); | 10306 const Array& imports = Array::Handle(this->imports()); |
| 10306 Namespace& import = Namespace::Handle(); | 10307 Namespace& import = Namespace::Handle(); |
| 10307 import ^= imports.At(index); | 10308 import ^= imports.At(index); |
| 10308 return import.library(); | 10309 return import.library(); |
| 10309 } | 10310 } |
| 10310 return Library::null(); | 10311 return Library::null(); |
| 10311 } | 10312 } |
| 10312 | 10313 |
| 10313 | 10314 |
| 10314 RawInstance* LibraryPrefix::LoadError() const { | 10315 RawInstance* LibraryPrefix::LoadError() const { |
| 10315 Isolate* isolate = Isolate::Current(); | 10316 Thread* thread = Thread::Current(); |
| 10317 Isolate* isolate = thread->isolate(); |
| 10316 ObjectStore* object_store = isolate->object_store(); | 10318 ObjectStore* object_store = isolate->object_store(); |
| 10317 GrowableObjectArray& libs = | 10319 GrowableObjectArray& libs = |
| 10318 GrowableObjectArray::Handle(isolate, object_store->libraries()); | 10320 GrowableObjectArray::Handle(isolate, object_store->libraries()); |
| 10319 ASSERT(!libs.IsNull()); | 10321 ASSERT(!libs.IsNull()); |
| 10320 LibraryLoadErrorSet set(HashTables::New<LibraryLoadErrorSet>(libs.Length())); | 10322 LibraryLoadErrorSet set(HashTables::New<LibraryLoadErrorSet>(libs.Length())); |
| 10321 object_store->set_library_load_error_table(set.Release()); | 10323 object_store->set_library_load_error_table(set.Release()); |
| 10322 Library& lib = Library::Handle(isolate); | 10324 Library& lib = Library::Handle(isolate); |
| 10323 Instance& error = Instance::Handle(isolate); | 10325 Instance& error = Instance::Handle(isolate); |
| 10324 for (int32_t i = 0; i < num_imports(); i++) { | 10326 for (int32_t i = 0; i < num_imports(); i++) { |
| 10325 lib = GetLibrary(i); | 10327 lib = GetLibrary(i); |
| 10326 ASSERT(!lib.IsNull()); | 10328 ASSERT(!lib.IsNull()); |
| 10327 HANDLESCOPE(isolate); | 10329 HANDLESCOPE(thread); |
| 10328 error = lib.TransitiveLoadError(); | 10330 error = lib.TransitiveLoadError(); |
| 10329 if (!error.IsNull()) { | 10331 if (!error.IsNull()) { |
| 10330 break; | 10332 break; |
| 10331 } | 10333 } |
| 10332 } | 10334 } |
| 10333 object_store->set_library_load_error_table(Object::empty_array()); | 10335 object_store->set_library_load_error_table(Object::empty_array()); |
| 10334 return error.raw(); | 10336 return error.raw(); |
| 10335 } | 10337 } |
| 10336 | 10338 |
| 10337 | 10339 |
| (...skipping 3843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14181 | 14183 |
| 14182 | 14184 |
| 14183 void UnhandledException::set_stacktrace(const Instance& stacktrace) const { | 14185 void UnhandledException::set_stacktrace(const Instance& stacktrace) const { |
| 14184 StorePointer(&raw_ptr()->stacktrace_, stacktrace.raw()); | 14186 StorePointer(&raw_ptr()->stacktrace_, stacktrace.raw()); |
| 14185 } | 14187 } |
| 14186 | 14188 |
| 14187 | 14189 |
| 14188 const char* UnhandledException::ToErrorCString() const { | 14190 const char* UnhandledException::ToErrorCString() const { |
| 14189 Thread* thread = Thread::Current(); | 14191 Thread* thread = Thread::Current(); |
| 14190 Isolate* isolate = thread->isolate(); | 14192 Isolate* isolate = thread->isolate(); |
| 14191 HANDLESCOPE(isolate); | 14193 HANDLESCOPE(thread); |
| 14192 Object& strtmp = Object::Handle(); | 14194 Object& strtmp = Object::Handle(); |
| 14193 const char* exc_str; | 14195 const char* exc_str; |
| 14194 if (exception() == isolate->object_store()->out_of_memory()) { | 14196 if (exception() == isolate->object_store()->out_of_memory()) { |
| 14195 exc_str = "Out of Memory"; | 14197 exc_str = "Out of Memory"; |
| 14196 } else if (exception() == isolate->object_store()->stack_overflow()) { | 14198 } else if (exception() == isolate->object_store()->stack_overflow()) { |
| 14197 exc_str = "Stack Overflow"; | 14199 exc_str = "Stack Overflow"; |
| 14198 } else { | 14200 } else { |
| 14199 const Instance& exc = Instance::Handle(exception()); | 14201 const Instance& exc = Instance::Handle(exception()); |
| 14200 strtmp = DartLibraryCalls::ToString(exc); | 14202 strtmp = DartLibraryCalls::ToString(exc); |
| 14201 if (!strtmp.IsError()) { | 14203 if (!strtmp.IsError()) { |
| (...skipping 7288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21490 return tag_label.ToCString(); | 21492 return tag_label.ToCString(); |
| 21491 } | 21493 } |
| 21492 | 21494 |
| 21493 | 21495 |
| 21494 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21496 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21495 Instance::PrintJSONImpl(stream, ref); | 21497 Instance::PrintJSONImpl(stream, ref); |
| 21496 } | 21498 } |
| 21497 | 21499 |
| 21498 | 21500 |
| 21499 } // namespace dart | 21501 } // namespace dart |
| OLD | NEW |