| 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_; } |
| 2556 void AddImport(const Namespace& ns) const; | 2558 void AddImport(const Namespace& ns) const; |
| 2557 intptr_t num_imports() const { return raw_ptr()->num_imports_; } | 2559 intptr_t num_imports() const { return raw_ptr()->num_imports_; } |
| 2558 RawNamespace* ImportAt(intptr_t index) const; | 2560 RawNamespace* ImportAt(intptr_t index) const; |
| 2559 RawLibrary* ImportLibraryAt(intptr_t index) const; | 2561 RawLibrary* ImportLibraryAt(intptr_t index) const; |
| 2560 bool ImportsCorelib() const; | 2562 bool ImportsCorelib() const; |
| 2561 | 2563 |
| 2562 RawFunction* LookupFunctionInScript(const Script& script, | 2564 RawFunction* LookupFunctionInScript(const Script& script, |
| 2563 intptr_t token_pos) const; | 2565 intptr_t token_pos) const; |
| 2564 | 2566 |
| 2565 // Resolving native methods for script loaded in the library. | 2567 // Resolving native methods for script loaded in the library. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2637 | 2639 |
| 2638 private: | 2640 private: |
| 2639 static const int kInitialImportsCapacity = 4; | 2641 static const int kInitialImportsCapacity = 4; |
| 2640 static const int kImportsCapacityIncrement = 8; | 2642 static const int kImportsCapacityIncrement = 8; |
| 2641 | 2643 |
| 2642 static RawLibrary* New(); | 2644 static RawLibrary* New(); |
| 2643 | 2645 |
| 2644 void set_num_imports(intptr_t value) const { | 2646 void set_num_imports(intptr_t value) const { |
| 2645 raw_ptr()->num_imports_ = value; | 2647 raw_ptr()->num_imports_ = value; |
| 2646 } | 2648 } |
| 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 |
| 2732 static intptr_t InstanceSize() { | 2735 static intptr_t InstanceSize() { |
| 2733 return RoundedAllocationSize(sizeof(RawNamespace)); | 2736 return RoundedAllocationSize(sizeof(RawNamespace)); |
| 2734 } | 2737 } |
| 2735 | 2738 |
| 2736 bool HidesName(const String& name) const; | 2739 bool HidesName(const String& name) const; |
| 2737 RawObject* Lookup(const String& name) const; | 2740 RawObject* Lookup(const String& name) const; |
| 2738 | 2741 |
| 2739 static RawNamespace* New(const Library& library, | 2742 static RawNamespace* New(const Library& library, |
| 2740 const Array& show_names, | 2743 const Array& show_names, |
| 2741 const Array& hide_names); | 2744 const Array& hide_names); |
| 2742 | 2745 |
| 2743 private: | 2746 private: |
| 2744 static RawNamespace* New(); | 2747 static RawNamespace* New(); |
| 2745 | 2748 |
| 2749 RawField* metadata_field() const { return raw_ptr()->metadata_field_; } |
| 2750 void set_metadata_field(const Field& value) const; |
| 2751 |
| 2746 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object); | 2752 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object); |
| 2747 friend class Class; | 2753 friend class Class; |
| 2748 }; | 2754 }; |
| 2749 | 2755 |
| 2750 | 2756 |
| 2751 class Instructions : public Object { | 2757 class Instructions : public Object { |
| 2752 public: | 2758 public: |
| 2753 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize(). | 2759 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize(). |
| 2754 RawCode* code() const { return raw_ptr()->code_; } | 2760 RawCode* code() const { return raw_ptr()->code_; } |
| 2755 static intptr_t code_offset() { | 2761 static intptr_t code_offset() { |
| (...skipping 3924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6680 | 6686 |
| 6681 | 6687 |
| 6682 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6688 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6683 intptr_t index) { | 6689 intptr_t index) { |
| 6684 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6690 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6685 } | 6691 } |
| 6686 | 6692 |
| 6687 } // namespace dart | 6693 } // namespace dart |
| 6688 | 6694 |
| 6689 #endif // VM_OBJECT_H_ | 6695 #endif // VM_OBJECT_H_ |
| OLD | NEW |