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 3023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3034 func.set_num_fixed_parameters(num_implicit_params + param_names.Length()); | 3034 func.set_num_fixed_parameters(num_implicit_params + param_names.Length()); |
3035 func.SetNumOptionalParameters(0, true); | 3035 func.SetNumOptionalParameters(0, true); |
3036 func.SetIsOptimizable(false); | 3036 func.SetIsOptimizable(false); |
3037 return func.raw(); | 3037 return func.raw(); |
3038 } | 3038 } |
3039 | 3039 |
3040 | 3040 |
3041 RawObject* Class::Evaluate(const String& expr, | 3041 RawObject* Class::Evaluate(const String& expr, |
3042 const Array& param_names, | 3042 const Array& param_names, |
3043 const Array& param_values) const { | 3043 const Array& param_values) const { |
| 3044 ASSERT(Thread::Current()->IsMutatorThread()); |
3044 const Function& eval_func = | 3045 const Function& eval_func = |
3045 Function::Handle(EvaluateHelper(*this, expr, param_names, true)); | 3046 Function::Handle(EvaluateHelper(*this, expr, param_names, true)); |
3046 const Object& result = | 3047 const Object& result = |
3047 Object::Handle(DartEntry::InvokeFunction(eval_func, param_values)); | 3048 Object::Handle(DartEntry::InvokeFunction(eval_func, param_values)); |
3048 return result.raw(); | 3049 return result.raw(); |
3049 } | 3050 } |
3050 | 3051 |
3051 | 3052 |
3052 // Ensure that top level parsing of the class has been done. | 3053 // Ensure that top level parsing of the class has been done. |
3053 RawError* Class::EnsureIsFinalized(Thread* thread) const { | 3054 RawError* Class::EnsureIsFinalized(Thread* thread) const { |
(...skipping 6254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9308 error = lib.TransitiveLoadError(); | 9309 error = lib.TransitiveLoadError(); |
9309 if (!error.IsNull()) { | 9310 if (!error.IsNull()) { |
9310 break; | 9311 break; |
9311 } | 9312 } |
9312 } | 9313 } |
9313 return error.raw(); | 9314 return error.raw(); |
9314 } | 9315 } |
9315 | 9316 |
9316 | 9317 |
9317 void Library::AddPatchClass(const Class& cls) const { | 9318 void Library::AddPatchClass(const Class& cls) const { |
| 9319 ASSERT(Thread::Current()->IsMutatorThread()); |
9318 ASSERT(cls.is_patch()); | 9320 ASSERT(cls.is_patch()); |
9319 ASSERT(GetPatchClass(String::Handle(cls.Name())) == Class::null()); | 9321 ASSERT(GetPatchClass(String::Handle(cls.Name())) == Class::null()); |
9320 const GrowableObjectArray& patch_classes = | 9322 const GrowableObjectArray& patch_classes = |
9321 GrowableObjectArray::Handle(this->patch_classes()); | 9323 GrowableObjectArray::Handle(this->patch_classes()); |
9322 patch_classes.Add(cls); | 9324 patch_classes.Add(cls); |
9323 } | 9325 } |
9324 | 9326 |
9325 | 9327 |
9326 RawClass* Library::GetPatchClass(const String& name) const { | 9328 RawClass* Library::GetPatchClass(const String& name) const { |
| 9329 ASSERT(Thread::Current()->IsMutatorThread()); |
9327 const GrowableObjectArray& patch_classes = | 9330 const GrowableObjectArray& patch_classes = |
9328 GrowableObjectArray::Handle(this->patch_classes()); | 9331 GrowableObjectArray::Handle(this->patch_classes()); |
9329 Object& obj = Object::Handle(); | 9332 Object& obj = Object::Handle(); |
9330 for (intptr_t i = 0; i < patch_classes.Length(); i++) { | 9333 for (intptr_t i = 0; i < patch_classes.Length(); i++) { |
9331 obj = patch_classes.At(i); | 9334 obj = patch_classes.At(i); |
9332 if (obj.IsClass() && | 9335 if (obj.IsClass() && |
9333 (Class::Cast(obj).Name() == name.raw())) { // Names are canonicalized. | 9336 (Class::Cast(obj).Name() == name.raw())) { // Names are canonicalized. |
9334 return Class::RawCast(obj.raw()); | 9337 return Class::RawCast(obj.raw()); |
9335 } | 9338 } |
9336 } | 9339 } |
9337 return Class::null(); | 9340 return Class::null(); |
9338 } | 9341 } |
9339 | 9342 |
9340 | 9343 |
9341 void Library::RemovePatchClass(const Class& cls) const { | 9344 void Library::RemovePatchClass(const Class& cls) const { |
| 9345 ASSERT(Thread::Current()->IsMutatorThread()); |
9342 ASSERT(cls.is_patch()); | 9346 ASSERT(cls.is_patch()); |
9343 const GrowableObjectArray& patch_classes = | 9347 const GrowableObjectArray& patch_classes = |
9344 GrowableObjectArray::Handle(this->patch_classes()); | 9348 GrowableObjectArray::Handle(this->patch_classes()); |
9345 const intptr_t num_classes = patch_classes.Length(); | 9349 const intptr_t num_classes = patch_classes.Length(); |
9346 intptr_t i = 0; | 9350 intptr_t i = 0; |
9347 while (i < num_classes) { | 9351 while (i < num_classes) { |
9348 if (cls.raw() == patch_classes.At(i)) break; | 9352 if (cls.raw() == patch_classes.At(i)) break; |
9349 i++; | 9353 i++; |
9350 } | 9354 } |
9351 if (i == num_classes) return; | 9355 if (i == num_classes) return; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9399 pieces.Add(Symbols::At()); | 9403 pieces.Add(Symbols::At()); |
9400 pieces.Add(String::Handle(param.name())); | 9404 pieces.Add(String::Handle(param.name())); |
9401 return Symbols::FromConcatAll(thread, pieces); | 9405 return Symbols::FromConcatAll(thread, pieces); |
9402 } | 9406 } |
9403 | 9407 |
9404 | 9408 |
9405 void Library::AddMetadata(const Object& owner, | 9409 void Library::AddMetadata(const Object& owner, |
9406 const String& name, | 9410 const String& name, |
9407 TokenPosition token_pos) const { | 9411 TokenPosition token_pos) const { |
9408 Thread* thread = Thread::Current(); | 9412 Thread* thread = Thread::Current(); |
| 9413 ASSERT(thread->IsMutatorThread()); |
9409 Zone* zone = thread->zone(); | 9414 Zone* zone = thread->zone(); |
9410 const String& metaname = String::Handle(zone, Symbols::New(thread, name)); | 9415 const String& metaname = String::Handle(zone, Symbols::New(thread, name)); |
9411 const Field& field = Field::Handle(zone, | 9416 const Field& field = Field::Handle(zone, |
9412 Field::NewTopLevel(metaname, | 9417 Field::NewTopLevel(metaname, |
9413 false, // is_final | 9418 false, // is_final |
9414 false, // is_const | 9419 false, // is_const |
9415 owner, | 9420 owner, |
9416 token_pos)); | 9421 token_pos)); |
9417 field.SetFieldType(Object::dynamic_type()); | 9422 field.SetFieldType(Object::dynamic_type()); |
9418 field.set_is_reflectable(false); | 9423 field.set_is_reflectable(false); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9486 return Symbols::TopLevel().raw(); | 9491 return Symbols::TopLevel().raw(); |
9487 } else if (obj.IsTypeParameter()) { | 9492 } else if (obj.IsTypeParameter()) { |
9488 return MakeTypeParameterMetaName(thread, zone, TypeParameter::Cast(obj)); | 9493 return MakeTypeParameterMetaName(thread, zone, TypeParameter::Cast(obj)); |
9489 } | 9494 } |
9490 UNIMPLEMENTED(); | 9495 UNIMPLEMENTED(); |
9491 return String::null(); | 9496 return String::null(); |
9492 } | 9497 } |
9493 | 9498 |
9494 | 9499 |
9495 RawField* Library::GetMetadataField(const String& metaname) const { | 9500 RawField* Library::GetMetadataField(const String& metaname) const { |
| 9501 ASSERT(Thread::Current()->IsMutatorThread()); |
9496 const GrowableObjectArray& metadata = | 9502 const GrowableObjectArray& metadata = |
9497 GrowableObjectArray::Handle(this->metadata()); | 9503 GrowableObjectArray::Handle(this->metadata()); |
9498 Field& entry = Field::Handle(); | 9504 Field& entry = Field::Handle(); |
9499 String& entryname = String::Handle(); | 9505 String& entryname = String::Handle(); |
9500 intptr_t num_entries = metadata.Length(); | 9506 intptr_t num_entries = metadata.Length(); |
9501 for (intptr_t i = 0; i < num_entries; i++) { | 9507 for (intptr_t i = 0; i < num_entries; i++) { |
9502 entry ^= metadata.At(i); | 9508 entry ^= metadata.At(i); |
9503 entryname = entry.name(); | 9509 entryname = entry.name(); |
9504 if (entryname.Equals(metaname)) { | 9510 if (entryname.Equals(metaname)) { |
9505 return entry.raw(); | 9511 return entry.raw(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9592 // Returns true if the name is found in the cache, false no cache hit. | 9598 // Returns true if the name is found in the cache, false no cache hit. |
9593 // obj is set to the cached entry. It may be null, indicating that the | 9599 // obj is set to the cached entry. It may be null, indicating that the |
9594 // name does not resolve to anything in this library. | 9600 // name does not resolve to anything in this library. |
9595 bool Library::LookupResolvedNamesCache(const String& name, | 9601 bool Library::LookupResolvedNamesCache(const String& name, |
9596 Object* obj) const { | 9602 Object* obj) const { |
9597 ResolvedNamesMap cache(resolved_names()); | 9603 ResolvedNamesMap cache(resolved_names()); |
9598 bool present = false; | 9604 bool present = false; |
9599 *obj = cache.GetOrNull(name, &present); | 9605 *obj = cache.GetOrNull(name, &present); |
9600 // Mutator compiler thread may add entries and therefore | 9606 // Mutator compiler thread may add entries and therefore |
9601 // change 'resolved_names()' while running a background compilation; | 9607 // change 'resolved_names()' while running a background compilation; |
9602 // do not ASSERT that 'resolved_names()' has not changed. | 9608 // ASSERT that 'resolved_names()' has not changed only in mutator. |
9603 cache.Release(); | 9609 #if defined(DEBUG) |
| 9610 if (Thread::Current()->IsMutatorThread()) { |
| 9611 ASSERT(cache.Release().raw() == resolved_names()); |
| 9612 } else { |
| 9613 // Release must be called in debug mode. |
| 9614 cache.Release(); |
| 9615 } |
| 9616 #endif |
9604 return present; | 9617 return present; |
9605 } | 9618 } |
9606 | 9619 |
9607 | 9620 |
9608 // Add a name to the resolved name cache. This name resolves to the | 9621 // Add a name to the resolved name cache. This name resolves to the |
9609 // given object in this library scope. obj may be null, which means | 9622 // given object in this library scope. obj may be null, which means |
9610 // the name does not resolve to anything in this library scope. | 9623 // the name does not resolve to anything in this library scope. |
9611 void Library::AddToResolvedNamesCache(const String& name, | 9624 void Library::AddToResolvedNamesCache(const String& name, |
9612 const Object& obj) const { | 9625 const Object& obj) const { |
9613 ASSERT(!Compiler::IsBackgroundCompilation()); | 9626 ASSERT(!Compiler::IsBackgroundCompilation()); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9662 } | 9675 } |
9663 // Copy used count. | 9676 // Copy used count. |
9664 new_entry = dict.At(dict_size); | 9677 new_entry = dict.At(dict_size); |
9665 new_dict.SetAt(new_dict_size, new_entry); | 9678 new_dict.SetAt(new_dict_size, new_entry); |
9666 // Remember the new dictionary now. | 9679 // Remember the new dictionary now. |
9667 StorePointer(&raw_ptr()->dictionary_, new_dict.raw()); | 9680 StorePointer(&raw_ptr()->dictionary_, new_dict.raw()); |
9668 } | 9681 } |
9669 | 9682 |
9670 | 9683 |
9671 void Library::AddObject(const Object& obj, const String& name) const { | 9684 void Library::AddObject(const Object& obj, const String& name) const { |
9672 ASSERT(!Compiler::IsBackgroundCompilation()); | 9685 ASSERT(Thread::Current()->IsMutatorThread()); |
9673 ASSERT(obj.IsClass() || | 9686 ASSERT(obj.IsClass() || |
9674 obj.IsFunction() || | 9687 obj.IsFunction() || |
9675 obj.IsField() || | 9688 obj.IsField() || |
9676 obj.IsLibraryPrefix()); | 9689 obj.IsLibraryPrefix()); |
9677 ASSERT(name.Equals(String::Handle(obj.DictionaryName()))); | 9690 ASSERT(name.Equals(String::Handle(obj.DictionaryName()))); |
9678 ASSERT(LookupLocalObject(name) == Object::null()); | 9691 ASSERT(LookupLocalObject(name) == Object::null()); |
9679 const Array& dict = Array::Handle(dictionary()); | 9692 const Array& dict = Array::Handle(dictionary()); |
9680 intptr_t dict_size = dict.Length() - 1; | 9693 intptr_t dict_size = dict.Length() - 1; |
9681 intptr_t index = name.Hash() % dict_size; | 9694 intptr_t index = name.Hash() % dict_size; |
9682 | 9695 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9782 | 9795 |
9783 intptr_t index; | 9796 intptr_t index; |
9784 LookupEntry(name, &index); | 9797 LookupEntry(name, &index); |
9785 // The value is guaranteed to be found. | 9798 // The value is guaranteed to be found. |
9786 const Array& dict = Array::Handle(dictionary()); | 9799 const Array& dict = Array::Handle(dictionary()); |
9787 dict.SetAt(index, obj); | 9800 dict.SetAt(index, obj); |
9788 } | 9801 } |
9789 | 9802 |
9790 | 9803 |
9791 bool Library::RemoveObject(const Object& obj, const String& name) const { | 9804 bool Library::RemoveObject(const Object& obj, const String& name) const { |
9792 ASSERT(!Compiler::IsBackgroundCompilation()); | 9805 Thread* thread = Thread::Current(); |
9793 Object& entry = Object::Handle(); | 9806 ASSERT(thread->IsMutatorThread()); |
| 9807 Zone* zone = thread->zone(); |
| 9808 Object& entry = Object::Handle(zone); |
9794 | 9809 |
9795 intptr_t index; | 9810 intptr_t index; |
9796 entry = LookupEntry(name, &index); | 9811 entry = LookupEntry(name, &index); |
9797 if (entry.raw() != obj.raw()) { | 9812 if (entry.raw() != obj.raw()) { |
9798 return false; | 9813 return false; |
9799 } | 9814 } |
9800 | 9815 |
9801 const Array& dict = Array::Handle(dictionary()); | 9816 const Array& dict = Array::Handle(zone, dictionary()); |
9802 dict.SetAt(index, Object::null_object()); | 9817 dict.SetAt(index, Object::null_object()); |
9803 intptr_t dict_size = dict.Length() - 1; | 9818 intptr_t dict_size = dict.Length() - 1; |
9804 | 9819 |
9805 // Fix any downstream collisions. | 9820 // Fix any downstream collisions. |
9806 String& key = String::Handle(); | 9821 String& key = String::Handle(zone); |
9807 for (;;) { | 9822 for (;;) { |
9808 index = (index + 1) % dict_size; | 9823 index = (index + 1) % dict_size; |
9809 entry = dict.At(index); | 9824 entry = dict.At(index); |
9810 | 9825 |
9811 if (entry.IsNull()) break; | 9826 if (entry.IsNull()) break; |
9812 | 9827 |
9813 key = entry.DictionaryName(); | 9828 key = entry.DictionaryName(); |
9814 intptr_t new_index = key.Hash() % dict_size; | 9829 intptr_t new_index = key.Hash() % dict_size; |
9815 while ((dict.At(new_index) != entry.raw()) && | 9830 while ((dict.At(new_index) != entry.raw()) && |
9816 (dict.At(new_index) != Object::null())) { | 9831 (dict.At(new_index) != Object::null())) { |
9817 new_index = (new_index + 1) % dict_size; | 9832 new_index = (new_index + 1) % dict_size; |
9818 } | 9833 } |
9819 | 9834 |
9820 if (index != new_index) { | 9835 if (index != new_index) { |
9821 ASSERT(dict.At(new_index) == Object::null()); | 9836 ASSERT(dict.At(new_index) == Object::null()); |
9822 dict.SetAt(new_index, entry); | 9837 dict.SetAt(new_index, entry); |
9823 dict.SetAt(index, Object::null_object()); | 9838 dict.SetAt(index, Object::null_object()); |
9824 } | 9839 } |
9825 } | 9840 } |
9826 | 9841 |
9827 // Update used count. | 9842 // Update used count. |
9828 intptr_t used_elements = Smi::Value(Smi::RawCast(dict.At(dict_size))) - 1; | 9843 intptr_t used_elements = Smi::Value(Smi::RawCast(dict.At(dict_size))) - 1; |
9829 dict.SetAt(dict_size, Smi::Handle(Smi::New(used_elements))); | 9844 dict.SetAt(dict_size, Smi::Handle(zone, Smi::New(used_elements))); |
9830 | 9845 |
9831 InvalidateResolvedNamesCache(); | 9846 InvalidateResolvedNamesCache(); |
9832 | 9847 |
9833 return true; | 9848 return true; |
9834 } | 9849 } |
9835 | 9850 |
9836 | 9851 |
9837 void Library::AddClass(const Class& cls) const { | 9852 void Library::AddClass(const Class& cls) const { |
9838 ASSERT(!Compiler::IsBackgroundCompilation()); | 9853 ASSERT(!Compiler::IsBackgroundCompilation()); |
9839 const String& class_name = String::Handle(cls.Name()); | 9854 const String& class_name = String::Handle(cls.Name()); |
(...skipping 17 matching lines...) Expand all Loading... |
9857 // We already have a reference to this script. | 9872 // We already have a reference to this script. |
9858 return; | 9873 return; |
9859 } | 9874 } |
9860 } | 9875 } |
9861 // Add script to the list of scripts. | 9876 // Add script to the list of scripts. |
9862 scripts.Add(candidate); | 9877 scripts.Add(candidate); |
9863 } | 9878 } |
9864 | 9879 |
9865 | 9880 |
9866 RawArray* Library::LoadedScripts() const { | 9881 RawArray* Library::LoadedScripts() const { |
| 9882 ASSERT(Thread::Current()->IsMutatorThread()); |
9867 // We compute the list of loaded scripts lazily. The result is | 9883 // We compute the list of loaded scripts lazily. The result is |
9868 // cached in loaded_scripts_. | 9884 // cached in loaded_scripts_. |
9869 if (loaded_scripts() == Array::null()) { | 9885 if (loaded_scripts() == Array::null()) { |
9870 // Iterate over the library dictionary and collect all scripts. | 9886 // Iterate over the library dictionary and collect all scripts. |
9871 const GrowableObjectArray& scripts = | 9887 const GrowableObjectArray& scripts = |
9872 GrowableObjectArray::Handle(GrowableObjectArray::New(8)); | 9888 GrowableObjectArray::Handle(GrowableObjectArray::New(8)); |
9873 Object& entry = Object::Handle(); | 9889 Object& entry = Object::Handle(); |
9874 Class& cls = Class::Handle(); | 9890 Class& cls = Class::Handle(); |
9875 Script& owner_script = Script::Handle(); | 9891 Script& owner_script = Script::Handle(); |
9876 DictionaryIterator it(*this); | 9892 DictionaryIterator it(*this); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10235 static RawArray* NewDictionary(intptr_t initial_size) { | 10251 static RawArray* NewDictionary(intptr_t initial_size) { |
10236 const Array& dict = Array::Handle(Array::New(initial_size + 1, Heap::kOld)); | 10252 const Array& dict = Array::Handle(Array::New(initial_size + 1, Heap::kOld)); |
10237 // The last element of the dictionary specifies the number of in use slots. | 10253 // The last element of the dictionary specifies the number of in use slots. |
10238 dict.SetAt(initial_size, Smi::Handle(Smi::New(0))); | 10254 dict.SetAt(initial_size, Smi::Handle(Smi::New(0))); |
10239 return dict.raw(); | 10255 return dict.raw(); |
10240 } | 10256 } |
10241 | 10257 |
10242 | 10258 |
10243 void Library::InitResolvedNamesCache(intptr_t size, | 10259 void Library::InitResolvedNamesCache(intptr_t size, |
10244 SnapshotReader* reader) const { | 10260 SnapshotReader* reader) const { |
| 10261 ASSERT(Thread::Current()->IsMutatorThread()); |
10245 if (reader == NULL) { | 10262 if (reader == NULL) { |
10246 StorePointer(&raw_ptr()->resolved_names_, | 10263 StorePointer(&raw_ptr()->resolved_names_, |
10247 HashTables::New<ResolvedNamesMap>(size)); | 10264 HashTables::New<ResolvedNamesMap>(size)); |
10248 } else { | 10265 } else { |
10249 intptr_t len = ResolvedNamesMap::ArrayLengthForNumOccupied(size); | 10266 intptr_t len = ResolvedNamesMap::ArrayLengthForNumOccupied(size); |
10250 *reader->ArrayHandle() ^= reader->NewArray(len); | 10267 *reader->ArrayHandle() ^= reader->NewArray(len); |
10251 StorePointer(&raw_ptr()->resolved_names_, | 10268 StorePointer(&raw_ptr()->resolved_names_, |
10252 HashTables::New<ResolvedNamesMap>(*reader->ArrayHandle())); | 10269 HashTables::New<ResolvedNamesMap>(*reader->ArrayHandle())); |
10253 } | 10270 } |
10254 } | 10271 } |
(...skipping 18 matching lines...) Expand all Loading... |
10273 ASSERT(Object::library_class() != Class::null()); | 10290 ASSERT(Object::library_class() != Class::null()); |
10274 RawObject* raw = Object::Allocate(Library::kClassId, | 10291 RawObject* raw = Object::Allocate(Library::kClassId, |
10275 Library::InstanceSize(), | 10292 Library::InstanceSize(), |
10276 Heap::kOld); | 10293 Heap::kOld); |
10277 return reinterpret_cast<RawLibrary*>(raw); | 10294 return reinterpret_cast<RawLibrary*>(raw); |
10278 } | 10295 } |
10279 | 10296 |
10280 | 10297 |
10281 RawLibrary* Library::NewLibraryHelper(const String& url, | 10298 RawLibrary* Library::NewLibraryHelper(const String& url, |
10282 bool import_core_lib) { | 10299 bool import_core_lib) { |
10283 const Library& result = Library::Handle(Library::New()); | 10300 Thread* thread = Thread::Current(); |
| 10301 Zone* zone = thread->zone(); |
| 10302 ASSERT(thread->IsMutatorThread()); |
| 10303 const Library& result = Library::Handle(zone, Library::New()); |
10284 result.StorePointer(&result.raw_ptr()->name_, Symbols::Empty().raw()); | 10304 result.StorePointer(&result.raw_ptr()->name_, Symbols::Empty().raw()); |
10285 result.StorePointer(&result.raw_ptr()->url_, url.raw()); | 10305 result.StorePointer(&result.raw_ptr()->url_, url.raw()); |
10286 result.StorePointer(&result.raw_ptr()->resolved_names_, | 10306 result.StorePointer(&result.raw_ptr()->resolved_names_, |
10287 Object::empty_array().raw()); | 10307 Object::empty_array().raw()); |
10288 result.StorePointer(&result.raw_ptr()->dictionary_, | 10308 result.StorePointer(&result.raw_ptr()->dictionary_, |
10289 Object::empty_array().raw()); | 10309 Object::empty_array().raw()); |
10290 result.StorePointer(&result.raw_ptr()->metadata_, | 10310 result.StorePointer(&result.raw_ptr()->metadata_, |
10291 GrowableObjectArray::New(4, Heap::kOld)); | 10311 GrowableObjectArray::New(4, Heap::kOld)); |
10292 result.StorePointer(&result.raw_ptr()->toplevel_class_, Class::null()); | 10312 result.StorePointer(&result.raw_ptr()->toplevel_class_, Class::null()); |
10293 result.StorePointer(&result.raw_ptr()->patch_classes_, | 10313 result.StorePointer(&result.raw_ptr()->patch_classes_, |
(...skipping 13 matching lines...) Expand all Loading... |
10307 result.set_is_dart_scheme(url.StartsWith(Symbols::DartScheme())); | 10327 result.set_is_dart_scheme(url.StartsWith(Symbols::DartScheme())); |
10308 result.StoreNonPointer(&result.raw_ptr()->load_state_, | 10328 result.StoreNonPointer(&result.raw_ptr()->load_state_, |
10309 RawLibrary::kAllocated); | 10329 RawLibrary::kAllocated); |
10310 result.StoreNonPointer(&result.raw_ptr()->index_, -1); | 10330 result.StoreNonPointer(&result.raw_ptr()->index_, -1); |
10311 const intptr_t kInitialNameCacheSize = 64; | 10331 const intptr_t kInitialNameCacheSize = 64; |
10312 result.InitResolvedNamesCache(kInitialNameCacheSize); | 10332 result.InitResolvedNamesCache(kInitialNameCacheSize); |
10313 result.InitClassDictionary(); | 10333 result.InitClassDictionary(); |
10314 result.InitImportList(); | 10334 result.InitImportList(); |
10315 result.AllocatePrivateKey(); | 10335 result.AllocatePrivateKey(); |
10316 if (import_core_lib) { | 10336 if (import_core_lib) { |
10317 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 10337 const Library& core_lib = Library::Handle(zone, Library::CoreLibrary()); |
10318 ASSERT(!core_lib.IsNull()); | 10338 ASSERT(!core_lib.IsNull()); |
10319 const Namespace& ns = Namespace::Handle( | 10339 const Namespace& ns = Namespace::Handle(zone, |
10320 Namespace::New(core_lib, Object::null_array(), Object::null_array())); | 10340 Namespace::New(core_lib, Object::null_array(), Object::null_array())); |
10321 result.AddImport(ns); | 10341 result.AddImport(ns); |
10322 } | 10342 } |
10323 return result.raw(); | 10343 return result.raw(); |
10324 } | 10344 } |
10325 | 10345 |
10326 | 10346 |
10327 RawLibrary* Library::New(const String& url) { | 10347 RawLibrary* Library::New(const String& url) { |
10328 return NewLibraryHelper(url, false); | 10348 return NewLibraryHelper(url, false); |
10329 } | 10349 } |
(...skipping 11703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22033 return UserTag::null(); | 22053 return UserTag::null(); |
22034 } | 22054 } |
22035 | 22055 |
22036 | 22056 |
22037 const char* UserTag::ToCString() const { | 22057 const char* UserTag::ToCString() const { |
22038 const String& tag_label = String::Handle(label()); | 22058 const String& tag_label = String::Handle(label()); |
22039 return tag_label.ToCString(); | 22059 return tag_label.ToCString(); |
22040 } | 22060 } |
22041 | 22061 |
22042 } // namespace dart | 22062 } // namespace dart |
OLD | NEW |