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 #ifndef RUNTIME_VM_OBJECT_H_ | 5 #ifndef RUNTIME_VM_OBJECT_H_ |
6 #define RUNTIME_VM_OBJECT_H_ | 6 #define RUNTIME_VM_OBJECT_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
(...skipping 3746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3757 const Array& param_values) const; | 3757 const Array& param_values) const; |
3758 | 3758 |
3759 // Library scope name dictionary. | 3759 // Library scope name dictionary. |
3760 // | 3760 // |
3761 // TODO(turnidge): The Lookup functions are not consistent in how | 3761 // TODO(turnidge): The Lookup functions are not consistent in how |
3762 // they deal with private names. Go through and make them a bit | 3762 // they deal with private names. Go through and make them a bit |
3763 // more regular. | 3763 // more regular. |
3764 void AddClass(const Class& cls) const; | 3764 void AddClass(const Class& cls) const; |
3765 void AddObject(const Object& obj, const String& name) const; | 3765 void AddObject(const Object& obj, const String& name) const; |
3766 void ReplaceObject(const Object& obj, const String& name) const; | 3766 void ReplaceObject(const Object& obj, const String& name) const; |
3767 bool RemoveObject(const Object& obj, const String& name) const; | |
3768 RawObject* LookupReExport(const String& name, | 3767 RawObject* LookupReExport(const String& name, |
3769 ZoneGrowableArray<intptr_t>* visited = NULL) const; | 3768 ZoneGrowableArray<intptr_t>* visited = NULL) const; |
3770 RawObject* LookupObjectAllowPrivate(const String& name) const; | 3769 RawObject* LookupObjectAllowPrivate(const String& name) const; |
3771 RawObject* LookupLocalObjectAllowPrivate(const String& name) const; | 3770 RawObject* LookupLocalObjectAllowPrivate(const String& name) const; |
3772 RawObject* LookupLocalObject(const String& name) const; | 3771 RawObject* LookupLocalObject(const String& name) const; |
3773 RawObject* LookupImportedObject(const String& name) const; | 3772 RawObject* LookupImportedObject(const String& name) const; |
3774 RawClass* LookupClass(const String& name) const; | 3773 RawClass* LookupClass(const String& name) const; |
3775 RawClass* LookupClassAllowPrivate(const String& name) const; | 3774 RawClass* LookupClassAllowPrivate(const String& name) const; |
3776 RawClass* LookupLocalClass(const String& name) const; | 3775 RawClass* LookupLocalClass(const String& name) const; |
3777 RawField* LookupFieldAllowPrivate(const String& name) const; | 3776 RawField* LookupFieldAllowPrivate(const String& name) const; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3820 | 3819 |
3821 // Library imports. | 3820 // Library imports. |
3822 RawArray* imports() const { return raw_ptr()->imports_; } | 3821 RawArray* imports() const { return raw_ptr()->imports_; } |
3823 RawArray* exports() const { return raw_ptr()->exports_; } | 3822 RawArray* exports() const { return raw_ptr()->exports_; } |
3824 void AddImport(const Namespace& ns) const; | 3823 void AddImport(const Namespace& ns) const; |
3825 intptr_t num_imports() const { return raw_ptr()->num_imports_; } | 3824 intptr_t num_imports() const { return raw_ptr()->num_imports_; } |
3826 RawNamespace* ImportAt(intptr_t index) const; | 3825 RawNamespace* ImportAt(intptr_t index) const; |
3827 RawLibrary* ImportLibraryAt(intptr_t index) const; | 3826 RawLibrary* ImportLibraryAt(intptr_t index) const; |
3828 bool ImportsCorelib() const; | 3827 bool ImportsCorelib() const; |
3829 | 3828 |
3830 void DropDependencies() const; | 3829 void DropDependenciesAndCaches() const; |
3831 | 3830 |
3832 // Resolving native methods for script loaded in the library. | 3831 // Resolving native methods for script loaded in the library. |
3833 Dart_NativeEntryResolver native_entry_resolver() const { | 3832 Dart_NativeEntryResolver native_entry_resolver() const { |
3834 return raw_ptr()->native_entry_resolver_; | 3833 return raw_ptr()->native_entry_resolver_; |
3835 } | 3834 } |
3836 void set_native_entry_resolver(Dart_NativeEntryResolver value) const { | 3835 void set_native_entry_resolver(Dart_NativeEntryResolver value) const { |
3837 StoreNonPointer(&raw_ptr()->native_entry_resolver_, value); | 3836 StoreNonPointer(&raw_ptr()->native_entry_resolver_, value); |
3838 } | 3837 } |
3839 Dart_NativeEntrySymbol native_entry_symbol_resolver() const { | 3838 Dart_NativeEntrySymbol native_entry_symbol_resolver() const { |
3840 return raw_ptr()->native_entry_symbol_resolver_; | 3839 return raw_ptr()->native_entry_symbol_resolver_; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3955 | 3954 |
3956 RawArray* exported_names() const { return raw_ptr()->exported_names_; } | 3955 RawArray* exported_names() const { return raw_ptr()->exported_names_; } |
3957 bool LookupExportedNamesCache(const String& name, Object* obj) const; | 3956 bool LookupExportedNamesCache(const String& name, Object* obj) const; |
3958 void AddToExportedNamesCache(const String& name, const Object& obj) const; | 3957 void AddToExportedNamesCache(const String& name, const Object& obj) const; |
3959 void InitExportedNamesCache() const; | 3958 void InitExportedNamesCache() const; |
3960 void ClearExportedNamesCache() const; | 3959 void ClearExportedNamesCache() const; |
3961 static void InvalidateExportedNamesCaches(); | 3960 static void InvalidateExportedNamesCaches(); |
3962 | 3961 |
3963 | 3962 |
3964 void InitImportList() const; | 3963 void InitImportList() const; |
3965 void GrowDictionary(const Array& dict, intptr_t dict_size) const; | 3964 void RehashDictionary(const Array& old_dict, intptr_t new_dict_size) const; |
3966 static RawLibrary* NewLibraryHelper(const String& url, bool import_core_lib); | 3965 static RawLibrary* NewLibraryHelper(const String& url, bool import_core_lib); |
3967 RawObject* LookupEntry(const String& name, intptr_t* index) const; | 3966 RawObject* LookupEntry(const String& name, intptr_t* index) const; |
3968 | 3967 |
3969 void AllocatePrivateKey() const; | 3968 void AllocatePrivateKey() const; |
3970 | 3969 |
3971 RawString* MakeMetadataName(const Object& obj) const; | 3970 RawString* MakeMetadataName(const Object& obj) const; |
3972 RawField* GetMetadataField(const String& metaname) const; | 3971 RawField* GetMetadataField(const String& metaname) const; |
3973 void AddMetadata(const Object& owner, | 3972 void AddMetadata(const Object& owner, |
3974 const String& name, | 3973 const String& name, |
3975 TokenPosition token_pos, | 3974 TokenPosition token_pos, |
3976 kernel::TreeNode* kernel_node = NULL) const; | 3975 kernel::TreeNode* kernel_node = NULL) const; |
3977 | 3976 |
3978 FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object); | 3977 FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object); |
3979 | 3978 |
3980 friend class Bootstrap; | 3979 friend class Bootstrap; |
3981 friend class Class; | 3980 friend class Class; |
3982 friend class Debugger; | 3981 friend class Debugger; |
| 3982 friend class DictionaryIterator; |
3983 friend class Isolate; | 3983 friend class Isolate; |
3984 friend class DictionaryIterator; | 3984 friend class LibraryDeserializationCluster; |
3985 friend class Namespace; | 3985 friend class Namespace; |
3986 friend class Object; | 3986 friend class Object; |
3987 friend class LibraryDeserializationCluster; | 3987 friend class Precompiler; |
3988 }; | 3988 }; |
3989 | 3989 |
3990 | 3990 |
3991 // A Namespace contains the names in a library dictionary, filtered by | 3991 // A Namespace contains the names in a library dictionary, filtered by |
3992 // the show/hide combinators. | 3992 // the show/hide combinators. |
3993 class Namespace : public Object { | 3993 class Namespace : public Object { |
3994 public: | 3994 public: |
3995 RawLibrary* library() const { return raw_ptr()->library_; } | 3995 RawLibrary* library() const { return raw_ptr()->library_; } |
3996 RawArray* show_names() const { return raw_ptr()->show_names_; } | 3996 RawArray* show_names() const { return raw_ptr()->show_names_; } |
3997 RawArray* hide_names() const { return raw_ptr()->hide_names_; } | 3997 RawArray* hide_names() const { return raw_ptr()->hide_names_; } |
(...skipping 4986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8984 | 8984 |
8985 inline void TypeArguments::SetHash(intptr_t value) const { | 8985 inline void TypeArguments::SetHash(intptr_t value) const { |
8986 // This is only safe because we create a new Smi, which does not cause | 8986 // This is only safe because we create a new Smi, which does not cause |
8987 // heap allocation. | 8987 // heap allocation. |
8988 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8988 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
8989 } | 8989 } |
8990 | 8990 |
8991 } // namespace dart | 8991 } // namespace dart |
8992 | 8992 |
8993 #endif // RUNTIME_VM_OBJECT_H_ | 8993 #endif // RUNTIME_VM_OBJECT_H_ |
OLD | NEW |