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 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 object_store->set_external_two_byte_string_class(cls); | 1022 object_store->set_external_two_byte_string_class(cls); |
1023 RegisterPrivateClass(cls, Symbols::ExternalTwoByteString(), core_lib); | 1023 RegisterPrivateClass(cls, Symbols::ExternalTwoByteString(), core_lib); |
1024 pending_classes.Add(cls); | 1024 pending_classes.Add(cls); |
1025 | 1025 |
1026 // Pre-register the isolate library so the native class implementations | 1026 // Pre-register the isolate library so the native class implementations |
1027 // can be hooked up before compiling it. | 1027 // can be hooked up before compiling it. |
1028 Library& isolate_lib = | 1028 Library& isolate_lib = |
1029 Library::Handle(isolate, Library::LookupLibrary(Symbols::DartIsolate())); | 1029 Library::Handle(isolate, Library::LookupLibrary(Symbols::DartIsolate())); |
1030 if (isolate_lib.IsNull()) { | 1030 if (isolate_lib.IsNull()) { |
1031 isolate_lib = Library::NewLibraryHelper(Symbols::DartIsolate(), true); | 1031 isolate_lib = Library::NewLibraryHelper(Symbols::DartIsolate(), true); |
| 1032 isolate_lib.SetLoadRequested(); |
1032 isolate_lib.Register(); | 1033 isolate_lib.Register(); |
1033 isolate->object_store()->set_bootstrap_library(ObjectStore::kIsolate, | 1034 isolate->object_store()->set_bootstrap_library(ObjectStore::kIsolate, |
1034 isolate_lib); | 1035 isolate_lib); |
1035 } | 1036 } |
1036 ASSERT(!isolate_lib.IsNull()); | 1037 ASSERT(!isolate_lib.IsNull()); |
1037 ASSERT(isolate_lib.raw() == Library::IsolateLibrary()); | 1038 ASSERT(isolate_lib.raw() == Library::IsolateLibrary()); |
1038 | 1039 |
1039 cls = Class::New<Capability>(); | 1040 cls = Class::New<Capability>(); |
1040 RegisterPrivateClass(cls, Symbols::_CapabilityImpl(), isolate_lib); | 1041 RegisterPrivateClass(cls, Symbols::_CapabilityImpl(), isolate_lib); |
1041 pending_classes.Add(cls); | 1042 pending_classes.Add(cls); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 | 1151 |
1151 cls = Class::New<WeakProperty>(); | 1152 cls = Class::New<WeakProperty>(); |
1152 object_store->set_weak_property_class(cls); | 1153 object_store->set_weak_property_class(cls); |
1153 RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib); | 1154 RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib); |
1154 | 1155 |
1155 // Pre-register the mirrors library so we can place the vm class | 1156 // Pre-register the mirrors library so we can place the vm class |
1156 // MirrorReference there rather than the core library. | 1157 // MirrorReference there rather than the core library. |
1157 lib = Library::LookupLibrary(Symbols::DartMirrors()); | 1158 lib = Library::LookupLibrary(Symbols::DartMirrors()); |
1158 if (lib.IsNull()) { | 1159 if (lib.IsNull()) { |
1159 lib = Library::NewLibraryHelper(Symbols::DartMirrors(), true); | 1160 lib = Library::NewLibraryHelper(Symbols::DartMirrors(), true); |
| 1161 lib.SetLoadRequested(); |
1160 lib.Register(); | 1162 lib.Register(); |
1161 isolate->object_store()->set_bootstrap_library(ObjectStore::kMirrors, | 1163 isolate->object_store()->set_bootstrap_library(ObjectStore::kMirrors, |
1162 lib); | 1164 lib); |
1163 } | 1165 } |
1164 ASSERT(!lib.IsNull()); | 1166 ASSERT(!lib.IsNull()); |
1165 ASSERT(lib.raw() == Library::MirrorsLibrary()); | 1167 ASSERT(lib.raw() == Library::MirrorsLibrary()); |
1166 | 1168 |
1167 cls = Class::New<MirrorReference>(); | 1169 cls = Class::New<MirrorReference>(); |
1168 RegisterPrivateClass(cls, Symbols::_MirrorReference(), lib); | 1170 RegisterPrivateClass(cls, Symbols::_MirrorReference(), lib); |
1169 | 1171 |
1170 // Pre-register the profiler library so we can place the vm class | 1172 // Pre-register the profiler library so we can place the vm class |
1171 // UserTag there rather than the core library. | 1173 // UserTag there rather than the core library. |
1172 lib = Library::LookupLibrary(Symbols::DartProfiler()); | 1174 lib = Library::LookupLibrary(Symbols::DartProfiler()); |
1173 if (lib.IsNull()) { | 1175 if (lib.IsNull()) { |
1174 lib = Library::NewLibraryHelper(Symbols::DartProfiler(), true); | 1176 lib = Library::NewLibraryHelper(Symbols::DartProfiler(), true); |
| 1177 lib.SetLoadRequested(); |
1175 lib.Register(); | 1178 lib.Register(); |
1176 isolate->object_store()->set_bootstrap_library(ObjectStore::kProfiler, | 1179 isolate->object_store()->set_bootstrap_library(ObjectStore::kProfiler, |
1177 lib); | 1180 lib); |
1178 } | 1181 } |
1179 ASSERT(!lib.IsNull()); | 1182 ASSERT(!lib.IsNull()); |
1180 ASSERT(lib.raw() == Library::ProfilerLibrary()); | 1183 ASSERT(lib.raw() == Library::ProfilerLibrary()); |
1181 | 1184 |
1182 lib = Library::LookupLibrary(Symbols::DartProfiler()); | 1185 lib = Library::LookupLibrary(Symbols::DartProfiler()); |
1183 ASSERT(!lib.IsNull()); | 1186 ASSERT(!lib.IsNull()); |
1184 cls = Class::New<UserTag>(); | 1187 cls = Class::New<UserTag>(); |
1185 RegisterPrivateClass(cls, Symbols::_UserTag(), lib); | 1188 RegisterPrivateClass(cls, Symbols::_UserTag(), lib); |
1186 pending_classes.Add(cls); | 1189 pending_classes.Add(cls); |
1187 | 1190 |
1188 // Setup some default native field classes which can be extended for | 1191 // Setup some default native field classes which can be extended for |
1189 // specifying native fields in dart classes. | 1192 // specifying native fields in dart classes. |
1190 Library::InitNativeWrappersLibrary(isolate); | 1193 Library::InitNativeWrappersLibrary(isolate); |
1191 ASSERT(isolate->object_store()->native_wrappers_library() != Library::null()); | 1194 ASSERT(isolate->object_store()->native_wrappers_library() != Library::null()); |
1192 | 1195 |
1193 // Pre-register the typed_data library so the native class implementations | 1196 // Pre-register the typed_data library so the native class implementations |
1194 // can be hooked up before compiling it. | 1197 // can be hooked up before compiling it. |
1195 lib = Library::LookupLibrary(Symbols::DartTypedData()); | 1198 lib = Library::LookupLibrary(Symbols::DartTypedData()); |
1196 if (lib.IsNull()) { | 1199 if (lib.IsNull()) { |
1197 lib = Library::NewLibraryHelper(Symbols::DartTypedData(), true); | 1200 lib = Library::NewLibraryHelper(Symbols::DartTypedData(), true); |
| 1201 lib.SetLoadRequested(); |
1198 lib.Register(); | 1202 lib.Register(); |
1199 isolate->object_store()->set_bootstrap_library(ObjectStore::kTypedData, | 1203 isolate->object_store()->set_bootstrap_library(ObjectStore::kTypedData, |
1200 lib); | 1204 lib); |
1201 } | 1205 } |
1202 ASSERT(!lib.IsNull()); | 1206 ASSERT(!lib.IsNull()); |
1203 ASSERT(lib.raw() == Library::TypedDataLibrary()); | 1207 ASSERT(lib.raw() == Library::TypedDataLibrary()); |
1204 const intptr_t typed_data_class_array_length = | 1208 const intptr_t typed_data_class_array_length = |
1205 RawObject::NumberOfTypedDataClasses(); | 1209 RawObject::NumberOfTypedDataClasses(); |
1206 Array& typed_data_classes = | 1210 Array& typed_data_classes = |
1207 Array::Handle(Array::New(typed_data_class_array_length)); | 1211 Array::Handle(Array::New(typed_data_class_array_length)); |
(...skipping 7100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8308 | 8312 |
8309 void Library::SetName(const String& name) const { | 8313 void Library::SetName(const String& name) const { |
8310 // Only set name once. | 8314 // Only set name once. |
8311 ASSERT(!Loaded()); | 8315 ASSERT(!Loaded()); |
8312 ASSERT(name.IsSymbol()); | 8316 ASSERT(name.IsSymbol()); |
8313 StorePointer(&raw_ptr()->name_, name.raw()); | 8317 StorePointer(&raw_ptr()->name_, name.raw()); |
8314 } | 8318 } |
8315 | 8319 |
8316 | 8320 |
8317 void Library::SetLoadInProgress() const { | 8321 void Library::SetLoadInProgress() const { |
8318 // Should not be already loaded. | 8322 // Must not already be in the process of being loaded. |
| 8323 ASSERT(raw_ptr()->load_state_ <= RawLibrary::kLoadRequested); |
| 8324 raw_ptr()->load_state_ = RawLibrary::kLoadInProgress; |
| 8325 } |
| 8326 |
| 8327 |
| 8328 void Library::SetLoadRequested() const { |
| 8329 // Must not be already loaded. |
8319 ASSERT(raw_ptr()->load_state_ == RawLibrary::kAllocated); | 8330 ASSERT(raw_ptr()->load_state_ == RawLibrary::kAllocated); |
8320 raw_ptr()->load_state_ = RawLibrary::kLoadInProgress; | 8331 raw_ptr()->load_state_ = RawLibrary::kLoadRequested; |
8321 } | 8332 } |
8322 | 8333 |
8323 | 8334 |
8324 void Library::SetLoaded() const { | 8335 void Library::SetLoaded() const { |
8325 // Should not be already loaded or just allocated. | 8336 // Should not be already loaded or just allocated. |
8326 ASSERT(LoadInProgress()); | 8337 ASSERT(LoadInProgress() || LoadRequested()); |
8327 raw_ptr()->load_state_ = RawLibrary::kLoaded; | 8338 raw_ptr()->load_state_ = RawLibrary::kLoaded; |
8328 } | 8339 } |
8329 | 8340 |
8330 | 8341 |
8331 void Library::SetLoadError() const { | 8342 void Library::SetLoadError() const { |
8332 // Should not be already loaded or just allocated. | 8343 // Should not be already loaded or just allocated. |
8333 ASSERT(LoadInProgress()); | 8344 ASSERT(LoadInProgress() || LoadRequested()); |
8334 raw_ptr()->load_state_ = RawLibrary::kLoadError; | 8345 raw_ptr()->load_state_ = RawLibrary::kLoadError; |
8335 } | 8346 } |
8336 | 8347 |
8337 | 8348 |
8338 static RawString* MakeClassMetaName(const Class& cls) { | 8349 static RawString* MakeClassMetaName(const Class& cls) { |
8339 String& cname = String::Handle(cls.Name()); | 8350 String& cname = String::Handle(cls.Name()); |
8340 return String::Concat(Symbols::At(), cname); | 8351 return String::Concat(Symbols::At(), cname); |
8341 } | 8352 } |
8342 | 8353 |
8343 | 8354 |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9190 | 9201 |
9191 RawLibrary* Library::New(const String& url) { | 9202 RawLibrary* Library::New(const String& url) { |
9192 return NewLibraryHelper(url, false); | 9203 return NewLibraryHelper(url, false); |
9193 } | 9204 } |
9194 | 9205 |
9195 | 9206 |
9196 void Library::InitCoreLibrary(Isolate* isolate) { | 9207 void Library::InitCoreLibrary(Isolate* isolate) { |
9197 const String& core_lib_url = Symbols::DartCore(); | 9208 const String& core_lib_url = Symbols::DartCore(); |
9198 const Library& core_lib = | 9209 const Library& core_lib = |
9199 Library::Handle(Library::NewLibraryHelper(core_lib_url, false)); | 9210 Library::Handle(Library::NewLibraryHelper(core_lib_url, false)); |
| 9211 core_lib.SetLoadRequested(); |
9200 core_lib.Register(); | 9212 core_lib.Register(); |
9201 isolate->object_store()->set_bootstrap_library(ObjectStore::kCore, core_lib); | 9213 isolate->object_store()->set_bootstrap_library(ObjectStore::kCore, core_lib); |
9202 isolate->object_store()->set_root_library(Library::Handle()); | 9214 isolate->object_store()->set_root_library(Library::Handle()); |
9203 | 9215 |
9204 // Hook up predefined classes without setting their library pointers. These | 9216 // Hook up predefined classes without setting their library pointers. These |
9205 // classes are coming from the VM isolate, and are shared between multiple | 9217 // classes are coming from the VM isolate, and are shared between multiple |
9206 // isolates so setting their library pointers would be wrong. | 9218 // isolates so setting their library pointers would be wrong. |
9207 const Class& cls = Class::Handle(Object::dynamic_class()); | 9219 const Class& cls = Class::Handle(Object::dynamic_class()); |
9208 core_lib.AddObject(cls, String::Handle(cls.Name())); | 9220 core_lib.AddObject(cls, String::Handle(cls.Name())); |
9209 } | 9221 } |
(...skipping 17 matching lines...) Expand all Loading... |
9227 | 9239 |
9228 | 9240 |
9229 void Library::InitNativeWrappersLibrary(Isolate* isolate) { | 9241 void Library::InitNativeWrappersLibrary(Isolate* isolate) { |
9230 static const int kNumNativeWrappersClasses = 4; | 9242 static const int kNumNativeWrappersClasses = 4; |
9231 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10); | 9243 ASSERT(kNumNativeWrappersClasses > 0 && kNumNativeWrappersClasses < 10); |
9232 const String& native_flds_lib_url = Symbols::DartNativeWrappers(); | 9244 const String& native_flds_lib_url = Symbols::DartNativeWrappers(); |
9233 const Library& native_flds_lib = Library::Handle( | 9245 const Library& native_flds_lib = Library::Handle( |
9234 Library::NewLibraryHelper(native_flds_lib_url, false)); | 9246 Library::NewLibraryHelper(native_flds_lib_url, false)); |
9235 const String& native_flds_lib_name = Symbols::DartNativeWrappersLibName(); | 9247 const String& native_flds_lib_name = Symbols::DartNativeWrappersLibName(); |
9236 native_flds_lib.SetName(native_flds_lib_name); | 9248 native_flds_lib.SetName(native_flds_lib_name); |
| 9249 native_flds_lib.SetLoadRequested(); |
9237 native_flds_lib.Register(); | 9250 native_flds_lib.Register(); |
| 9251 native_flds_lib.SetLoadInProgress(); |
9238 isolate->object_store()->set_native_wrappers_library(native_flds_lib); | 9252 isolate->object_store()->set_native_wrappers_library(native_flds_lib); |
9239 static const char* const kNativeWrappersClass = "NativeFieldWrapperClass"; | 9253 static const char* const kNativeWrappersClass = "NativeFieldWrapperClass"; |
9240 static const int kNameLength = 25; | 9254 static const int kNameLength = 25; |
9241 ASSERT(kNameLength == (strlen(kNativeWrappersClass) + 1 + 1)); | 9255 ASSERT(kNameLength == (strlen(kNativeWrappersClass) + 1 + 1)); |
9242 char name_buffer[kNameLength]; | 9256 char name_buffer[kNameLength]; |
9243 String& cls_name = String::Handle(); | 9257 String& cls_name = String::Handle(); |
9244 for (int fld_cnt = 1; fld_cnt <= kNumNativeWrappersClasses; fld_cnt++) { | 9258 for (int fld_cnt = 1; fld_cnt <= kNumNativeWrappersClasses; fld_cnt++) { |
9245 OS::SNPrint(name_buffer, | 9259 OS::SNPrint(name_buffer, |
9246 kNameLength, | 9260 kNameLength, |
9247 "%s%d", | 9261 "%s%d", |
9248 kNativeWrappersClass, | 9262 kNativeWrappersClass, |
9249 fld_cnt); | 9263 fld_cnt); |
9250 cls_name = Symbols::New(name_buffer); | 9264 cls_name = Symbols::New(name_buffer); |
9251 Class::NewNativeWrapper(native_flds_lib, cls_name, fld_cnt); | 9265 Class::NewNativeWrapper(native_flds_lib, cls_name, fld_cnt); |
9252 } | 9266 } |
| 9267 native_flds_lib.SetLoaded(); |
9253 } | 9268 } |
9254 | 9269 |
9255 | 9270 |
9256 // Returns library with given url in current isolate, or NULL. | 9271 // Returns library with given url in current isolate, or NULL. |
9257 RawLibrary* Library::LookupLibrary(const String &url) { | 9272 RawLibrary* Library::LookupLibrary(const String &url) { |
9258 Isolate* isolate = Isolate::Current(); | 9273 Isolate* isolate = Isolate::Current(); |
9259 Library& lib = Library::Handle(isolate, Library::null()); | 9274 Library& lib = Library::Handle(isolate, Library::null()); |
9260 String& lib_url = String::Handle(isolate, String::null()); | 9275 String& lib_url = String::Handle(isolate, String::null()); |
9261 GrowableObjectArray& libs = GrowableObjectArray::Handle( | 9276 GrowableObjectArray& libs = GrowableObjectArray::Handle( |
9262 isolate, isolate->object_store()->libraries()); | 9277 isolate, isolate->object_store()->libraries()); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9611 } | 9626 } |
9612 return Class::null(); | 9627 return Class::null(); |
9613 } | 9628 } |
9614 | 9629 |
9615 | 9630 |
9616 void LibraryPrefix::set_is_loaded() const { | 9631 void LibraryPrefix::set_is_loaded() const { |
9617 raw_ptr()->is_loaded_ = true; | 9632 raw_ptr()->is_loaded_ = true; |
9618 } | 9633 } |
9619 | 9634 |
9620 | 9635 |
9621 void LibraryPrefix::LoadLibrary() const { | 9636 bool LibraryPrefix::LoadLibrary() const { |
9622 // Non-deferred prefixes are loaded. | 9637 // Non-deferred prefixes are loaded. |
9623 ASSERT(is_deferred_load() || is_loaded()); | 9638 ASSERT(is_deferred_load() || is_loaded()); |
9624 if (is_loaded()) { | 9639 if (is_loaded()) { |
9625 return; | 9640 return true; // Load request has already completed. |
9626 } | 9641 } |
9627 InvalidateDependentCode(); | 9642 ASSERT(is_deferred_load()); |
9628 set_is_loaded(); | 9643 ASSERT(num_imports() == 1); |
| 9644 // This is a prefix for a deferred library. If the library is not loaded |
| 9645 // yet and isn't being loaded, call the library tag handler to schedule |
| 9646 // loading. Once all outstanding load requests have completed, the embedder |
| 9647 // will call the core library to: |
| 9648 // - invalidate dependent code of this prefix; |
| 9649 // - mark this prefixes as loaded; |
| 9650 // - complete the future associated with this prefix. |
| 9651 const Library& deferred_lib = Library::Handle(GetLibrary(0)); |
| 9652 if (deferred_lib.Loaded()) { |
| 9653 this->set_is_loaded(); |
| 9654 return true; |
| 9655 } else if (deferred_lib.LoadNotStarted()) { |
| 9656 deferred_lib.SetLoadRequested(); |
| 9657 Isolate* isolate = Isolate::Current(); |
| 9658 const String& lib_url = String::Handle(isolate, deferred_lib.url()); |
| 9659 Dart_LibraryTagHandler handler = isolate->library_tag_handler(); |
| 9660 handler(Dart_kImportTag, |
| 9661 Api::NewHandle(isolate, importer()), |
| 9662 Api::NewHandle(isolate, lib_url.raw())); |
| 9663 } else { |
| 9664 // Another load request is in flight. |
| 9665 ASSERT(deferred_lib.LoadRequested()); |
| 9666 } |
| 9667 return false; // Load request not yet completed. |
9629 } | 9668 } |
9630 | 9669 |
9631 | 9670 |
9632 RawArray* LibraryPrefix::dependent_code() const { | 9671 RawArray* LibraryPrefix::dependent_code() const { |
9633 return raw_ptr()->dependent_code_; | 9672 return raw_ptr()->dependent_code_; |
9634 } | 9673 } |
9635 | 9674 |
9636 | 9675 |
9637 void LibraryPrefix::set_dependent_code(const Array& array) const { | 9676 void LibraryPrefix::set_dependent_code(const Array& array) const { |
9638 StorePointer(&raw_ptr()->dependent_code_, array.raw()); | 9677 StorePointer(&raw_ptr()->dependent_code_, array.raw()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9677 ASSERT(is_deferred_load()); | 9716 ASSERT(is_deferred_load()); |
9678 ASSERT(!is_loaded()); | 9717 ASSERT(!is_loaded()); |
9679 PrefixDependentArray a(*this); | 9718 PrefixDependentArray a(*this); |
9680 a.Register(code); | 9719 a.Register(code); |
9681 } | 9720 } |
9682 | 9721 |
9683 | 9722 |
9684 void LibraryPrefix::InvalidateDependentCode() const { | 9723 void LibraryPrefix::InvalidateDependentCode() const { |
9685 PrefixDependentArray a(*this); | 9724 PrefixDependentArray a(*this); |
9686 a.DisableCode(); | 9725 a.DisableCode(); |
| 9726 set_is_loaded(); |
9687 } | 9727 } |
9688 | 9728 |
9689 | 9729 |
9690 RawLibraryPrefix* LibraryPrefix::New() { | 9730 RawLibraryPrefix* LibraryPrefix::New() { |
9691 ASSERT(Isolate::Current()->object_store()->library_prefix_class() != | 9731 ASSERT(Isolate::Current()->object_store()->library_prefix_class() != |
9692 Class::null()); | 9732 Class::null()); |
9693 RawObject* raw = Object::Allocate(LibraryPrefix::kClassId, | 9733 RawObject* raw = Object::Allocate(LibraryPrefix::kClassId, |
9694 LibraryPrefix::InstanceSize(), | 9734 LibraryPrefix::InstanceSize(), |
9695 Heap::kOld); | 9735 Heap::kOld); |
9696 return reinterpret_cast<RawLibraryPrefix*>(raw); | 9736 return reinterpret_cast<RawLibraryPrefix*>(raw); |
9697 } | 9737 } |
9698 | 9738 |
9699 | 9739 |
9700 RawLibraryPrefix* LibraryPrefix::New(const String& name, | 9740 RawLibraryPrefix* LibraryPrefix::New(const String& name, |
9701 const Namespace& import, | 9741 const Namespace& import, |
9702 bool deferred_load) { | 9742 bool deferred_load, |
| 9743 const Library& importer) { |
9703 const LibraryPrefix& result = LibraryPrefix::Handle(LibraryPrefix::New()); | 9744 const LibraryPrefix& result = LibraryPrefix::Handle(LibraryPrefix::New()); |
9704 result.set_name(name); | 9745 result.set_name(name); |
9705 result.set_num_imports(0); | 9746 result.set_num_imports(0); |
| 9747 result.set_importer(importer); |
9706 result.raw_ptr()->is_deferred_load_ = deferred_load; | 9748 result.raw_ptr()->is_deferred_load_ = deferred_load; |
9707 result.raw_ptr()->is_loaded_ = !deferred_load; | 9749 result.raw_ptr()->is_loaded_ = !deferred_load; |
9708 result.set_imports(Array::Handle(Array::New(kInitialSize))); | 9750 result.set_imports(Array::Handle(Array::New(kInitialSize))); |
9709 result.AddImport(import); | 9751 result.AddImport(import); |
9710 result.set_dependent_code(Object::null_array()); | 9752 result.set_dependent_code(Object::null_array()); |
9711 return result.raw(); | 9753 return result.raw(); |
9712 } | 9754 } |
9713 | 9755 |
9714 | 9756 |
9715 void LibraryPrefix::set_name(const String& value) const { | 9757 void LibraryPrefix::set_name(const String& value) const { |
9716 ASSERT(value.IsSymbol()); | 9758 ASSERT(value.IsSymbol()); |
9717 StorePointer(&raw_ptr()->name_, value.raw()); | 9759 StorePointer(&raw_ptr()->name_, value.raw()); |
9718 } | 9760 } |
9719 | 9761 |
9720 | 9762 |
9721 void LibraryPrefix::set_imports(const Array& value) const { | 9763 void LibraryPrefix::set_imports(const Array& value) const { |
9722 StorePointer(&raw_ptr()->imports_, value.raw()); | 9764 StorePointer(&raw_ptr()->imports_, value.raw()); |
9723 } | 9765 } |
9724 | 9766 |
9725 | 9767 |
9726 void LibraryPrefix::set_num_imports(intptr_t value) const { | 9768 void LibraryPrefix::set_num_imports(intptr_t value) const { |
9727 raw_ptr()->num_imports_ = value; | 9769 raw_ptr()->num_imports_ = value; |
9728 } | 9770 } |
9729 | 9771 |
9730 | 9772 |
| 9773 void LibraryPrefix::set_importer(const Library& value) const { |
| 9774 StorePointer(&raw_ptr()->importer_, value.raw()); |
| 9775 } |
| 9776 |
| 9777 |
9731 const char* LibraryPrefix::ToCString() const { | 9778 const char* LibraryPrefix::ToCString() const { |
9732 const char* kFormat = "LibraryPrefix:'%s'"; | 9779 const char* kFormat = "LibraryPrefix:'%s'"; |
9733 const String& prefix = String::Handle(name()); | 9780 const String& prefix = String::Handle(name()); |
9734 intptr_t len = OS::SNPrint(NULL, 0, kFormat, prefix.ToCString()) + 1; | 9781 intptr_t len = OS::SNPrint(NULL, 0, kFormat, prefix.ToCString()) + 1; |
9735 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 9782 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
9736 OS::SNPrint(chars, len, kFormat, prefix.ToCString()); | 9783 OS::SNPrint(chars, len, kFormat, prefix.ToCString()); |
9737 return chars; | 9784 return chars; |
9738 } | 9785 } |
9739 | 9786 |
9740 | 9787 |
(...skipping 9280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19021 return tag_label.ToCString(); | 19068 return tag_label.ToCString(); |
19022 } | 19069 } |
19023 | 19070 |
19024 | 19071 |
19025 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 19072 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
19026 Instance::PrintJSONImpl(stream, ref); | 19073 Instance::PrintJSONImpl(stream, ref); |
19027 } | 19074 } |
19028 | 19075 |
19029 | 19076 |
19030 } // namespace dart | 19077 } // namespace dart |
OLD | NEW |