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

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

Issue 154733003: Access to imports in the VM's runtime mirrors. Extend test coverage of the source mirrors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
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 2603 matching lines...) Expand 10 before | Expand all | Expand 10 after
2614 void AddFunctionMetadata(const Function& func, intptr_t token_pos) const; 2614 void AddFunctionMetadata(const Function& func, intptr_t token_pos) const;
2615 void AddLibraryMetadata(const Class& cls, intptr_t token_pos) const; 2615 void AddLibraryMetadata(const Class& cls, intptr_t token_pos) const;
2616 void AddTypeParameterMetadata(const TypeParameter& param, 2616 void AddTypeParameterMetadata(const TypeParameter& param,
2617 intptr_t token_pos) const; 2617 intptr_t token_pos) const;
2618 RawObject* GetMetadata(const Object& obj) const; 2618 RawObject* GetMetadata(const Object& obj) const;
2619 2619
2620 intptr_t num_anonymous_classes() const { return raw_ptr()->num_anonymous_; } 2620 intptr_t num_anonymous_classes() const { return raw_ptr()->num_anonymous_; }
2621 RawArray* anonymous_classes() const { return raw_ptr()->anonymous_classes_; } 2621 RawArray* anonymous_classes() const { return raw_ptr()->anonymous_classes_; }
2622 2622
2623 // Library imports. 2623 // Library imports.
2624 RawArray* imports() const { return raw_ptr()->imports_; }
2625 RawArray* exports() const { return raw_ptr()->exports_; }
2624 void AddImport(const Namespace& ns) const; 2626 void AddImport(const Namespace& ns) const;
2625 intptr_t num_imports() const { return raw_ptr()->num_imports_; } 2627 intptr_t num_imports() const { return raw_ptr()->num_imports_; }
2626 RawNamespace* ImportAt(intptr_t index) const; 2628 RawNamespace* ImportAt(intptr_t index) const;
2627 RawLibrary* ImportLibraryAt(intptr_t index) const; 2629 RawLibrary* ImportLibraryAt(intptr_t index) const;
2628 bool ImportsCorelib() const; 2630 bool ImportsCorelib() const;
2629 2631
2630 RawFunction* LookupFunctionInScript(const Script& script, 2632 RawFunction* LookupFunctionInScript(const Script& script,
2631 intptr_t token_pos) const; 2633 intptr_t token_pos) const;
2632 2634
2633 // Resolving native methods for script loaded in the library. 2635 // Resolving native methods for script loaded in the library.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2699 2701
2700 private: 2702 private:
2701 static const int kInitialImportsCapacity = 4; 2703 static const int kInitialImportsCapacity = 4;
2702 static const int kImportsCapacityIncrement = 8; 2704 static const int kImportsCapacityIncrement = 8;
2703 2705
2704 static RawLibrary* New(); 2706 static RawLibrary* New();
2705 2707
2706 void set_num_imports(intptr_t value) const { 2708 void set_num_imports(intptr_t value) const {
2707 raw_ptr()->num_imports_ = value; 2709 raw_ptr()->num_imports_ = value;
2708 } 2710 }
2709 RawArray* imports() const { return raw_ptr()->imports_; }
2710 RawArray* exports() const { return raw_ptr()->exports_; }
2711 bool HasExports() const; 2711 bool HasExports() const;
2712 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; } 2712 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; }
2713 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; } 2713 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; }
2714 RawArray* dictionary() const { return raw_ptr()->dictionary_; } 2714 RawArray* dictionary() const { return raw_ptr()->dictionary_; }
2715 void InitClassDictionary() const; 2715 void InitClassDictionary() const;
2716 void InitImportList() const; 2716 void InitImportList() const;
2717 void GrowDictionary(const Array& dict, intptr_t dict_size) const; 2717 void GrowDictionary(const Array& dict, intptr_t dict_size) const;
2718 static RawLibrary* NewLibraryHelper(const String& url, 2718 static RawLibrary* NewLibraryHelper(const String& url,
2719 bool import_core_lib); 2719 bool import_core_lib);
2720 RawObject* LookupEntry(const String& name, intptr_t *index) const; 2720 RawObject* LookupEntry(const String& name, intptr_t *index) const;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2772 2772
2773 2773
2774 // A Namespace contains the names in a library dictionary, filtered by 2774 // A Namespace contains the names in a library dictionary, filtered by
2775 // the show/hide combinators. 2775 // the show/hide combinators.
2776 class Namespace : public Object { 2776 class Namespace : public Object {
2777 public: 2777 public:
2778 RawLibrary* library() const { return raw_ptr()->library_; } 2778 RawLibrary* library() const { return raw_ptr()->library_; }
2779 RawArray* show_names() const { return raw_ptr()->show_names_; } 2779 RawArray* show_names() const { return raw_ptr()->show_names_; }
2780 RawArray* hide_names() const { return raw_ptr()->hide_names_; } 2780 RawArray* hide_names() const { return raw_ptr()->hide_names_; }
2781 2781
2782 void AddMetadata(intptr_t token_pos, const Class& owner_class);
2783 RawObject* GetMetadata() const;
2784
2782 static intptr_t InstanceSize() { 2785 static intptr_t InstanceSize() {
2783 return RoundedAllocationSize(sizeof(RawNamespace)); 2786 return RoundedAllocationSize(sizeof(RawNamespace));
2784 } 2787 }
2785 2788
2786 bool HidesName(const String& name) const; 2789 bool HidesName(const String& name) const;
2787 RawObject* Lookup(const String& name) const; 2790 RawObject* Lookup(const String& name) const;
2788 2791
2789 static RawNamespace* New(const Library& library, 2792 static RawNamespace* New(const Library& library,
2790 const Array& show_names, 2793 const Array& show_names,
2791 const Array& hide_names); 2794 const Array& hide_names);
2792 2795
2793 private: 2796 private:
2794 static RawNamespace* New(); 2797 static RawNamespace* New();
2795 2798
2799 RawField* metadata_field() const { return raw_ptr()->metadata_field_; }
2800 void set_metadata_field(const Field& value) const;
2801
2796 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object); 2802 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object);
2797 friend class Class; 2803 friend class Class;
2798 }; 2804 };
2799 2805
2800 2806
2801 class Instructions : public Object { 2807 class Instructions : public Object {
2802 public: 2808 public:
2803 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize(). 2809 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize().
2804 RawCode* code() const { return raw_ptr()->code_; } 2810 RawCode* code() const { return raw_ptr()->code_; }
2805 static intptr_t code_offset() { 2811 static intptr_t code_offset() {
(...skipping 3859 matching lines...) Expand 10 before | Expand all | Expand 10 after
6665 6671
6666 6672
6667 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6673 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6668 intptr_t index) { 6674 intptr_t index) {
6669 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6675 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6670 } 6676 }
6671 6677
6672 } // namespace dart 6678 } // namespace dart
6673 6679
6674 #endif // VM_OBJECT_H_ 6680 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698