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_RAW_OBJECT_H_ | 5 #ifndef VM_RAW_OBJECT_H_ |
6 #define VM_RAW_OBJECT_H_ | 6 #define VM_RAW_OBJECT_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 #include "vm/token.h" | 10 #include "vm/token.h" |
11 #include "vm/snapshot.h" | 11 #include "vm/snapshot.h" |
12 | 12 |
13 namespace dart { | 13 namespace dart { |
14 | 14 |
15 // Macrobatics to define the Object hierarchy of VM implementation classes. | 15 // Macrobatics to define the Object hierarchy of VM implementation classes. |
16 #define CLASS_LIST_NO_OBJECT_NOR_STRING_NOR_ARRAY(V) \ | 16 #define CLASS_LIST_NO_OBJECT_NOR_STRING_NOR_ARRAY(V) \ |
17 V(Class) \ | 17 V(Class) \ |
18 V(UnresolvedClass) \ | 18 V(UnresolvedClass) \ |
19 V(TypeArguments) \ | 19 V(TypeArguments) \ |
20 V(PatchClass) \ | 20 V(PatchClass) \ |
21 V(Function) \ | 21 V(Function) \ |
22 V(ClosureData) \ | 22 V(ClosureData) \ |
23 V(RedirectionData) \ | 23 V(RedirectionData) \ |
24 V(Field) \ | 24 V(Field) \ |
25 V(LiteralToken) \ | 25 V(LiteralToken) \ |
26 V(TokenStream) \ | 26 V(TokenStream) \ |
27 V(Script) \ | 27 V(Script) \ |
28 V(Library) \ | 28 V(Library) \ |
29 V(LibraryPrefix) \ | |
30 V(Namespace) \ | 29 V(Namespace) \ |
31 V(Code) \ | 30 V(Code) \ |
32 V(Instructions) \ | 31 V(Instructions) \ |
33 V(PcDescriptors) \ | 32 V(PcDescriptors) \ |
34 V(Stackmap) \ | 33 V(Stackmap) \ |
35 V(LocalVarDescriptors) \ | 34 V(LocalVarDescriptors) \ |
36 V(ExceptionHandlers) \ | 35 V(ExceptionHandlers) \ |
37 V(DeoptInfo) \ | 36 V(DeoptInfo) \ |
38 V(Context) \ | 37 V(Context) \ |
39 V(ContextScope) \ | 38 V(ContextScope) \ |
40 V(ICData) \ | 39 V(ICData) \ |
41 V(MegamorphicCache) \ | 40 V(MegamorphicCache) \ |
42 V(SubtypeTestCache) \ | 41 V(SubtypeTestCache) \ |
43 V(Error) \ | 42 V(Error) \ |
44 V(ApiError) \ | 43 V(ApiError) \ |
45 V(LanguageError) \ | 44 V(LanguageError) \ |
46 V(UnhandledException) \ | 45 V(UnhandledException) \ |
47 V(UnwindError) \ | 46 V(UnwindError) \ |
48 V(Instance) \ | 47 V(Instance) \ |
| 48 V(LibraryPrefix) \ |
49 V(AbstractType) \ | 49 V(AbstractType) \ |
50 V(Type) \ | 50 V(Type) \ |
51 V(TypeRef) \ | 51 V(TypeRef) \ |
52 V(TypeParameter) \ | 52 V(TypeParameter) \ |
53 V(BoundedType) \ | 53 V(BoundedType) \ |
54 V(MixinAppType) \ | 54 V(MixinAppType) \ |
55 V(Number) \ | 55 V(Number) \ |
56 V(Integer) \ | 56 V(Integer) \ |
57 V(Smi) \ | 57 V(Smi) \ |
58 V(Mint) \ | 58 V(Mint) \ |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 intptr_t num_anonymous_; // Number of entries in anonymous_classes_. | 775 intptr_t num_anonymous_; // Number of entries in anonymous_classes_. |
776 Dart_NativeEntryResolver native_entry_resolver_; // Resolves natives. | 776 Dart_NativeEntryResolver native_entry_resolver_; // Resolves natives. |
777 bool corelib_imported_; | 777 bool corelib_imported_; |
778 bool debuggable_; // True if debugger can stop in library. | 778 bool debuggable_; // True if debugger can stop in library. |
779 int8_t load_state_; // Of type LibraryState. | 779 int8_t load_state_; // Of type LibraryState. |
780 | 780 |
781 friend class Isolate; | 781 friend class Isolate; |
782 }; | 782 }; |
783 | 783 |
784 | 784 |
785 class RawLibraryPrefix : public RawObject { | |
786 RAW_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix); | |
787 | |
788 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | |
789 RawString* name_; // library prefix name. | |
790 RawArray* imports_; // libraries imported with this prefix. | |
791 RawObject** to() { | |
792 return reinterpret_cast<RawObject**>(&ptr()->imports_); | |
793 } | |
794 intptr_t num_imports_; // Number of library entries in libraries_. | |
795 }; | |
796 | |
797 | |
798 class RawNamespace : public RawObject { | 785 class RawNamespace : public RawObject { |
799 RAW_HEAP_OBJECT_IMPLEMENTATION(Namespace); | 786 RAW_HEAP_OBJECT_IMPLEMENTATION(Namespace); |
800 | 787 |
801 RawObject** from() { | 788 RawObject** from() { |
802 return reinterpret_cast<RawObject**>(&ptr()->library_); | 789 return reinterpret_cast<RawObject**>(&ptr()->library_); |
803 } | 790 } |
804 RawLibrary* library_; // library with name dictionary. | 791 RawLibrary* library_; // library with name dictionary. |
805 RawArray* show_names_; // list of names that are exported. | 792 RawArray* show_names_; // list of names that are exported. |
806 RawArray* hide_names_; // blacklist of names that are not exported. | 793 RawArray* hide_names_; // blacklist of names that are not exported. |
807 RawField* metadata_field_; // remembers the token pos of metadata if any, | 794 RawField* metadata_field_; // remembers the token pos of metadata if any, |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 return reinterpret_cast<RawObject**>(&ptr()->message_); | 1116 return reinterpret_cast<RawObject**>(&ptr()->message_); |
1130 } | 1117 } |
1131 }; | 1118 }; |
1132 | 1119 |
1133 | 1120 |
1134 class RawInstance : public RawObject { | 1121 class RawInstance : public RawObject { |
1135 RAW_HEAP_OBJECT_IMPLEMENTATION(Instance); | 1122 RAW_HEAP_OBJECT_IMPLEMENTATION(Instance); |
1136 }; | 1123 }; |
1137 | 1124 |
1138 | 1125 |
| 1126 class RawLibraryPrefix : public RawInstance { |
| 1127 RAW_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix); |
| 1128 |
| 1129 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
| 1130 RawString* name_; // Library prefix name. |
| 1131 RawArray* imports_; // Libraries imported with this prefix. |
| 1132 RawArray* dependent_code_; // Code that refers to deferred, unloaded |
| 1133 // library prefix. |
| 1134 RawObject** to() { |
| 1135 return reinterpret_cast<RawObject**>(&ptr()->dependent_code_); |
| 1136 } |
| 1137 intptr_t num_imports_; // Number of library entries in libraries_. |
| 1138 bool is_deferred_load_; |
| 1139 bool is_loaded_; |
| 1140 }; |
| 1141 |
| 1142 |
1139 class RawAbstractType : public RawInstance { | 1143 class RawAbstractType : public RawInstance { |
1140 protected: | 1144 protected: |
1141 enum TypeState { | 1145 enum TypeState { |
1142 kAllocated, // Initial state. | 1146 kAllocated, // Initial state. |
1143 kResolved, // Type class and type arguments resolved. | 1147 kResolved, // Type class and type arguments resolved. |
1144 kBeingFinalized, // In the process of being finalized. | 1148 kBeingFinalized, // In the process of being finalized. |
1145 kFinalizedInstantiated, // Instantiated type ready for use. | 1149 kFinalizedInstantiated, // Instantiated type ready for use. |
1146 kFinalizedUninstantiated, // Uninstantiated type ready for use. | 1150 kFinalizedUninstantiated, // Uninstantiated type ready for use. |
1147 }; | 1151 }; |
1148 | 1152 |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1778 // Make sure this is updated when new TypedData types are added. | 1782 // Make sure this is updated when new TypedData types are added. |
1779 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); | 1783 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); |
1780 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 15); | 1784 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 15); |
1781 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 14); | 1785 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 14); |
1782 return (kNullCid - kTypedDataInt8ArrayCid); | 1786 return (kNullCid - kTypedDataInt8ArrayCid); |
1783 } | 1787 } |
1784 | 1788 |
1785 } // namespace dart | 1789 } // namespace dart |
1786 | 1790 |
1787 #endif // VM_RAW_OBJECT_H_ | 1791 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |