Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Side by Side Diff: runtime/vm/object.h

Issue 1902563002: Add per-library cache of exported names (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3513 matching lines...) Expand 10 before | Expand all | Expand 10 after
3524 3524
3525 // Library scope name dictionary. 3525 // Library scope name dictionary.
3526 // 3526 //
3527 // TODO(turnidge): The Lookup functions are not consistent in how 3527 // TODO(turnidge): The Lookup functions are not consistent in how
3528 // they deal with private names. Go through and make them a bit 3528 // they deal with private names. Go through and make them a bit
3529 // more regular. 3529 // more regular.
3530 void AddClass(const Class& cls) const; 3530 void AddClass(const Class& cls) const;
3531 void AddObject(const Object& obj, const String& name) const; 3531 void AddObject(const Object& obj, const String& name) const;
3532 void ReplaceObject(const Object& obj, const String& name) const; 3532 void ReplaceObject(const Object& obj, const String& name) const;
3533 bool RemoveObject(const Object& obj, const String& name) const; 3533 bool RemoveObject(const Object& obj, const String& name) const;
3534 RawObject* LookupReExport(const String& name) const; 3534 RawObject* LookupReExport(const String& name,
3535 ZoneGrowableArray<intptr_t>* visited = NULL) const;
3535 RawObject* LookupObjectAllowPrivate(const String& name) const; 3536 RawObject* LookupObjectAllowPrivate(const String& name) const;
3536 RawObject* LookupLocalObjectAllowPrivate(const String& name) const; 3537 RawObject* LookupLocalObjectAllowPrivate(const String& name) const;
3537 RawObject* LookupLocalObject(const String& name) const; 3538 RawObject* LookupLocalObject(const String& name) const;
3538 RawObject* LookupImportedObject(const String& name) const; 3539 RawObject* LookupImportedObject(const String& name) const;
3539 RawClass* LookupClass(const String& name) const; 3540 RawClass* LookupClass(const String& name) const;
3540 RawClass* LookupClassAllowPrivate(const String& name) const; 3541 RawClass* LookupClassAllowPrivate(const String& name) const;
3541 RawClass* LookupLocalClass(const String& name) const; 3542 RawClass* LookupLocalClass(const String& name) const;
3542 RawField* LookupFieldAllowPrivate(const String& name) const; 3543 RawField* LookupFieldAllowPrivate(const String& name) const;
3543 RawField* LookupLocalField(const String& name) const; 3544 RawField* LookupLocalField(const String& name) const;
3544 RawFunction* LookupFunctionAllowPrivate(const String& name) const; 3545 RawFunction* LookupFunctionAllowPrivate(const String& name) const;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3577 } 3578 }
3578 void set_toplevel_class(const Class& value) const; 3579 void set_toplevel_class(const Class& value) const;
3579 3580
3580 RawGrowableObjectArray* patch_classes() const { 3581 RawGrowableObjectArray* patch_classes() const {
3581 return raw_ptr()->patch_classes_; 3582 return raw_ptr()->patch_classes_;
3582 } 3583 }
3583 3584
3584 // Library imports. 3585 // Library imports.
3585 RawArray* imports() const { return raw_ptr()->imports_; } 3586 RawArray* imports() const { return raw_ptr()->imports_; }
3586 RawArray* exports() const { return raw_ptr()->exports_; } 3587 RawArray* exports() const { return raw_ptr()->exports_; }
3587 RawArray* exports2() const { return raw_ptr()->exports2_; }
3588 void AddImport(const Namespace& ns) const; 3588 void AddImport(const Namespace& ns) const;
3589 intptr_t num_imports() const { return raw_ptr()->num_imports_; } 3589 intptr_t num_imports() const { return raw_ptr()->num_imports_; }
3590 RawNamespace* ImportAt(intptr_t index) const; 3590 RawNamespace* ImportAt(intptr_t index) const;
3591 RawLibrary* ImportLibraryAt(intptr_t index) const; 3591 RawLibrary* ImportLibraryAt(intptr_t index) const;
3592 bool ImportsCorelib() const; 3592 bool ImportsCorelib() const;
3593 3593
3594 void DropDependencies() const; 3594 void DropDependencies() const;
3595 3595
3596 // Resolving native methods for script loaded in the library. 3596 // Resolving native methods for script loaded in the library.
3597 Dart_NativeEntryResolver native_entry_resolver() const { 3597 Dart_NativeEntryResolver native_entry_resolver() const {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
3703 void set_num_imports(intptr_t value) const; 3703 void set_num_imports(intptr_t value) const;
3704 bool HasExports() const; 3704 bool HasExports() const;
3705 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; } 3705 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; }
3706 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; } 3706 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; }
3707 RawArray* dictionary() const { return raw_ptr()->dictionary_; } 3707 RawArray* dictionary() const { return raw_ptr()->dictionary_; }
3708 void InitClassDictionary() const; 3708 void InitClassDictionary() const;
3709 3709
3710 RawArray* resolved_names() const { return raw_ptr()->resolved_names_; } 3710 RawArray* resolved_names() const { return raw_ptr()->resolved_names_; }
3711 void InitResolvedNamesCache(intptr_t size, 3711 void InitResolvedNamesCache(intptr_t size,
3712 SnapshotReader* reader = NULL) const; 3712 SnapshotReader* reader = NULL) const;
3713 void GrowResolvedNamesCache() const; 3713 void AllocateExportedNamesCache() const;
3714 void InitExportedNamesCache() const;
3715 static void InvalidateExportedNamesCaches();
3714 bool LookupResolvedNamesCache(const String& name, Object* obj) const; 3716 bool LookupResolvedNamesCache(const String& name, Object* obj) const;
3715 void AddToResolvedNamesCache(const String& name, const Object& obj) const; 3717 void AddToResolvedNamesCache(const String& name, const Object& obj) const;
3716 void InvalidateResolvedName(const String& name) const; 3718 void InvalidateResolvedName(const String& name) const;
3717 void InvalidateResolvedNamesCache() const; 3719 void InvalidateResolvedNamesCache() const;
3718 3720
3721 RawArray* exported_names() const { return raw_ptr()->exported_names_; }
3722 bool LookupExportedNamesCache(const String& name, Object* obj) const;
3723 void AddToExportedNamesCache(const String& name, const Object& obj) const;
3724
3725
3719 void InitImportList() const; 3726 void InitImportList() const;
3720 void GrowDictionary(const Array& dict, intptr_t dict_size) const; 3727 void GrowDictionary(const Array& dict, intptr_t dict_size) const;
3721 static RawLibrary* NewLibraryHelper(const String& url, 3728 static RawLibrary* NewLibraryHelper(const String& url,
3722 bool import_core_lib); 3729 bool import_core_lib);
3723 RawObject* LookupEntry(const String& name, intptr_t *index) const; 3730 RawObject* LookupEntry(const String& name, intptr_t *index) const;
3724 3731
3725 static bool IsKeyUsed(intptr_t key); 3732 static bool IsKeyUsed(intptr_t key);
3726 void AllocatePrivateKey() const; 3733 void AllocatePrivateKey() const;
3727 3734
3728 RawString* MakeMetadataName(const Object& obj) const; 3735 RawString* MakeMetadataName(const Object& obj) const;
3729 RawField* GetMetadataField(const String& metaname) const; 3736 RawField* GetMetadataField(const String& metaname) const;
3730 void AddMetadata(const Object& owner, 3737 void AddMetadata(const Object& owner,
3731 const String& name, 3738 const String& name,
3732 TokenPosition token_pos) const; 3739 TokenPosition token_pos) const;
3733 3740
3734 FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object); 3741 FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object);
3735 3742
3736 friend class Bootstrap; 3743 friend class Bootstrap;
3737 friend class Class; 3744 friend class Class;
3738 friend class Debugger; 3745 friend class Debugger;
3746 friend class Isolate;
3739 friend class DictionaryIterator; 3747 friend class DictionaryIterator;
3740 friend class Namespace; 3748 friend class Namespace;
3741 friend class Object; 3749 friend class Object;
3742 }; 3750 };
3743 3751
3744 3752
3745 // A Namespace contains the names in a library dictionary, filtered by 3753 // A Namespace contains the names in a library dictionary, filtered by
3746 // the show/hide combinators. 3754 // the show/hide combinators.
3747 class Namespace : public Object { 3755 class Namespace : public Object {
3748 public: 3756 public:
3749 RawLibrary* library() const { return raw_ptr()->library_; } 3757 RawLibrary* library() const { return raw_ptr()->library_; }
3750 RawArray* show_names() const { return raw_ptr()->show_names_; } 3758 RawArray* show_names() const { return raw_ptr()->show_names_; }
3751 RawArray* hide_names() const { return raw_ptr()->hide_names_; } 3759 RawArray* hide_names() const { return raw_ptr()->hide_names_; }
3752 3760
3753 void AddMetadata(const Object& owner, TokenPosition token_pos); 3761 void AddMetadata(const Object& owner, TokenPosition token_pos);
3754 RawObject* GetMetadata() const; 3762 RawObject* GetMetadata() const;
3755 3763
3756 static intptr_t InstanceSize() { 3764 static intptr_t InstanceSize() {
3757 return RoundedAllocationSize(sizeof(RawNamespace)); 3765 return RoundedAllocationSize(sizeof(RawNamespace));
3758 } 3766 }
3759 3767
3760 bool HidesName(const String& name) const; 3768 bool HidesName(const String& name) const;
3761 RawObject* Lookup(const String& name) const; 3769 RawObject* Lookup(const String& name,
3770 ZoneGrowableArray<intptr_t>* trail = NULL) const;
3762 3771
3763 static RawNamespace* New(const Library& library, 3772 static RawNamespace* New(const Library& library,
3764 const Array& show_names, 3773 const Array& show_names,
3765 const Array& hide_names); 3774 const Array& hide_names);
3766 3775
3767 private: 3776 private:
3768 static RawNamespace* New(); 3777 static RawNamespace* New();
3769 3778
3770 RawField* metadata_field() const { return raw_ptr()->metadata_field_; } 3779 RawField* metadata_field() const { return raw_ptr()->metadata_field_; }
3771 void set_metadata_field(const Field& value) const; 3780 void set_metadata_field(const Field& value) const;
(...skipping 4720 matching lines...) Expand 10 before | Expand all | Expand 10 after
8492 8501
8493 8502
8494 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 8503 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
8495 intptr_t index) { 8504 intptr_t index) {
8496 return array.At((index * kEntryLength) + kTargetFunctionIndex); 8505 return array.At((index * kEntryLength) + kTargetFunctionIndex);
8497 } 8506 }
8498 8507
8499 } // namespace dart 8508 } // namespace dart
8500 8509
8501 #endif // VM_OBJECT_H_ 8510 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698