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