| 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 static RawClass* type_arguments_class() { return type_arguments_class_; } | 440 static RawClass* type_arguments_class() { return type_arguments_class_; } |
| 441 static RawClass* patch_class_class() { return patch_class_class_; } | 441 static RawClass* patch_class_class() { return patch_class_class_; } |
| 442 static RawClass* function_class() { return function_class_; } | 442 static RawClass* function_class() { return function_class_; } |
| 443 static RawClass* closure_data_class() { return closure_data_class_; } | 443 static RawClass* closure_data_class() { return closure_data_class_; } |
| 444 static RawClass* redirection_data_class() { return redirection_data_class_; } | 444 static RawClass* redirection_data_class() { return redirection_data_class_; } |
| 445 static RawClass* field_class() { return field_class_; } | 445 static RawClass* field_class() { return field_class_; } |
| 446 static RawClass* literal_token_class() { return literal_token_class_; } | 446 static RawClass* literal_token_class() { return literal_token_class_; } |
| 447 static RawClass* token_stream_class() { return token_stream_class_; } | 447 static RawClass* token_stream_class() { return token_stream_class_; } |
| 448 static RawClass* script_class() { return script_class_; } | 448 static RawClass* script_class() { return script_class_; } |
| 449 static RawClass* library_class() { return library_class_; } | 449 static RawClass* library_class() { return library_class_; } |
| 450 static RawClass* library_prefix_class() { return library_prefix_class_; } | |
| 451 static RawClass* namespace_class() { return namespace_class_; } | 450 static RawClass* namespace_class() { return namespace_class_; } |
| 452 static RawClass* code_class() { return code_class_; } | 451 static RawClass* code_class() { return code_class_; } |
| 453 static RawClass* instructions_class() { return instructions_class_; } | 452 static RawClass* instructions_class() { return instructions_class_; } |
| 454 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; } | 453 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; } |
| 455 static RawClass* stackmap_class() { return stackmap_class_; } | 454 static RawClass* stackmap_class() { return stackmap_class_; } |
| 456 static RawClass* var_descriptors_class() { return var_descriptors_class_; } | 455 static RawClass* var_descriptors_class() { return var_descriptors_class_; } |
| 457 static RawClass* exception_handlers_class() { | 456 static RawClass* exception_handlers_class() { |
| 458 return exception_handlers_class_; | 457 return exception_handlers_class_; |
| 459 } | 458 } |
| 460 static RawClass* deopt_info_class() { return deopt_info_class_; } | 459 static RawClass* deopt_info_class() { return deopt_info_class_; } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 static RawClass* type_arguments_class_; // Class of TypeArguments vm object. | 590 static RawClass* type_arguments_class_; // Class of TypeArguments vm object. |
| 592 static RawClass* patch_class_class_; // Class of the PatchClass vm object. | 591 static RawClass* patch_class_class_; // Class of the PatchClass vm object. |
| 593 static RawClass* function_class_; // Class of the Function vm object. | 592 static RawClass* function_class_; // Class of the Function vm object. |
| 594 static RawClass* closure_data_class_; // Class of ClosureData vm obj. | 593 static RawClass* closure_data_class_; // Class of ClosureData vm obj. |
| 595 static RawClass* redirection_data_class_; // Class of RedirectionData vm obj. | 594 static RawClass* redirection_data_class_; // Class of RedirectionData vm obj. |
| 596 static RawClass* field_class_; // Class of the Field vm object. | 595 static RawClass* field_class_; // Class of the Field vm object. |
| 597 static RawClass* literal_token_class_; // Class of LiteralToken vm object. | 596 static RawClass* literal_token_class_; // Class of LiteralToken vm object. |
| 598 static RawClass* token_stream_class_; // Class of the TokenStream vm object. | 597 static RawClass* token_stream_class_; // Class of the TokenStream vm object. |
| 599 static RawClass* script_class_; // Class of the Script vm object. | 598 static RawClass* script_class_; // Class of the Script vm object. |
| 600 static RawClass* library_class_; // Class of the Library vm object. | 599 static RawClass* library_class_; // Class of the Library vm object. |
| 601 static RawClass* library_prefix_class_; // Class of Library prefix vm object. | |
| 602 static RawClass* namespace_class_; // Class of Namespace vm object. | 600 static RawClass* namespace_class_; // Class of Namespace vm object. |
| 603 static RawClass* code_class_; // Class of the Code vm object. | 601 static RawClass* code_class_; // Class of the Code vm object. |
| 604 static RawClass* instructions_class_; // Class of the Instructions vm object. | 602 static RawClass* instructions_class_; // Class of the Instructions vm object. |
| 605 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. | 603 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. |
| 606 static RawClass* stackmap_class_; // Class of Stackmap vm object. | 604 static RawClass* stackmap_class_; // Class of Stackmap vm object. |
| 607 static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors. | 605 static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors. |
| 608 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. | 606 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. |
| 609 static RawClass* deopt_info_class_; // Class of DeoptInfo. | 607 static RawClass* deopt_info_class_; // Class of DeoptInfo. |
| 610 static RawClass* context_class_; // Class of the Context vm object. | 608 static RawClass* context_class_; // Class of the Context vm object. |
| 611 static RawClass* context_scope_class_; // Class of ContextScope vm object. | 609 static RawClass* context_scope_class_; // Class of ContextScope vm object. |
| (...skipping 2103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2715 | 2713 |
| 2716 friend class Bootstrap; | 2714 friend class Bootstrap; |
| 2717 friend class Class; | 2715 friend class Class; |
| 2718 friend class Debugger; | 2716 friend class Debugger; |
| 2719 friend class DictionaryIterator; | 2717 friend class DictionaryIterator; |
| 2720 friend class Namespace; | 2718 friend class Namespace; |
| 2721 friend class Object; | 2719 friend class Object; |
| 2722 }; | 2720 }; |
| 2723 | 2721 |
| 2724 | 2722 |
| 2725 class LibraryPrefix : public Object { | |
| 2726 public: | |
| 2727 RawString* name() const { return raw_ptr()->name_; } | |
| 2728 virtual RawString* DictionaryName() const { return name(); } | |
| 2729 | |
| 2730 RawArray* imports() const { return raw_ptr()->imports_; } | |
| 2731 intptr_t num_imports() const { return raw_ptr()->num_imports_; } | |
| 2732 | |
| 2733 bool ContainsLibrary(const Library& library) const; | |
| 2734 RawLibrary* GetLibrary(int index) const; | |
| 2735 void AddImport(const Namespace& import) const; | |
| 2736 RawObject* LookupObject(const String& name) const; | |
| 2737 RawClass* LookupClass(const String& class_name) const; | |
| 2738 | |
| 2739 static intptr_t InstanceSize() { | |
| 2740 return RoundedAllocationSize(sizeof(RawLibraryPrefix)); | |
| 2741 } | |
| 2742 | |
| 2743 static RawLibraryPrefix* New(const String& name, const Namespace& import); | |
| 2744 | |
| 2745 private: | |
| 2746 static const int kInitialSize = 2; | |
| 2747 static const int kIncrementSize = 2; | |
| 2748 | |
| 2749 void set_name(const String& value) const; | |
| 2750 void set_imports(const Array& value) const; | |
| 2751 void set_num_imports(intptr_t value) const; | |
| 2752 | |
| 2753 static RawLibraryPrefix* New(); | |
| 2754 | |
| 2755 FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Object); | |
| 2756 friend class Class; | |
| 2757 }; | |
| 2758 | |
| 2759 | |
| 2760 // A Namespace contains the names in a library dictionary, filtered by | 2723 // A Namespace contains the names in a library dictionary, filtered by |
| 2761 // the show/hide combinators. | 2724 // the show/hide combinators. |
| 2762 class Namespace : public Object { | 2725 class Namespace : public Object { |
| 2763 public: | 2726 public: |
| 2764 RawLibrary* library() const { return raw_ptr()->library_; } | 2727 RawLibrary* library() const { return raw_ptr()->library_; } |
| 2765 RawArray* show_names() const { return raw_ptr()->show_names_; } | 2728 RawArray* show_names() const { return raw_ptr()->show_names_; } |
| 2766 RawArray* hide_names() const { return raw_ptr()->hide_names_; } | 2729 RawArray* hide_names() const { return raw_ptr()->hide_names_; } |
| 2767 | 2730 |
| 2768 void AddMetadata(intptr_t token_pos, const Class& owner_class); | 2731 void AddMetadata(intptr_t token_pos, const Class& owner_class); |
| 2769 RawObject* GetMetadata() const; | 2732 RawObject* GetMetadata() const; |
| (...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4117 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); | 4080 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); |
| 4118 friend class Class; | 4081 friend class Class; |
| 4119 friend class Closure; | 4082 friend class Closure; |
| 4120 friend class SnapshotWriter; | 4083 friend class SnapshotWriter; |
| 4121 friend class StubCode; | 4084 friend class StubCode; |
| 4122 friend class TypedDataView; | 4085 friend class TypedDataView; |
| 4123 friend class DeferredObject; | 4086 friend class DeferredObject; |
| 4124 }; | 4087 }; |
| 4125 | 4088 |
| 4126 | 4089 |
| 4090 class LibraryPrefix : public Instance { |
| 4091 public: |
| 4092 RawString* name() const { return raw_ptr()->name_; } |
| 4093 virtual RawString* DictionaryName() const { return name(); } |
| 4094 |
| 4095 RawArray* imports() const { return raw_ptr()->imports_; } |
| 4096 intptr_t num_imports() const { return raw_ptr()->num_imports_; } |
| 4097 |
| 4098 bool ContainsLibrary(const Library& library) const; |
| 4099 RawLibrary* GetLibrary(int index) const; |
| 4100 void AddImport(const Namespace& import) const; |
| 4101 RawObject* LookupObject(const String& name) const; |
| 4102 RawClass* LookupClass(const String& class_name) const; |
| 4103 |
| 4104 bool is_deferred_load() const { return raw_ptr()->is_deferred_load_; } |
| 4105 bool is_loaded() const { return raw_ptr()->is_loaded_; } |
| 4106 void LoadLibrary() const; |
| 4107 |
| 4108 // Return the list of code objects that were compiled when this |
| 4109 // prefix was not yet loaded. These code objects will be invalidated |
| 4110 // when the prefix is loaded. |
| 4111 RawArray* dependent_code() const; |
| 4112 void set_dependent_code(const Array& array) const; |
| 4113 |
| 4114 // Add the given code object to the list of dependent ones. |
| 4115 void RegisterDependentCode(const Code& code) const; |
| 4116 void InvalidateDependentCode() const; |
| 4117 |
| 4118 static intptr_t InstanceSize() { |
| 4119 return RoundedAllocationSize(sizeof(RawLibraryPrefix)); |
| 4120 } |
| 4121 |
| 4122 static RawLibraryPrefix* New(const String& name, |
| 4123 const Namespace& import, |
| 4124 bool deferred_load); |
| 4125 |
| 4126 private: |
| 4127 static const int kInitialSize = 2; |
| 4128 static const int kIncrementSize = 2; |
| 4129 |
| 4130 void set_name(const String& value) const; |
| 4131 void set_imports(const Array& value) const; |
| 4132 void set_num_imports(intptr_t value) const; |
| 4133 void set_is_loaded() const; |
| 4134 |
| 4135 static RawLibraryPrefix* New(); |
| 4136 |
| 4137 FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Instance); |
| 4138 friend class Class; |
| 4139 }; |
| 4140 |
| 4141 |
| 4127 // AbstractType is an abstract superclass. | 4142 // AbstractType is an abstract superclass. |
| 4128 // Subclasses of AbstractType are Type and TypeParameter. | 4143 // Subclasses of AbstractType are Type and TypeParameter. |
| 4129 class AbstractType : public Instance { | 4144 class AbstractType : public Instance { |
| 4130 public: | 4145 public: |
| 4131 virtual bool IsFinalized() const; | 4146 virtual bool IsFinalized() const; |
| 4132 virtual bool IsBeingFinalized() const; | 4147 virtual bool IsBeingFinalized() const; |
| 4133 virtual bool IsMalformed() const; | 4148 virtual bool IsMalformed() const; |
| 4134 virtual bool IsMalbounded() const; | 4149 virtual bool IsMalbounded() const; |
| 4135 virtual bool IsMalformedOrMalbounded() const; | 4150 virtual bool IsMalformedOrMalbounded() const; |
| 4136 virtual RawLanguageError* error() const; | 4151 virtual RawLanguageError* error() const; |
| (...skipping 2642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6779 | 6794 |
| 6780 | 6795 |
| 6781 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6796 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6782 intptr_t index) { | 6797 intptr_t index) { |
| 6783 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6798 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6784 } | 6799 } |
| 6785 | 6800 |
| 6786 } // namespace dart | 6801 } // namespace dart |
| 6787 | 6802 |
| 6788 #endif // VM_OBJECT_H_ | 6803 #endif // VM_OBJECT_H_ |
| OLD | NEW |