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 2088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2700 | 2698 |
2701 friend class Bootstrap; | 2699 friend class Bootstrap; |
2702 friend class Class; | 2700 friend class Class; |
2703 friend class Debugger; | 2701 friend class Debugger; |
2704 friend class DictionaryIterator; | 2702 friend class DictionaryIterator; |
2705 friend class Namespace; | 2703 friend class Namespace; |
2706 friend class Object; | 2704 friend class Object; |
2707 }; | 2705 }; |
2708 | 2706 |
2709 | 2707 |
2710 class LibraryPrefix : public Object { | |
2711 public: | |
2712 RawString* name() const { return raw_ptr()->name_; } | |
2713 virtual RawString* DictionaryName() const { return name(); } | |
2714 | |
2715 RawArray* imports() const { return raw_ptr()->imports_; } | |
2716 intptr_t num_imports() const { return raw_ptr()->num_imports_; } | |
2717 | |
2718 bool ContainsLibrary(const Library& library) const; | |
2719 RawLibrary* GetLibrary(int index) const; | |
2720 void AddImport(const Namespace& import) const; | |
2721 RawObject* LookupObject(const String& name) const; | |
2722 RawClass* LookupClass(const String& class_name) const; | |
2723 | |
2724 static intptr_t InstanceSize() { | |
2725 return RoundedAllocationSize(sizeof(RawLibraryPrefix)); | |
2726 } | |
2727 | |
2728 static RawLibraryPrefix* New(const String& name, const Namespace& import); | |
2729 | |
2730 private: | |
2731 static const int kInitialSize = 2; | |
2732 static const int kIncrementSize = 2; | |
2733 | |
2734 void set_name(const String& value) const; | |
2735 void set_imports(const Array& value) const; | |
2736 void set_num_imports(intptr_t value) const; | |
2737 | |
2738 static RawLibraryPrefix* New(); | |
2739 | |
2740 FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Object); | |
2741 friend class Class; | |
2742 }; | |
2743 | |
2744 | |
2745 // A Namespace contains the names in a library dictionary, filtered by | 2708 // A Namespace contains the names in a library dictionary, filtered by |
2746 // the show/hide combinators. | 2709 // the show/hide combinators. |
2747 class Namespace : public Object { | 2710 class Namespace : public Object { |
2748 public: | 2711 public: |
2749 RawLibrary* library() const { return raw_ptr()->library_; } | 2712 RawLibrary* library() const { return raw_ptr()->library_; } |
2750 RawArray* show_names() const { return raw_ptr()->show_names_; } | 2713 RawArray* show_names() const { return raw_ptr()->show_names_; } |
2751 RawArray* hide_names() const { return raw_ptr()->hide_names_; } | 2714 RawArray* hide_names() const { return raw_ptr()->hide_names_; } |
2752 | 2715 |
2753 void AddMetadata(intptr_t token_pos, const Class& owner_class); | 2716 void AddMetadata(intptr_t token_pos, const Class& owner_class); |
2754 RawObject* GetMetadata() const; | 2717 RawObject* GetMetadata() const; |
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4099 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); | 4062 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); |
4100 friend class Class; | 4063 friend class Class; |
4101 friend class Closure; | 4064 friend class Closure; |
4102 friend class SnapshotWriter; | 4065 friend class SnapshotWriter; |
4103 friend class StubCode; | 4066 friend class StubCode; |
4104 friend class TypedDataView; | 4067 friend class TypedDataView; |
4105 friend class DeferredObject; | 4068 friend class DeferredObject; |
4106 }; | 4069 }; |
4107 | 4070 |
4108 | 4071 |
| 4072 class LibraryPrefix : public Instance { |
| 4073 public: |
| 4074 RawString* name() const { return raw_ptr()->name_; } |
| 4075 virtual RawString* DictionaryName() const { return name(); } |
| 4076 |
| 4077 RawArray* imports() const { return raw_ptr()->imports_; } |
| 4078 intptr_t num_imports() const { return raw_ptr()->num_imports_; } |
| 4079 |
| 4080 bool ContainsLibrary(const Library& library) const; |
| 4081 RawLibrary* GetLibrary(int index) const; |
| 4082 void AddImport(const Namespace& import) const; |
| 4083 RawObject* LookupObject(const String& name) const; |
| 4084 RawClass* LookupClass(const String& class_name) const; |
| 4085 |
| 4086 bool is_deferred_load() const { return raw_ptr()->is_deferred_load_; } |
| 4087 bool is_loaded() const { return raw_ptr()->is_loaded_; } |
| 4088 void LoadLibrary() const; |
| 4089 |
| 4090 // Return the list of code objects that were compiled when this |
| 4091 // prefix was not yet loaded. These code objects will be invalidated |
| 4092 // when the prefix is loaded. |
| 4093 RawArray* dependent_code() const; |
| 4094 void set_dependent_code(const Array& array) const; |
| 4095 |
| 4096 // Add the given code object to the list of dependent ones. |
| 4097 void RegisterDependentCode(const Code& code) const; |
| 4098 void InvalidateDependentCode() const; |
| 4099 |
| 4100 static intptr_t InstanceSize() { |
| 4101 return RoundedAllocationSize(sizeof(RawLibraryPrefix)); |
| 4102 } |
| 4103 |
| 4104 static RawLibraryPrefix* New(const String& name, |
| 4105 const Namespace& import, |
| 4106 bool deferred_load); |
| 4107 |
| 4108 private: |
| 4109 static const int kInitialSize = 2; |
| 4110 static const int kIncrementSize = 2; |
| 4111 |
| 4112 void set_name(const String& value) const; |
| 4113 void set_imports(const Array& value) const; |
| 4114 void set_num_imports(intptr_t value) const; |
| 4115 void set_is_loaded() const; |
| 4116 |
| 4117 static RawLibraryPrefix* New(); |
| 4118 |
| 4119 FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Instance); |
| 4120 friend class Class; |
| 4121 }; |
| 4122 |
| 4123 |
4109 // AbstractType is an abstract superclass. | 4124 // AbstractType is an abstract superclass. |
4110 // Subclasses of AbstractType are Type and TypeParameter. | 4125 // Subclasses of AbstractType are Type and TypeParameter. |
4111 class AbstractType : public Instance { | 4126 class AbstractType : public Instance { |
4112 public: | 4127 public: |
4113 virtual bool IsFinalized() const; | 4128 virtual bool IsFinalized() const; |
4114 virtual bool IsBeingFinalized() const; | 4129 virtual bool IsBeingFinalized() const; |
4115 virtual bool IsMalformed() const; | 4130 virtual bool IsMalformed() const; |
4116 virtual bool IsMalbounded() const; | 4131 virtual bool IsMalbounded() const; |
4117 virtual bool IsMalformedOrMalbounded() const; | 4132 virtual bool IsMalformedOrMalbounded() const; |
4118 virtual RawLanguageError* error() const; | 4133 virtual RawLanguageError* error() const; |
(...skipping 2637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6756 | 6771 |
6757 | 6772 |
6758 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6773 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6759 intptr_t index) { | 6774 intptr_t index) { |
6760 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6775 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6761 } | 6776 } |
6762 | 6777 |
6763 } // namespace dart | 6778 } // namespace dart |
6764 | 6779 |
6765 #endif // VM_OBJECT_H_ | 6780 #endif // VM_OBJECT_H_ |
OLD | NEW |