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 2535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2546 void AddFunctionMetadata(const Function& func, intptr_t token_pos) const; | 2546 void AddFunctionMetadata(const Function& func, intptr_t token_pos) const; |
2547 void AddLibraryMetadata(const Class& cls, intptr_t token_pos) const; | 2547 void AddLibraryMetadata(const Class& cls, intptr_t token_pos) const; |
2548 void AddTypeParameterMetadata(const TypeParameter& param, | 2548 void AddTypeParameterMetadata(const TypeParameter& param, |
2549 intptr_t token_pos) const; | 2549 intptr_t token_pos) const; |
2550 RawObject* GetMetadata(const Object& obj) const; | 2550 RawObject* GetMetadata(const Object& obj) const; |
2551 | 2551 |
2552 intptr_t num_anonymous_classes() const { return raw_ptr()->num_anonymous_; } | 2552 intptr_t num_anonymous_classes() const { return raw_ptr()->num_anonymous_; } |
2553 RawArray* anonymous_classes() const { return raw_ptr()->anonymous_classes_; } | 2553 RawArray* anonymous_classes() const { return raw_ptr()->anonymous_classes_; } |
2554 | 2554 |
2555 // Library imports. | 2555 // Library imports. |
2556 RawArray* imports() const { return raw_ptr()->imports_; } | |
2557 RawArray* exports() const { return raw_ptr()->exports_; } | |
2558 void AddImport(const Namespace& ns) const; | 2556 void AddImport(const Namespace& ns) const; |
2559 intptr_t num_imports() const { return raw_ptr()->num_imports_; } | 2557 intptr_t num_imports() const { return raw_ptr()->num_imports_; } |
2560 RawNamespace* ImportAt(intptr_t index) const; | 2558 RawNamespace* ImportAt(intptr_t index) const; |
2561 RawLibrary* ImportLibraryAt(intptr_t index) const; | 2559 RawLibrary* ImportLibraryAt(intptr_t index) const; |
2562 bool ImportsCorelib() const; | 2560 bool ImportsCorelib() const; |
2563 | 2561 |
2564 RawFunction* LookupFunctionInScript(const Script& script, | 2562 RawFunction* LookupFunctionInScript(const Script& script, |
2565 intptr_t token_pos) const; | 2563 intptr_t token_pos) const; |
2566 | 2564 |
2567 // Resolving native methods for script loaded in the library. | 2565 // Resolving native methods for script loaded in the library. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2639 | 2637 |
2640 private: | 2638 private: |
2641 static const int kInitialImportsCapacity = 4; | 2639 static const int kInitialImportsCapacity = 4; |
2642 static const int kImportsCapacityIncrement = 8; | 2640 static const int kImportsCapacityIncrement = 8; |
2643 | 2641 |
2644 static RawLibrary* New(); | 2642 static RawLibrary* New(); |
2645 | 2643 |
2646 void set_num_imports(intptr_t value) const { | 2644 void set_num_imports(intptr_t value) const { |
2647 raw_ptr()->num_imports_ = value; | 2645 raw_ptr()->num_imports_ = value; |
2648 } | 2646 } |
| 2647 RawArray* imports() const { return raw_ptr()->imports_; } |
| 2648 RawArray* exports() const { return raw_ptr()->exports_; } |
2649 bool HasExports() const; | 2649 bool HasExports() const; |
2650 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; } | 2650 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; } |
2651 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; } | 2651 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; } |
2652 RawArray* dictionary() const { return raw_ptr()->dictionary_; } | 2652 RawArray* dictionary() const { return raw_ptr()->dictionary_; } |
2653 void InitClassDictionary() const; | 2653 void InitClassDictionary() const; |
2654 | 2654 |
2655 RawArray* resolved_names() const { return raw_ptr()->resolved_names_; } | 2655 RawArray* resolved_names() const { return raw_ptr()->resolved_names_; } |
2656 void InitResolvedNamesCache(intptr_t size) const; | 2656 void InitResolvedNamesCache(intptr_t size) const; |
2657 void GrowResolvedNamesCache() const; | 2657 void GrowResolvedNamesCache() const; |
2658 bool LookupResolvedNamesCache(const String& name, Object* obj) const; | 2658 bool LookupResolvedNamesCache(const String& name, Object* obj) const; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2722 | 2722 |
2723 | 2723 |
2724 // A Namespace contains the names in a library dictionary, filtered by | 2724 // A Namespace contains the names in a library dictionary, filtered by |
2725 // the show/hide combinators. | 2725 // the show/hide combinators. |
2726 class Namespace : public Object { | 2726 class Namespace : public Object { |
2727 public: | 2727 public: |
2728 RawLibrary* library() const { return raw_ptr()->library_; } | 2728 RawLibrary* library() const { return raw_ptr()->library_; } |
2729 RawArray* show_names() const { return raw_ptr()->show_names_; } | 2729 RawArray* show_names() const { return raw_ptr()->show_names_; } |
2730 RawArray* hide_names() const { return raw_ptr()->hide_names_; } | 2730 RawArray* hide_names() const { return raw_ptr()->hide_names_; } |
2731 | 2731 |
2732 void AddMetadata(intptr_t token_pos, const Class& owner_class); | |
2733 RawObject* GetMetadata() const; | |
2734 | |
2735 static intptr_t InstanceSize() { | 2732 static intptr_t InstanceSize() { |
2736 return RoundedAllocationSize(sizeof(RawNamespace)); | 2733 return RoundedAllocationSize(sizeof(RawNamespace)); |
2737 } | 2734 } |
2738 | 2735 |
2739 bool HidesName(const String& name) const; | 2736 bool HidesName(const String& name) const; |
2740 RawObject* Lookup(const String& name) const; | 2737 RawObject* Lookup(const String& name) const; |
2741 | 2738 |
2742 static RawNamespace* New(const Library& library, | 2739 static RawNamespace* New(const Library& library, |
2743 const Array& show_names, | 2740 const Array& show_names, |
2744 const Array& hide_names); | 2741 const Array& hide_names); |
2745 | 2742 |
2746 private: | 2743 private: |
2747 static RawNamespace* New(); | 2744 static RawNamespace* New(); |
2748 | 2745 |
2749 RawField* metadata_field() const { return raw_ptr()->metadata_field_; } | |
2750 void set_metadata_field(const Field& value) const; | |
2751 | |
2752 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object); | 2746 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object); |
2753 friend class Class; | 2747 friend class Class; |
2754 }; | 2748 }; |
2755 | 2749 |
2756 | 2750 |
2757 class Instructions : public Object { | 2751 class Instructions : public Object { |
2758 public: | 2752 public: |
2759 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize(). | 2753 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize(). |
2760 RawCode* code() const { return raw_ptr()->code_; } | 2754 RawCode* code() const { return raw_ptr()->code_; } |
2761 static intptr_t code_offset() { | 2755 static intptr_t code_offset() { |
(...skipping 3924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6686 | 6680 |
6687 | 6681 |
6688 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6682 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6689 intptr_t index) { | 6683 intptr_t index) { |
6690 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6684 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6691 } | 6685 } |
6692 | 6686 |
6693 } // namespace dart | 6687 } // namespace dart |
6694 | 6688 |
6695 #endif // VM_OBJECT_H_ | 6689 #endif // VM_OBJECT_H_ |
OLD | NEW |