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 VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
6 #define VM_OBJECT_H_ | 6 #define 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 2581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2592 | 2592 |
2593 // Library scope name dictionary. | 2593 // Library scope name dictionary. |
2594 // | 2594 // |
2595 // TODO(turnidge): The Lookup functions are not consistent in how | 2595 // TODO(turnidge): The Lookup functions are not consistent in how |
2596 // they deal with private names. Go through and make them a bit | 2596 // they deal with private names. Go through and make them a bit |
2597 // more regular. | 2597 // more regular. |
2598 void AddClass(const Class& cls) const; | 2598 void AddClass(const Class& cls) const; |
2599 void AddObject(const Object& obj, const String& name) const; | 2599 void AddObject(const Object& obj, const String& name) const; |
2600 void ReplaceObject(const Object& obj, const String& name) const; | 2600 void ReplaceObject(const Object& obj, const String& name) const; |
2601 RawObject* LookupReExport(const String& name) const; | 2601 RawObject* LookupReExport(const String& name) const; |
2602 RawObject* LookupObject(const String& name) const; | |
2603 RawObject* LookupObjectAllowPrivate(const String& name) const; | 2602 RawObject* LookupObjectAllowPrivate(const String& name) const; |
2604 RawObject* LookupLocalObjectAllowPrivate(const String& name) const; | 2603 RawObject* LookupLocalObjectAllowPrivate(const String& name) const; |
2605 RawObject* LookupLocalObject(const String& name) const; | 2604 RawObject* LookupLocalObject(const String& name) const; |
2606 RawObject* LookupImportedObject(const String& name) const; | 2605 RawObject* LookupImportedObject(const String& name) const; |
2607 RawClass* LookupClass(const String& name) const; | 2606 RawClass* LookupClass(const String& name) const; |
2608 RawClass* LookupClassAllowPrivate(const String& name) const; | 2607 RawClass* LookupClassAllowPrivate(const String& name) const; |
2609 RawClass* LookupLocalClass(const String& name) const; | 2608 RawClass* LookupLocalClass(const String& name) const; |
2610 RawField* LookupFieldAllowPrivate(const String& name) const; | 2609 RawField* LookupFieldAllowPrivate(const String& name) const; |
2611 RawField* LookupLocalField(const String& name) const; | 2610 RawField* LookupLocalField(const String& name) const; |
2612 RawFunction* LookupFunctionAllowPrivate(const String& name) const; | 2611 RawFunction* LookupFunctionAllowPrivate(const String& name) const; |
2613 RawFunction* LookupLocalFunction(const String& name) const; | 2612 RawFunction* LookupLocalFunction(const String& name) const; |
2614 RawLibraryPrefix* LookupLocalLibraryPrefix(const String& name) const; | 2613 RawLibraryPrefix* LookupLocalLibraryPrefix(const String& name) const; |
2615 RawScript* LookupScript(const String& url) const; | 2614 RawScript* LookupScript(const String& url) const; |
2616 RawArray* LoadedScripts() const; | 2615 RawArray* LoadedScripts() const; |
2617 | 2616 |
| 2617 // Resolve name in the scope of this library. First check the cache |
| 2618 // of already resolved names for this library. Then look in the |
| 2619 // local dictionary for the unmangled name N, the getter name get:N |
| 2620 // and setter name set:N. |
| 2621 // If the local dictionary contains no entry for these names, |
| 2622 // look in the scopes of all libraries that are imported |
| 2623 // without a library prefix. |
| 2624 RawObject* ResolveName(const String& name) const; |
| 2625 |
2618 void AddAnonymousClass(const Class& cls) const; | 2626 void AddAnonymousClass(const Class& cls) const; |
2619 | 2627 |
2620 void AddExport(const Namespace& ns) const; | 2628 void AddExport(const Namespace& ns) const; |
2621 | 2629 |
2622 void AddClassMetadata(const Class& cls, intptr_t token_pos) const; | 2630 void AddClassMetadata(const Class& cls, intptr_t token_pos) const; |
2623 void AddFieldMetadata(const Field& field, intptr_t token_pos) const; | 2631 void AddFieldMetadata(const Field& field, intptr_t token_pos) const; |
2624 void AddFunctionMetadata(const Function& func, intptr_t token_pos) const; | 2632 void AddFunctionMetadata(const Function& func, intptr_t token_pos) const; |
2625 void AddLibraryMetadata(const Class& cls, intptr_t token_pos) const; | 2633 void AddLibraryMetadata(const Class& cls, intptr_t token_pos) const; |
2626 void AddTypeParameterMetadata(const TypeParameter& param, | 2634 void AddTypeParameterMetadata(const TypeParameter& param, |
2627 intptr_t token_pos) const; | 2635 intptr_t token_pos) const; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2716 void set_num_imports(intptr_t value) const { | 2724 void set_num_imports(intptr_t value) const { |
2717 raw_ptr()->num_imports_ = value; | 2725 raw_ptr()->num_imports_ = value; |
2718 } | 2726 } |
2719 RawArray* imports() const { return raw_ptr()->imports_; } | 2727 RawArray* imports() const { return raw_ptr()->imports_; } |
2720 RawArray* exports() const { return raw_ptr()->exports_; } | 2728 RawArray* exports() const { return raw_ptr()->exports_; } |
2721 bool HasExports() const; | 2729 bool HasExports() const; |
2722 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; } | 2730 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; } |
2723 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; } | 2731 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; } |
2724 RawArray* dictionary() const { return raw_ptr()->dictionary_; } | 2732 RawArray* dictionary() const { return raw_ptr()->dictionary_; } |
2725 void InitClassDictionary() const; | 2733 void InitClassDictionary() const; |
| 2734 |
| 2735 RawArray* resolved_names() const { return raw_ptr()->resolved_names_; } |
| 2736 void InitResolvedNamesCache(intptr_t size) const; |
| 2737 void GrowResolvedNamesCache() const; |
| 2738 bool LookupResolvedNamesCache(const String& name, Object* obj) const; |
| 2739 void AddToResolvedNamesCache(const String& name, const Object& obj) const; |
| 2740 void InvalidateResolvedName(const String& name) const; |
| 2741 void InvalidateResolvedNamesCache() const; |
| 2742 |
2726 void InitImportList() const; | 2743 void InitImportList() const; |
2727 void GrowDictionary(const Array& dict, intptr_t dict_size) const; | 2744 void GrowDictionary(const Array& dict, intptr_t dict_size) const; |
2728 static RawLibrary* NewLibraryHelper(const String& url, | 2745 static RawLibrary* NewLibraryHelper(const String& url, |
2729 bool import_core_lib); | 2746 bool import_core_lib); |
2730 RawObject* LookupEntry(const String& name, intptr_t *index) const; | 2747 RawObject* LookupEntry(const String& name, intptr_t *index) const; |
2731 | 2748 |
2732 RawString* MakeMetadataName(const Object& obj) const; | 2749 RawString* MakeMetadataName(const Object& obj) const; |
2733 RawField* GetMetadataField(const String& metaname) const; | 2750 RawField* GetMetadataField(const String& metaname) const; |
2734 void AddMetadata(const Class& cls, | 2751 void AddMetadata(const Class& cls, |
2735 const String& name, | 2752 const String& name, |
(...skipping 3939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6675 | 6692 |
6676 | 6693 |
6677 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6694 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6678 intptr_t index) { | 6695 intptr_t index) { |
6679 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6696 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6680 } | 6697 } |
6681 | 6698 |
6682 } // namespace dart | 6699 } // namespace dart |
6683 | 6700 |
6684 #endif // VM_OBJECT_H_ | 6701 #endif // VM_OBJECT_H_ |
OLD | NEW |