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 RUNTIME_VM_RAW_OBJECT_H_ | 5 #ifndef RUNTIME_VM_RAW_OBJECT_H_ |
6 #define RUNTIME_VM_RAW_OBJECT_H_ | 6 #define RUNTIME_VM_RAW_OBJECT_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/atomic.h" | 9 #include "vm/atomic.h" |
10 #include "vm/exceptions.h" | 10 #include "vm/exceptions.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 #define CLASS_LIST_NO_OBJECT(V) \ | 134 #define CLASS_LIST_NO_OBJECT(V) \ |
135 CLASS_LIST_NO_OBJECT_NOR_STRING_NOR_ARRAY(V) \ | 135 CLASS_LIST_NO_OBJECT_NOR_STRING_NOR_ARRAY(V) \ |
136 CLASS_LIST_ARRAYS(V) \ | 136 CLASS_LIST_ARRAYS(V) \ |
137 CLASS_LIST_STRINGS(V) | 137 CLASS_LIST_STRINGS(V) |
138 | 138 |
139 #define CLASS_LIST(V) \ | 139 #define CLASS_LIST(V) \ |
140 V(Object) \ | 140 V(Object) \ |
141 CLASS_LIST_NO_OBJECT(V) | 141 CLASS_LIST_NO_OBJECT(V) |
142 | 142 |
143 | |
144 // Forward declarations. | 143 // Forward declarations. |
145 class Isolate; | 144 class Isolate; |
146 #define DEFINE_FORWARD_DECLARATION(clazz) class Raw##clazz; | 145 #define DEFINE_FORWARD_DECLARATION(clazz) class Raw##clazz; |
147 CLASS_LIST(DEFINE_FORWARD_DECLARATION) | 146 CLASS_LIST(DEFINE_FORWARD_DECLARATION) |
148 #undef DEFINE_FORWARD_DECLARATION | 147 #undef DEFINE_FORWARD_DECLARATION |
149 | 148 |
150 | |
151 enum ClassId { | 149 enum ClassId { |
152 // Illegal class id. | 150 // Illegal class id. |
153 kIllegalCid = 0, | 151 kIllegalCid = 0, |
154 | 152 |
155 // A sentinel used by the vm service's heap snapshots to represent references | 153 // A sentinel used by the vm service's heap snapshots to represent references |
156 // from the stack. | 154 // from the stack. |
157 kStackCid = 1, | 155 kStackCid = 1, |
158 | 156 |
159 // The following entries describes classes for pseudo-objects in the heap | 157 // The following entries describes classes for pseudo-objects in the heap |
160 // that should never be reachable from live objects. Free list elements | 158 // that should never be reachable from live objects. Free list elements |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 friend class Simulator; | 685 friend class Simulator; |
688 friend class SimulatorHelpers; | 686 friend class SimulatorHelpers; |
689 friend class ObjectLocator; | 687 friend class ObjectLocator; |
690 friend class InstanceMorpher; // GetClassId | 688 friend class InstanceMorpher; // GetClassId |
691 friend class VerifyCanonicalVisitor; | 689 friend class VerifyCanonicalVisitor; |
692 | 690 |
693 DISALLOW_ALLOCATION(); | 691 DISALLOW_ALLOCATION(); |
694 DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject); | 692 DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject); |
695 }; | 693 }; |
696 | 694 |
697 | |
698 class RawClass : public RawObject { | 695 class RawClass : public RawObject { |
699 public: | 696 public: |
700 enum ClassFinalizedState { | 697 enum ClassFinalizedState { |
701 kAllocated = 0, // Initial state. | 698 kAllocated = 0, // Initial state. |
702 kPreFinalized, // VM classes: size precomputed, but no checks done. | 699 kPreFinalized, // VM classes: size precomputed, but no checks done. |
703 kFinalized, // Class parsed, finalized and ready for use. | 700 kFinalized, // Class parsed, finalized and ready for use. |
704 kRefinalizeAfterPatch, // Class needs to be refinalized (patched). | 701 kRefinalizeAfterPatch, // Class needs to be refinalized (patched). |
705 }; | 702 }; |
706 | 703 |
707 private: | 704 private: |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 friend class Isolate; | 758 friend class Isolate; |
762 friend class Object; | 759 friend class Object; |
763 friend class RawInstance; | 760 friend class RawInstance; |
764 friend class RawInstructions; | 761 friend class RawInstructions; |
765 friend class RawTypeArguments; | 762 friend class RawTypeArguments; |
766 friend class SnapshotReader; | 763 friend class SnapshotReader; |
767 friend class InstanceSerializationCluster; | 764 friend class InstanceSerializationCluster; |
768 friend class CidRewriteVisitor; | 765 friend class CidRewriteVisitor; |
769 }; | 766 }; |
770 | 767 |
771 | |
772 class RawUnresolvedClass : public RawObject { | 768 class RawUnresolvedClass : public RawObject { |
773 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); | 769 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); |
774 | 770 |
775 RawObject** from() { | 771 RawObject** from() { |
776 return reinterpret_cast<RawObject**>(&ptr()->library_or_library_prefix_); | 772 return reinterpret_cast<RawObject**>(&ptr()->library_or_library_prefix_); |
777 } | 773 } |
778 RawObject* library_or_library_prefix_; // Library or library prefix qualifier | 774 RawObject* library_or_library_prefix_; // Library or library prefix qualifier |
779 // for the ident. | 775 // for the ident. |
780 RawString* ident_; // Name of the unresolved identifier. | 776 RawString* ident_; // Name of the unresolved identifier. |
781 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->ident_); } | 777 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->ident_); } |
782 TokenPosition token_pos_; | 778 TokenPosition token_pos_; |
783 }; | 779 }; |
784 | 780 |
785 | |
786 class RawTypeArguments : public RawObject { | 781 class RawTypeArguments : public RawObject { |
787 private: | 782 private: |
788 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeArguments); | 783 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeArguments); |
789 | 784 |
790 RawObject** from() { | 785 RawObject** from() { |
791 return reinterpret_cast<RawObject**>(&ptr()->instantiations_); | 786 return reinterpret_cast<RawObject**>(&ptr()->instantiations_); |
792 } | 787 } |
793 // The instantiations_ array remains empty for instantiated type arguments. | 788 // The instantiations_ array remains empty for instantiated type arguments. |
794 RawArray* instantiations_; // Array of paired canonical vectors: | 789 RawArray* instantiations_; // Array of paired canonical vectors: |
795 // Even index: instantiator. | 790 // Even index: instantiator. |
(...skipping 11 matching lines...) Expand all Loading... |
807 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*); | 802 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*); |
808 } | 803 } |
809 RawObject** to(intptr_t length) { | 804 RawObject** to(intptr_t length) { |
810 return reinterpret_cast<RawObject**>(&ptr()->types()[length - 1]); | 805 return reinterpret_cast<RawObject**>(&ptr()->types()[length - 1]); |
811 } | 806 } |
812 | 807 |
813 friend class Object; | 808 friend class Object; |
814 friend class SnapshotReader; | 809 friend class SnapshotReader; |
815 }; | 810 }; |
816 | 811 |
817 | |
818 class RawPatchClass : public RawObject { | 812 class RawPatchClass : public RawObject { |
819 private: | 813 private: |
820 RAW_HEAP_OBJECT_IMPLEMENTATION(PatchClass); | 814 RAW_HEAP_OBJECT_IMPLEMENTATION(PatchClass); |
821 | 815 |
822 RawObject** from() { | 816 RawObject** from() { |
823 return reinterpret_cast<RawObject**>(&ptr()->patched_class_); | 817 return reinterpret_cast<RawObject**>(&ptr()->patched_class_); |
824 } | 818 } |
825 RawClass* patched_class_; | 819 RawClass* patched_class_; |
826 RawClass* origin_class_; | 820 RawClass* origin_class_; |
827 RawScript* script_; | 821 RawScript* script_; |
828 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->script_); } | 822 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->script_); } |
829 | 823 |
830 friend class Function; | 824 friend class Function; |
831 }; | 825 }; |
832 | 826 |
833 | |
834 class RawFunction : public RawObject { | 827 class RawFunction : public RawObject { |
835 public: | 828 public: |
836 enum Kind { | 829 enum Kind { |
837 kRegularFunction, | 830 kRegularFunction, |
838 kClosureFunction, | 831 kClosureFunction, |
839 kSignatureFunction, // represents a signature only without actual code. | 832 kSignatureFunction, // represents a signature only without actual code. |
840 kGetterFunction, // represents getter functions e.g: get foo() { .. }. | 833 kGetterFunction, // represents getter functions e.g: get foo() { .. }. |
841 kSetterFunction, // represents setter functions e.g: set foo(..) { .. }. | 834 kSetterFunction, // represents setter functions e.g: set foo(..) { .. }. |
842 kConstructor, | 835 kConstructor, |
843 kImplicitGetter, // represents an implicit getter for fields. | 836 kImplicitGetter, // represents an implicit getter for fields. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 uint32_t kind_tag_; // See Function::KindTagBits. | 898 uint32_t kind_tag_; // See Function::KindTagBits. |
906 int16_t num_fixed_parameters_; | 899 int16_t num_fixed_parameters_; |
907 int16_t num_optional_parameters_; // > 0: positional; < 0: named. | 900 int16_t num_optional_parameters_; // > 0: positional; < 0: named. |
908 NOT_IN_PRECOMPILED(intptr_t kernel_offset_); | 901 NOT_IN_PRECOMPILED(intptr_t kernel_offset_); |
909 NOT_IN_PRECOMPILED(uint16_t optimized_instruction_count_); | 902 NOT_IN_PRECOMPILED(uint16_t optimized_instruction_count_); |
910 NOT_IN_PRECOMPILED(uint16_t optimized_call_site_count_); | 903 NOT_IN_PRECOMPILED(uint16_t optimized_call_site_count_); |
911 NOT_IN_PRECOMPILED(int8_t deoptimization_counter_); | 904 NOT_IN_PRECOMPILED(int8_t deoptimization_counter_); |
912 NOT_IN_PRECOMPILED(int8_t was_compiled_); | 905 NOT_IN_PRECOMPILED(int8_t was_compiled_); |
913 }; | 906 }; |
914 | 907 |
915 | |
916 class RawClosureData : public RawObject { | 908 class RawClosureData : public RawObject { |
917 private: | 909 private: |
918 RAW_HEAP_OBJECT_IMPLEMENTATION(ClosureData); | 910 RAW_HEAP_OBJECT_IMPLEMENTATION(ClosureData); |
919 | 911 |
920 RawObject** from() { | 912 RawObject** from() { |
921 return reinterpret_cast<RawObject**>(&ptr()->context_scope_); | 913 return reinterpret_cast<RawObject**>(&ptr()->context_scope_); |
922 } | 914 } |
923 RawContextScope* context_scope_; | 915 RawContextScope* context_scope_; |
924 RawFunction* parent_function_; // Enclosing function of this local function. | 916 RawFunction* parent_function_; // Enclosing function of this local function. |
925 RawType* signature_type_; | 917 RawType* signature_type_; |
926 RawInstance* closure_; // Closure object for static implicit closures. | 918 RawInstance* closure_; // Closure object for static implicit closures. |
927 RawObject** to_snapshot() { | 919 RawObject** to_snapshot() { |
928 return reinterpret_cast<RawObject**>(&ptr()->closure_); | 920 return reinterpret_cast<RawObject**>(&ptr()->closure_); |
929 } | 921 } |
930 RawObject* hash_; | 922 RawObject* hash_; |
931 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); } | 923 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); } |
932 | 924 |
933 friend class Function; | 925 friend class Function; |
934 }; | 926 }; |
935 | 927 |
936 | |
937 class RawSignatureData : public RawObject { | 928 class RawSignatureData : public RawObject { |
938 private: | 929 private: |
939 RAW_HEAP_OBJECT_IMPLEMENTATION(SignatureData); | 930 RAW_HEAP_OBJECT_IMPLEMENTATION(SignatureData); |
940 | 931 |
941 RawObject** from() { | 932 RawObject** from() { |
942 return reinterpret_cast<RawObject**>(&ptr()->parent_function_); | 933 return reinterpret_cast<RawObject**>(&ptr()->parent_function_); |
943 } | 934 } |
944 RawFunction* parent_function_; // Enclosing function of this sig. function. | 935 RawFunction* parent_function_; // Enclosing function of this sig. function. |
945 RawType* signature_type_; | 936 RawType* signature_type_; |
946 RawObject** to() { | 937 RawObject** to() { |
947 return reinterpret_cast<RawObject**>(&ptr()->signature_type_); | 938 return reinterpret_cast<RawObject**>(&ptr()->signature_type_); |
948 } | 939 } |
949 | 940 |
950 friend class Function; | 941 friend class Function; |
951 }; | 942 }; |
952 | 943 |
953 | |
954 class RawRedirectionData : public RawObject { | 944 class RawRedirectionData : public RawObject { |
955 private: | 945 private: |
956 RAW_HEAP_OBJECT_IMPLEMENTATION(RedirectionData); | 946 RAW_HEAP_OBJECT_IMPLEMENTATION(RedirectionData); |
957 | 947 |
958 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->type_); } | 948 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->type_); } |
959 RawType* type_; | 949 RawType* type_; |
960 RawString* identifier_; | 950 RawString* identifier_; |
961 RawFunction* target_; | 951 RawFunction* target_; |
962 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->target_); } | 952 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->target_); } |
963 }; | 953 }; |
964 | 954 |
965 | |
966 class RawField : public RawObject { | 955 class RawField : public RawObject { |
967 RAW_HEAP_OBJECT_IMPLEMENTATION(Field); | 956 RAW_HEAP_OBJECT_IMPLEMENTATION(Field); |
968 | 957 |
969 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | 958 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
970 RawString* name_; | 959 RawString* name_; |
971 RawObject* owner_; // Class or patch class or mixin class | 960 RawObject* owner_; // Class or patch class or mixin class |
972 // where this field is defined or original field. | 961 // where this field is defined or original field. |
973 RawAbstractType* type_; | 962 RawAbstractType* type_; |
974 union { | 963 union { |
975 RawInstance* static_value_; // Value for static fields. | 964 RawInstance* static_value_; // Value for static fields. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 // guarded_cid_. Stored corrected by -kHeapObjectTag to simplify code | 1004 // guarded_cid_. Stored corrected by -kHeapObjectTag to simplify code |
1016 // generated on platforms with weak addressing modes (ARM). | 1005 // generated on platforms with weak addressing modes (ARM). |
1017 int8_t guarded_list_length_in_object_offset_; | 1006 int8_t guarded_list_length_in_object_offset_; |
1018 | 1007 |
1019 uint8_t kind_bits_; // static, final, const, has initializer.... | 1008 uint8_t kind_bits_; // static, final, const, has initializer.... |
1020 NOT_IN_PRECOMPILED(intptr_t kernel_offset_); | 1009 NOT_IN_PRECOMPILED(intptr_t kernel_offset_); |
1021 | 1010 |
1022 friend class CidRewriteVisitor; | 1011 friend class CidRewriteVisitor; |
1023 }; | 1012 }; |
1024 | 1013 |
1025 | |
1026 class RawLiteralToken : public RawObject { | 1014 class RawLiteralToken : public RawObject { |
1027 RAW_HEAP_OBJECT_IMPLEMENTATION(LiteralToken); | 1015 RAW_HEAP_OBJECT_IMPLEMENTATION(LiteralToken); |
1028 | 1016 |
1029 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->literal_); } | 1017 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->literal_); } |
1030 RawString* literal_; // Literal characters as they appear in source text. | 1018 RawString* literal_; // Literal characters as they appear in source text. |
1031 RawObject* value_; // The actual object corresponding to the token. | 1019 RawObject* value_; // The actual object corresponding to the token. |
1032 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); } | 1020 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); } |
1033 Token::Kind kind_; // The literal kind (string, integer, double). | 1021 Token::Kind kind_; // The literal kind (string, integer, double). |
1034 | 1022 |
1035 friend class SnapshotReader; | 1023 friend class SnapshotReader; |
1036 }; | 1024 }; |
1037 | 1025 |
1038 | |
1039 class RawTokenStream : public RawObject { | 1026 class RawTokenStream : public RawObject { |
1040 RAW_HEAP_OBJECT_IMPLEMENTATION(TokenStream); | 1027 RAW_HEAP_OBJECT_IMPLEMENTATION(TokenStream); |
1041 | 1028 |
1042 RawObject** from() { | 1029 RawObject** from() { |
1043 return reinterpret_cast<RawObject**>(&ptr()->private_key_); | 1030 return reinterpret_cast<RawObject**>(&ptr()->private_key_); |
1044 } | 1031 } |
1045 RawString* private_key_; // Key used for private identifiers. | 1032 RawString* private_key_; // Key used for private identifiers. |
1046 RawGrowableObjectArray* token_objects_; | 1033 RawGrowableObjectArray* token_objects_; |
1047 RawExternalTypedData* stream_; | 1034 RawExternalTypedData* stream_; |
1048 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->stream_); } | 1035 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->stream_); } |
1049 | 1036 |
1050 friend class SnapshotReader; | 1037 friend class SnapshotReader; |
1051 }; | 1038 }; |
1052 | 1039 |
1053 | |
1054 class RawScript : public RawObject { | 1040 class RawScript : public RawObject { |
1055 public: | 1041 public: |
1056 enum Kind { | 1042 enum Kind { |
1057 kScriptTag = 0, | 1043 kScriptTag = 0, |
1058 kLibraryTag, | 1044 kLibraryTag, |
1059 kSourceTag, | 1045 kSourceTag, |
1060 kPatchTag, | 1046 kPatchTag, |
1061 kEvaluateTag, | 1047 kEvaluateTag, |
1062 kKernelTag, | 1048 kKernelTag, |
1063 }; | 1049 }; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 | 1083 |
1098 int32_t line_offset_; | 1084 int32_t line_offset_; |
1099 int32_t col_offset_; | 1085 int32_t col_offset_; |
1100 int8_t kind_; // Of type Kind. | 1086 int8_t kind_; // Of type Kind. |
1101 int64_t load_timestamp_; | 1087 int64_t load_timestamp_; |
1102 const uint8_t* kernel_data_; | 1088 const uint8_t* kernel_data_; |
1103 intptr_t kernel_data_size_; | 1089 intptr_t kernel_data_size_; |
1104 intptr_t kernel_script_index_; | 1090 intptr_t kernel_script_index_; |
1105 }; | 1091 }; |
1106 | 1092 |
1107 | |
1108 class RawLibrary : public RawObject { | 1093 class RawLibrary : public RawObject { |
1109 enum LibraryState { | 1094 enum LibraryState { |
1110 kAllocated, // Initial state. | 1095 kAllocated, // Initial state. |
1111 kLoadRequested, // Compiler or script requested load of library. | 1096 kLoadRequested, // Compiler or script requested load of library. |
1112 kLoadInProgress, // Library is in the process of being loaded. | 1097 kLoadInProgress, // Library is in the process of being loaded. |
1113 kLoaded, // Library is loaded. | 1098 kLoaded, // Library is loaded. |
1114 kLoadError, // Error occurred during load of the Library. | 1099 kLoadError, // Error occurred during load of the Library. |
1115 }; | 1100 }; |
1116 | 1101 |
1117 RAW_HEAP_OBJECT_IMPLEMENTATION(Library); | 1102 RAW_HEAP_OBJECT_IMPLEMENTATION(Library); |
(...skipping 26 matching lines...) Expand all Loading... |
1144 int8_t load_state_; // Of type LibraryState. | 1129 int8_t load_state_; // Of type LibraryState. |
1145 bool corelib_imported_; | 1130 bool corelib_imported_; |
1146 bool is_dart_scheme_; | 1131 bool is_dart_scheme_; |
1147 bool debuggable_; // True if debugger can stop in library. | 1132 bool debuggable_; // True if debugger can stop in library. |
1148 bool is_in_fullsnapshot_; // True if library is in a full snapshot. | 1133 bool is_in_fullsnapshot_; // True if library is in a full snapshot. |
1149 | 1134 |
1150 friend class Class; | 1135 friend class Class; |
1151 friend class Isolate; | 1136 friend class Isolate; |
1152 }; | 1137 }; |
1153 | 1138 |
1154 | |
1155 class RawNamespace : public RawObject { | 1139 class RawNamespace : public RawObject { |
1156 RAW_HEAP_OBJECT_IMPLEMENTATION(Namespace); | 1140 RAW_HEAP_OBJECT_IMPLEMENTATION(Namespace); |
1157 | 1141 |
1158 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->library_); } | 1142 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->library_); } |
1159 RawLibrary* library_; // library with name dictionary. | 1143 RawLibrary* library_; // library with name dictionary. |
1160 RawArray* show_names_; // list of names that are exported. | 1144 RawArray* show_names_; // list of names that are exported. |
1161 RawArray* hide_names_; // blacklist of names that are not exported. | 1145 RawArray* hide_names_; // blacklist of names that are not exported. |
1162 RawField* metadata_field_; // remembers the token pos of metadata if any, | 1146 RawField* metadata_field_; // remembers the token pos of metadata if any, |
1163 // and the metadata values if computed. | 1147 // and the metadata values if computed. |
1164 RawObject** to() { | 1148 RawObject** to() { |
1165 return reinterpret_cast<RawObject**>(&ptr()->metadata_field_); | 1149 return reinterpret_cast<RawObject**>(&ptr()->metadata_field_); |
1166 } | 1150 } |
1167 }; | 1151 }; |
1168 | 1152 |
1169 | |
1170 class RawCode : public RawObject { | 1153 class RawCode : public RawObject { |
1171 RAW_HEAP_OBJECT_IMPLEMENTATION(Code); | 1154 RAW_HEAP_OBJECT_IMPLEMENTATION(Code); |
1172 | 1155 |
1173 uword entry_point_; // Accessed from generated code. | 1156 uword entry_point_; // Accessed from generated code. |
1174 uword checked_entry_point_; // Accessed from generated code (AOT only). | 1157 uword checked_entry_point_; // Accessed from generated code (AOT only). |
1175 | 1158 |
1176 RawObject** from() { | 1159 RawObject** from() { |
1177 return reinterpret_cast<RawObject**>(&ptr()->object_pool_); | 1160 return reinterpret_cast<RawObject**>(&ptr()->object_pool_); |
1178 } | 1161 } |
1179 RawObjectPool* object_pool_; // Accessed from generated code. | 1162 RawObjectPool* object_pool_; // Accessed from generated code. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 | 1209 |
1227 friend class Function; | 1210 friend class Function; |
1228 template <bool> | 1211 template <bool> |
1229 friend class MarkingVisitorBase; | 1212 friend class MarkingVisitorBase; |
1230 friend class SkippedCodeFunctions; | 1213 friend class SkippedCodeFunctions; |
1231 friend class StackFrame; | 1214 friend class StackFrame; |
1232 friend class Profiler; | 1215 friend class Profiler; |
1233 friend class FunctionDeserializationCluster; | 1216 friend class FunctionDeserializationCluster; |
1234 }; | 1217 }; |
1235 | 1218 |
1236 | |
1237 class RawObjectPool : public RawObject { | 1219 class RawObjectPool : public RawObject { |
1238 RAW_HEAP_OBJECT_IMPLEMENTATION(ObjectPool); | 1220 RAW_HEAP_OBJECT_IMPLEMENTATION(ObjectPool); |
1239 | 1221 |
1240 intptr_t length_; | 1222 intptr_t length_; |
1241 RawTypedData* info_array_; | 1223 RawTypedData* info_array_; |
1242 | 1224 |
1243 struct Entry { | 1225 struct Entry { |
1244 union { | 1226 union { |
1245 RawObject* raw_obj_; | 1227 RawObject* raw_obj_; |
1246 uword raw_value_; | 1228 uword raw_value_; |
1247 }; | 1229 }; |
1248 }; | 1230 }; |
1249 Entry* data() { OPEN_ARRAY_START(Entry, Entry); } | 1231 Entry* data() { OPEN_ARRAY_START(Entry, Entry); } |
1250 Entry const* data() const { OPEN_ARRAY_START(Entry, Entry); } | 1232 Entry const* data() const { OPEN_ARRAY_START(Entry, Entry); } |
1251 | 1233 |
1252 Entry* first_entry() { return &ptr()->data()[0]; } | 1234 Entry* first_entry() { return &ptr()->data()[0]; } |
1253 | 1235 |
1254 friend class Object; | 1236 friend class Object; |
1255 }; | 1237 }; |
1256 | 1238 |
1257 | |
1258 class RawInstructions : public RawObject { | 1239 class RawInstructions : public RawObject { |
1259 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions); | 1240 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions); |
1260 | 1241 |
1261 // Instructions size in bytes and flags. | 1242 // Instructions size in bytes and flags. |
1262 // Currently, only flag indicates 1 or 2 entry points. | 1243 // Currently, only flag indicates 1 or 2 entry points. |
1263 uint32_t size_and_flags_; | 1244 uint32_t size_and_flags_; |
1264 | 1245 |
1265 // Variable length data follows here. | 1246 // Variable length data follows here. |
1266 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } | 1247 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } |
1267 | 1248 |
1268 // Private helper function used while visiting stack frames. The | 1249 // Private helper function used while visiting stack frames. The |
1269 // code which iterates over dart frames is also called during GC and | 1250 // code which iterates over dart frames is also called during GC and |
1270 // is not allowed to create handles. | 1251 // is not allowed to create handles. |
1271 static bool ContainsPC(RawInstructions* raw_instr, uword pc); | 1252 static bool ContainsPC(RawInstructions* raw_instr, uword pc); |
1272 | 1253 |
1273 friend class RawCode; | 1254 friend class RawCode; |
1274 friend class RawFunction; | 1255 friend class RawFunction; |
1275 friend class Code; | 1256 friend class Code; |
1276 friend class StackFrame; | 1257 friend class StackFrame; |
1277 template <bool> | 1258 template <bool> |
1278 friend class MarkingVisitorBase; | 1259 friend class MarkingVisitorBase; |
1279 friend class SkippedCodeFunctions; | 1260 friend class SkippedCodeFunctions; |
1280 friend class Function; | 1261 friend class Function; |
1281 friend class ImageReader; | 1262 friend class ImageReader; |
1282 friend class ImageWriter; | 1263 friend class ImageWriter; |
1283 }; | 1264 }; |
1284 | 1265 |
1285 | |
1286 class RawPcDescriptors : public RawObject { | 1266 class RawPcDescriptors : public RawObject { |
1287 public: | 1267 public: |
1288 enum Kind { | 1268 enum Kind { |
1289 kDeopt = 1, // Deoptimization continuation point. | 1269 kDeopt = 1, // Deoptimization continuation point. |
1290 kIcCall = kDeopt << 1, // IC call. | 1270 kIcCall = kDeopt << 1, // IC call. |
1291 kUnoptStaticCall = kIcCall << 1, // Call to a known target via stub. | 1271 kUnoptStaticCall = kIcCall << 1, // Call to a known target via stub. |
1292 kRuntimeCall = kUnoptStaticCall << 1, // Runtime call. | 1272 kRuntimeCall = kUnoptStaticCall << 1, // Runtime call. |
1293 kOsrEntry = kRuntimeCall << 1, // OSR entry point in unopt. code. | 1273 kOsrEntry = kRuntimeCall << 1, // OSR entry point in unopt. code. |
1294 kRewind = kOsrEntry << 1, // Call rewind target address. | 1274 kRewind = kOsrEntry << 1, // Call rewind target address. |
1295 kOther = kRewind << 1, | 1275 kOther = kRewind << 1, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 // platforms. | 1316 // platforms. |
1337 uword length_; | 1317 uword length_; |
1338 | 1318 |
1339 // Variable length data follows here. | 1319 // Variable length data follows here. |
1340 uint8_t* data() { OPEN_ARRAY_START(uint8_t, intptr_t); } | 1320 uint8_t* data() { OPEN_ARRAY_START(uint8_t, intptr_t); } |
1341 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, intptr_t); } | 1321 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, intptr_t); } |
1342 | 1322 |
1343 friend class Object; | 1323 friend class Object; |
1344 }; | 1324 }; |
1345 | 1325 |
1346 | |
1347 // CodeSourceMap encodes a mapping from code PC ranges to source token | 1326 // CodeSourceMap encodes a mapping from code PC ranges to source token |
1348 // positions and the stack of inlined functions. | 1327 // positions and the stack of inlined functions. |
1349 class RawCodeSourceMap : public RawObject { | 1328 class RawCodeSourceMap : public RawObject { |
1350 private: | 1329 private: |
1351 RAW_HEAP_OBJECT_IMPLEMENTATION(CodeSourceMap); | 1330 RAW_HEAP_OBJECT_IMPLEMENTATION(CodeSourceMap); |
1352 | 1331 |
1353 // Length in bytes. This only needs to be an int32_t, but we make it a uword | 1332 // Length in bytes. This only needs to be an int32_t, but we make it a uword |
1354 // so that the variable length data is 64 bit aligned on 64 bit platforms. | 1333 // so that the variable length data is 64 bit aligned on 64 bit platforms. |
1355 uword length_; | 1334 uword length_; |
1356 | 1335 |
1357 // Variable length data follows here. | 1336 // Variable length data follows here. |
1358 uint8_t* data() { OPEN_ARRAY_START(uint8_t, intptr_t); } | 1337 uint8_t* data() { OPEN_ARRAY_START(uint8_t, intptr_t); } |
1359 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, intptr_t); } | 1338 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, intptr_t); } |
1360 | 1339 |
1361 friend class Object; | 1340 friend class Object; |
1362 }; | 1341 }; |
1363 | 1342 |
1364 | |
1365 // StackMap is an immutable representation of the layout of the stack at a | 1343 // StackMap is an immutable representation of the layout of the stack at a |
1366 // PC. The stack map representation consists of a bit map which marks each | 1344 // PC. The stack map representation consists of a bit map which marks each |
1367 // live object index starting from the base of the frame. | 1345 // live object index starting from the base of the frame. |
1368 // | 1346 // |
1369 // The bit map representation is optimized for dense and small bit maps, without | 1347 // The bit map representation is optimized for dense and small bit maps, without |
1370 // any upper bound. | 1348 // any upper bound. |
1371 class RawStackMap : public RawObject { | 1349 class RawStackMap : public RawObject { |
1372 RAW_HEAP_OBJECT_IMPLEMENTATION(StackMap); | 1350 RAW_HEAP_OBJECT_IMPLEMENTATION(StackMap); |
1373 | 1351 |
1374 // Regarding changing this to a bitfield: ARM64 requires register_bit_count_ | 1352 // Regarding changing this to a bitfield: ARM64 requires register_bit_count_ |
1375 // to be as large as 96, meaning 7 bits, leaving 25 bits for the length, or | 1353 // to be as large as 96, meaning 7 bits, leaving 25 bits for the length, or |
1376 // as large as ~33 million entries. If that is sufficient, then these two | 1354 // as large as ~33 million entries. If that is sufficient, then these two |
1377 // fields can be merged into a BitField. | 1355 // fields can be merged into a BitField. |
1378 int32_t length_; // Length of payload, in bits. | 1356 int32_t length_; // Length of payload, in bits. |
1379 int32_t slow_path_bit_count_; // Slow path live values, included in length_. | 1357 int32_t slow_path_bit_count_; // Slow path live values, included in length_. |
1380 | 1358 |
1381 // Offset from code entry point corresponding to this stack map | 1359 // Offset from code entry point corresponding to this stack map |
1382 // representation. This only needs to be an int32_t, but we make it a uword | 1360 // representation. This only needs to be an int32_t, but we make it a uword |
1383 // so that the variable length data is 64 bit aligned on 64 bit platforms. | 1361 // so that the variable length data is 64 bit aligned on 64 bit platforms. |
1384 uword pc_offset_; | 1362 uword pc_offset_; |
1385 | 1363 |
1386 // Variable length data follows here (bitmap of the stack layout). | 1364 // Variable length data follows here (bitmap of the stack layout). |
1387 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } | 1365 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } |
1388 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); } | 1366 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); } |
1389 }; | 1367 }; |
1390 | 1368 |
1391 | |
1392 class RawLocalVarDescriptors : public RawObject { | 1369 class RawLocalVarDescriptors : public RawObject { |
1393 public: | 1370 public: |
1394 enum VarInfoKind { | 1371 enum VarInfoKind { |
1395 kStackVar = 1, | 1372 kStackVar = 1, |
1396 kContextVar, | 1373 kContextVar, |
1397 kContextLevel, | 1374 kContextLevel, |
1398 kSavedCurrentContext, | 1375 kSavedCurrentContext, |
1399 }; | 1376 }; |
1400 | 1377 |
1401 enum { | 1378 enum { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1454 } | 1431 } |
1455 | 1432 |
1456 // Variable info with [num_entries_] entries. | 1433 // Variable info with [num_entries_] entries. |
1457 VarInfo* data() { | 1434 VarInfo* data() { |
1458 return reinterpret_cast<VarInfo*>(nameAddrAt(ptr()->num_entries_)); | 1435 return reinterpret_cast<VarInfo*>(nameAddrAt(ptr()->num_entries_)); |
1459 } | 1436 } |
1460 | 1437 |
1461 friend class Object; | 1438 friend class Object; |
1462 }; | 1439 }; |
1463 | 1440 |
1464 | |
1465 class RawExceptionHandlers : public RawObject { | 1441 class RawExceptionHandlers : public RawObject { |
1466 private: | 1442 private: |
1467 RAW_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers); | 1443 RAW_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers); |
1468 | 1444 |
1469 // Number of exception handler entries. | 1445 // Number of exception handler entries. |
1470 int32_t num_entries_; | 1446 int32_t num_entries_; |
1471 | 1447 |
1472 // Array with [num_entries_] entries. Each entry is an array of all handled | 1448 // Array with [num_entries_] entries. Each entry is an array of all handled |
1473 // exception types. | 1449 // exception types. |
1474 RawArray* handled_types_data_; | 1450 RawArray* handled_types_data_; |
1475 | 1451 |
1476 // Exception handler info of length [num_entries_]. | 1452 // Exception handler info of length [num_entries_]. |
1477 const ExceptionHandlerInfo* data() const { | 1453 const ExceptionHandlerInfo* data() const { |
1478 OPEN_ARRAY_START(ExceptionHandlerInfo, intptr_t); | 1454 OPEN_ARRAY_START(ExceptionHandlerInfo, intptr_t); |
1479 } | 1455 } |
1480 ExceptionHandlerInfo* data() { | 1456 ExceptionHandlerInfo* data() { |
1481 OPEN_ARRAY_START(ExceptionHandlerInfo, intptr_t); | 1457 OPEN_ARRAY_START(ExceptionHandlerInfo, intptr_t); |
1482 } | 1458 } |
1483 | 1459 |
1484 friend class Object; | 1460 friend class Object; |
1485 }; | 1461 }; |
1486 | 1462 |
1487 | |
1488 class RawContext : public RawObject { | 1463 class RawContext : public RawObject { |
1489 RAW_HEAP_OBJECT_IMPLEMENTATION(Context); | 1464 RAW_HEAP_OBJECT_IMPLEMENTATION(Context); |
1490 | 1465 |
1491 int32_t num_variables_; | 1466 int32_t num_variables_; |
1492 | 1467 |
1493 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->parent_); } | 1468 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->parent_); } |
1494 RawContext* parent_; | 1469 RawContext* parent_; |
1495 | 1470 |
1496 // Variable length data follows here. | 1471 // Variable length data follows here. |
1497 RawObject** data() { OPEN_ARRAY_START(RawObject*, RawObject*); } | 1472 RawObject** data() { OPEN_ARRAY_START(RawObject*, RawObject*); } |
1498 RawObject* const* data() const { OPEN_ARRAY_START(RawObject*, RawObject*); } | 1473 RawObject* const* data() const { OPEN_ARRAY_START(RawObject*, RawObject*); } |
1499 RawObject** to(intptr_t num_vars) { | 1474 RawObject** to(intptr_t num_vars) { |
1500 return reinterpret_cast<RawObject**>(&ptr()->data()[num_vars - 1]); | 1475 return reinterpret_cast<RawObject**>(&ptr()->data()[num_vars - 1]); |
1501 } | 1476 } |
1502 | 1477 |
1503 friend class Object; | 1478 friend class Object; |
1504 friend class SnapshotReader; | 1479 friend class SnapshotReader; |
1505 }; | 1480 }; |
1506 | 1481 |
1507 | |
1508 class RawContextScope : public RawObject { | 1482 class RawContextScope : public RawObject { |
1509 RAW_HEAP_OBJECT_IMPLEMENTATION(ContextScope); | 1483 RAW_HEAP_OBJECT_IMPLEMENTATION(ContextScope); |
1510 | 1484 |
1511 // TODO(iposva): Switch to conventional enum offset based structure to avoid | 1485 // TODO(iposva): Switch to conventional enum offset based structure to avoid |
1512 // alignment mishaps. | 1486 // alignment mishaps. |
1513 struct VariableDesc { | 1487 struct VariableDesc { |
1514 RawSmi* declaration_token_pos; | 1488 RawSmi* declaration_token_pos; |
1515 RawSmi* token_pos; | 1489 RawSmi* token_pos; |
1516 RawString* name; | 1490 RawString* name; |
1517 RawBool* is_final; | 1491 RawBool* is_final; |
(...skipping 24 matching lines...) Expand all Loading... |
1542 uword end = reinterpret_cast<uword>(ptr()->VariableDescAddr(num_vars)); | 1516 uword end = reinterpret_cast<uword>(ptr()->VariableDescAddr(num_vars)); |
1543 // 'end' is the address just beyond the last descriptor, so step back. | 1517 // 'end' is the address just beyond the last descriptor, so step back. |
1544 return reinterpret_cast<RawObject**>(end - kWordSize); | 1518 return reinterpret_cast<RawObject**>(end - kWordSize); |
1545 } | 1519 } |
1546 | 1520 |
1547 friend class Object; | 1521 friend class Object; |
1548 friend class RawClosureData; | 1522 friend class RawClosureData; |
1549 friend class SnapshotReader; | 1523 friend class SnapshotReader; |
1550 }; | 1524 }; |
1551 | 1525 |
1552 | |
1553 class RawSingleTargetCache : public RawObject { | 1526 class RawSingleTargetCache : public RawObject { |
1554 RAW_HEAP_OBJECT_IMPLEMENTATION(SingleTargetCache); | 1527 RAW_HEAP_OBJECT_IMPLEMENTATION(SingleTargetCache); |
1555 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->target_); } | 1528 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->target_); } |
1556 RawCode* target_; | 1529 RawCode* target_; |
1557 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->target_); } | 1530 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->target_); } |
1558 uword entry_point_; | 1531 uword entry_point_; |
1559 classid_t lower_limit_; | 1532 classid_t lower_limit_; |
1560 classid_t upper_limit_; | 1533 classid_t upper_limit_; |
1561 }; | 1534 }; |
1562 | 1535 |
1563 | |
1564 class RawUnlinkedCall : public RawObject { | 1536 class RawUnlinkedCall : public RawObject { |
1565 RAW_HEAP_OBJECT_IMPLEMENTATION(UnlinkedCall); | 1537 RAW_HEAP_OBJECT_IMPLEMENTATION(UnlinkedCall); |
1566 RawObject** from() { | 1538 RawObject** from() { |
1567 return reinterpret_cast<RawObject**>(&ptr()->target_name_); | 1539 return reinterpret_cast<RawObject**>(&ptr()->target_name_); |
1568 } | 1540 } |
1569 RawString* target_name_; | 1541 RawString* target_name_; |
1570 RawArray* args_descriptor_; | 1542 RawArray* args_descriptor_; |
1571 RawObject** to() { | 1543 RawObject** to() { |
1572 return reinterpret_cast<RawObject**>(&ptr()->args_descriptor_); | 1544 return reinterpret_cast<RawObject**>(&ptr()->args_descriptor_); |
1573 } | 1545 } |
1574 }; | 1546 }; |
1575 | 1547 |
1576 | |
1577 class RawICData : public RawObject { | 1548 class RawICData : public RawObject { |
1578 RAW_HEAP_OBJECT_IMPLEMENTATION(ICData); | 1549 RAW_HEAP_OBJECT_IMPLEMENTATION(ICData); |
1579 | 1550 |
1580 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->ic_data_); } | 1551 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->ic_data_); } |
1581 RawArray* ic_data_; // Contains class-ids, target and count. | 1552 RawArray* ic_data_; // Contains class-ids, target and count. |
1582 RawString* target_name_; // Name of target function. | 1553 RawString* target_name_; // Name of target function. |
1583 RawArray* args_descriptor_; // Arguments descriptor. | 1554 RawArray* args_descriptor_; // Arguments descriptor. |
1584 RawObject* owner_; // Parent/calling function or original IC of cloned IC. | 1555 RawObject* owner_; // Parent/calling function or original IC of cloned IC. |
1585 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->owner_); } | 1556 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->owner_); } |
1586 RawObject** to_snapshot(Snapshot::Kind kind) { | 1557 RawObject** to_snapshot(Snapshot::Kind kind) { |
(...skipping 13 matching lines...) Expand all Loading... |
1600 return NULL; | 1571 return NULL; |
1601 } | 1572 } |
1602 NOT_IN_PRECOMPILED(int32_t deopt_id_); | 1573 NOT_IN_PRECOMPILED(int32_t deopt_id_); |
1603 uint32_t state_bits_; // Number of arguments tested in IC, deopt reasons. | 1574 uint32_t state_bits_; // Number of arguments tested in IC, deopt reasons. |
1604 #if defined(TAG_IC_DATA) | 1575 #if defined(TAG_IC_DATA) |
1605 intptr_t tag_; // Debugging, verifying that the icdata is assigned to the | 1576 intptr_t tag_; // Debugging, verifying that the icdata is assigned to the |
1606 // same instruction again. Store -1 or Instruction::Tag. | 1577 // same instruction again. Store -1 or Instruction::Tag. |
1607 #endif | 1578 #endif |
1608 }; | 1579 }; |
1609 | 1580 |
1610 | |
1611 class RawMegamorphicCache : public RawObject { | 1581 class RawMegamorphicCache : public RawObject { |
1612 RAW_HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache); | 1582 RAW_HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache); |
1613 | 1583 |
1614 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->buckets_); } | 1584 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->buckets_); } |
1615 RawArray* buckets_; | 1585 RawArray* buckets_; |
1616 RawSmi* mask_; | 1586 RawSmi* mask_; |
1617 RawString* target_name_; // Name of target function. | 1587 RawString* target_name_; // Name of target function. |
1618 RawArray* args_descriptor_; // Arguments descriptor. | 1588 RawArray* args_descriptor_; // Arguments descriptor. |
1619 RawObject** to() { | 1589 RawObject** to() { |
1620 return reinterpret_cast<RawObject**>(&ptr()->args_descriptor_); | 1590 return reinterpret_cast<RawObject**>(&ptr()->args_descriptor_); |
1621 } | 1591 } |
1622 | 1592 |
1623 int32_t filled_entry_count_; | 1593 int32_t filled_entry_count_; |
1624 }; | 1594 }; |
1625 | 1595 |
1626 | |
1627 class RawSubtypeTestCache : public RawObject { | 1596 class RawSubtypeTestCache : public RawObject { |
1628 RAW_HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache); | 1597 RAW_HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache); |
1629 RawArray* cache_; | 1598 RawArray* cache_; |
1630 }; | 1599 }; |
1631 | 1600 |
1632 | |
1633 class RawError : public RawObject { | 1601 class RawError : public RawObject { |
1634 RAW_HEAP_OBJECT_IMPLEMENTATION(Error); | 1602 RAW_HEAP_OBJECT_IMPLEMENTATION(Error); |
1635 }; | 1603 }; |
1636 | 1604 |
1637 | |
1638 class RawApiError : public RawError { | 1605 class RawApiError : public RawError { |
1639 RAW_HEAP_OBJECT_IMPLEMENTATION(ApiError); | 1606 RAW_HEAP_OBJECT_IMPLEMENTATION(ApiError); |
1640 | 1607 |
1641 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->message_); } | 1608 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->message_); } |
1642 RawString* message_; | 1609 RawString* message_; |
1643 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->message_); } | 1610 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->message_); } |
1644 }; | 1611 }; |
1645 | 1612 |
1646 | |
1647 class RawLanguageError : public RawError { | 1613 class RawLanguageError : public RawError { |
1648 RAW_HEAP_OBJECT_IMPLEMENTATION(LanguageError); | 1614 RAW_HEAP_OBJECT_IMPLEMENTATION(LanguageError); |
1649 | 1615 |
1650 RawObject** from() { | 1616 RawObject** from() { |
1651 return reinterpret_cast<RawObject**>(&ptr()->previous_error_); | 1617 return reinterpret_cast<RawObject**>(&ptr()->previous_error_); |
1652 } | 1618 } |
1653 RawError* previous_error_; // May be null. | 1619 RawError* previous_error_; // May be null. |
1654 RawScript* script_; | 1620 RawScript* script_; |
1655 RawString* message_; | 1621 RawString* message_; |
1656 RawString* formatted_message_; // Incl. previous error's formatted message. | 1622 RawString* formatted_message_; // Incl. previous error's formatted message. |
1657 RawObject** to() { | 1623 RawObject** to() { |
1658 return reinterpret_cast<RawObject**>(&ptr()->formatted_message_); | 1624 return reinterpret_cast<RawObject**>(&ptr()->formatted_message_); |
1659 } | 1625 } |
1660 TokenPosition token_pos_; // Source position in script_. | 1626 TokenPosition token_pos_; // Source position in script_. |
1661 bool report_after_token_; // Report message at or after the token. | 1627 bool report_after_token_; // Report message at or after the token. |
1662 int8_t kind_; // Of type Report::Kind. | 1628 int8_t kind_; // Of type Report::Kind. |
1663 }; | 1629 }; |
1664 | 1630 |
1665 | |
1666 class RawUnhandledException : public RawError { | 1631 class RawUnhandledException : public RawError { |
1667 RAW_HEAP_OBJECT_IMPLEMENTATION(UnhandledException); | 1632 RAW_HEAP_OBJECT_IMPLEMENTATION(UnhandledException); |
1668 | 1633 |
1669 RawObject** from() { | 1634 RawObject** from() { |
1670 return reinterpret_cast<RawObject**>(&ptr()->exception_); | 1635 return reinterpret_cast<RawObject**>(&ptr()->exception_); |
1671 } | 1636 } |
1672 RawInstance* exception_; | 1637 RawInstance* exception_; |
1673 RawInstance* stacktrace_; | 1638 RawInstance* stacktrace_; |
1674 RawObject** to() { | 1639 RawObject** to() { |
1675 return reinterpret_cast<RawObject**>(&ptr()->stacktrace_); | 1640 return reinterpret_cast<RawObject**>(&ptr()->stacktrace_); |
1676 } | 1641 } |
1677 }; | 1642 }; |
1678 | 1643 |
1679 | |
1680 class RawUnwindError : public RawError { | 1644 class RawUnwindError : public RawError { |
1681 RAW_HEAP_OBJECT_IMPLEMENTATION(UnwindError); | 1645 RAW_HEAP_OBJECT_IMPLEMENTATION(UnwindError); |
1682 | 1646 |
1683 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->message_); } | 1647 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->message_); } |
1684 RawString* message_; | 1648 RawString* message_; |
1685 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->message_); } | 1649 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->message_); } |
1686 bool is_user_initiated_; | 1650 bool is_user_initiated_; |
1687 }; | 1651 }; |
1688 | 1652 |
1689 | |
1690 class RawInstance : public RawObject { | 1653 class RawInstance : public RawObject { |
1691 RAW_HEAP_OBJECT_IMPLEMENTATION(Instance); | 1654 RAW_HEAP_OBJECT_IMPLEMENTATION(Instance); |
1692 }; | 1655 }; |
1693 | 1656 |
1694 | |
1695 class RawLibraryPrefix : public RawInstance { | 1657 class RawLibraryPrefix : public RawInstance { |
1696 RAW_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix); | 1658 RAW_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix); |
1697 | 1659 |
1698 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | 1660 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
1699 RawString* name_; // Library prefix name. | 1661 RawString* name_; // Library prefix name. |
1700 RawLibrary* importer_; // Library which declares this prefix. | 1662 RawLibrary* importer_; // Library which declares this prefix. |
1701 RawArray* imports_; // Libraries imported with this prefix. | 1663 RawArray* imports_; // Libraries imported with this prefix. |
1702 RawArray* dependent_code_; // Code that refers to deferred, unloaded | 1664 RawArray* dependent_code_; // Code that refers to deferred, unloaded |
1703 // library prefix. | 1665 // library prefix. |
1704 RawObject** to() { | 1666 RawObject** to() { |
(...skipping 13 matching lines...) Expand all Loading... |
1718 break; | 1680 break; |
1719 } | 1681 } |
1720 UNREACHABLE(); | 1682 UNREACHABLE(); |
1721 return NULL; | 1683 return NULL; |
1722 } | 1684 } |
1723 uint16_t num_imports_; // Number of library entries in libraries_. | 1685 uint16_t num_imports_; // Number of library entries in libraries_. |
1724 bool is_deferred_load_; | 1686 bool is_deferred_load_; |
1725 bool is_loaded_; | 1687 bool is_loaded_; |
1726 }; | 1688 }; |
1727 | 1689 |
1728 | |
1729 class RawAbstractType : public RawInstance { | 1690 class RawAbstractType : public RawInstance { |
1730 protected: | 1691 protected: |
1731 enum TypeState { | 1692 enum TypeState { |
1732 kAllocated, // Initial state. | 1693 kAllocated, // Initial state. |
1733 kResolved, // Type class and type arguments resolved. | 1694 kResolved, // Type class and type arguments resolved. |
1734 kBeingFinalized, // In the process of being finalized. | 1695 kBeingFinalized, // In the process of being finalized. |
1735 kFinalizedInstantiated, // Instantiated type ready for use. | 1696 kFinalizedInstantiated, // Instantiated type ready for use. |
1736 kFinalizedUninstantiated, // Uninstantiated type ready for use. | 1697 kFinalizedUninstantiated, // Uninstantiated type ready for use. |
1737 }; | 1698 }; |
1738 | 1699 |
1739 private: | 1700 private: |
1740 RAW_HEAP_OBJECT_IMPLEMENTATION(AbstractType); | 1701 RAW_HEAP_OBJECT_IMPLEMENTATION(AbstractType); |
1741 | 1702 |
1742 friend class ObjectStore; | 1703 friend class ObjectStore; |
1743 }; | 1704 }; |
1744 | 1705 |
1745 | |
1746 class RawType : public RawAbstractType { | 1706 class RawType : public RawAbstractType { |
1747 private: | 1707 private: |
1748 RAW_HEAP_OBJECT_IMPLEMENTATION(Type); | 1708 RAW_HEAP_OBJECT_IMPLEMENTATION(Type); |
1749 | 1709 |
1750 RawObject** from() { | 1710 RawObject** from() { |
1751 return reinterpret_cast<RawObject**>(&ptr()->type_class_id_); | 1711 return reinterpret_cast<RawObject**>(&ptr()->type_class_id_); |
1752 } | 1712 } |
1753 // Either the id of the resolved class as a Smi or an UnresolvedClass. | 1713 // Either the id of the resolved class as a Smi or an UnresolvedClass. |
1754 RawObject* type_class_id_; | 1714 RawObject* type_class_id_; |
1755 RawTypeArguments* arguments_; | 1715 RawTypeArguments* arguments_; |
(...skipping 11 matching lines...) Expand all Loading... |
1767 RawObject** to() { | 1727 RawObject** to() { |
1768 return reinterpret_cast<RawObject**>(&ptr()->sig_or_err_.error_); | 1728 return reinterpret_cast<RawObject**>(&ptr()->sig_or_err_.error_); |
1769 } | 1729 } |
1770 TokenPosition token_pos_; | 1730 TokenPosition token_pos_; |
1771 int8_t type_state_; | 1731 int8_t type_state_; |
1772 | 1732 |
1773 friend class CidRewriteVisitor; | 1733 friend class CidRewriteVisitor; |
1774 friend class RawTypeArguments; | 1734 friend class RawTypeArguments; |
1775 }; | 1735 }; |
1776 | 1736 |
1777 | |
1778 class RawTypeRef : public RawAbstractType { | 1737 class RawTypeRef : public RawAbstractType { |
1779 private: | 1738 private: |
1780 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeRef); | 1739 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeRef); |
1781 | 1740 |
1782 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->type_); } | 1741 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->type_); } |
1783 RawAbstractType* type_; // The referenced type. | 1742 RawAbstractType* type_; // The referenced type. |
1784 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->type_); } | 1743 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->type_); } |
1785 }; | 1744 }; |
1786 | 1745 |
1787 | |
1788 class RawTypeParameter : public RawAbstractType { | 1746 class RawTypeParameter : public RawAbstractType { |
1789 private: | 1747 private: |
1790 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter); | 1748 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter); |
1791 | 1749 |
1792 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } | 1750 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } |
1793 RawString* name_; | 1751 RawString* name_; |
1794 RawSmi* hash_; | 1752 RawSmi* hash_; |
1795 RawAbstractType* bound_; // ObjectType if no explicit bound specified. | 1753 RawAbstractType* bound_; // ObjectType if no explicit bound specified. |
1796 RawFunction* parameterized_function_; | 1754 RawFunction* parameterized_function_; |
1797 RawObject** to() { | 1755 RawObject** to() { |
1798 return reinterpret_cast<RawObject**>(&ptr()->parameterized_function_); | 1756 return reinterpret_cast<RawObject**>(&ptr()->parameterized_function_); |
1799 } | 1757 } |
1800 classid_t parameterized_class_id_; | 1758 classid_t parameterized_class_id_; |
1801 TokenPosition token_pos_; | 1759 TokenPosition token_pos_; |
1802 int16_t index_; | 1760 int16_t index_; |
1803 int8_t type_state_; | 1761 int8_t type_state_; |
1804 | 1762 |
1805 friend class CidRewriteVisitor; | 1763 friend class CidRewriteVisitor; |
1806 }; | 1764 }; |
1807 | 1765 |
1808 | |
1809 class RawBoundedType : public RawAbstractType { | 1766 class RawBoundedType : public RawAbstractType { |
1810 private: | 1767 private: |
1811 RAW_HEAP_OBJECT_IMPLEMENTATION(BoundedType); | 1768 RAW_HEAP_OBJECT_IMPLEMENTATION(BoundedType); |
1812 | 1769 |
1813 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->type_); } | 1770 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->type_); } |
1814 RawAbstractType* type_; | 1771 RawAbstractType* type_; |
1815 RawAbstractType* bound_; | 1772 RawAbstractType* bound_; |
1816 RawSmi* hash_; | 1773 RawSmi* hash_; |
1817 RawTypeParameter* type_parameter_; // For more detailed error reporting. | 1774 RawTypeParameter* type_parameter_; // For more detailed error reporting. |
1818 RawObject** to() { | 1775 RawObject** to() { |
1819 return reinterpret_cast<RawObject**>(&ptr()->type_parameter_); | 1776 return reinterpret_cast<RawObject**>(&ptr()->type_parameter_); |
1820 } | 1777 } |
1821 }; | 1778 }; |
1822 | 1779 |
1823 | |
1824 class RawMixinAppType : public RawAbstractType { | 1780 class RawMixinAppType : public RawAbstractType { |
1825 private: | 1781 private: |
1826 RAW_HEAP_OBJECT_IMPLEMENTATION(MixinAppType); | 1782 RAW_HEAP_OBJECT_IMPLEMENTATION(MixinAppType); |
1827 | 1783 |
1828 RawObject** from() { | 1784 RawObject** from() { |
1829 return reinterpret_cast<RawObject**>(&ptr()->super_type_); | 1785 return reinterpret_cast<RawObject**>(&ptr()->super_type_); |
1830 } | 1786 } |
1831 RawAbstractType* super_type_; | 1787 RawAbstractType* super_type_; |
1832 RawArray* mixin_types_; // Array of AbstractType. | 1788 RawArray* mixin_types_; // Array of AbstractType. |
1833 RawObject** to() { | 1789 RawObject** to() { |
1834 return reinterpret_cast<RawObject**>(&ptr()->mixin_types_); | 1790 return reinterpret_cast<RawObject**>(&ptr()->mixin_types_); |
1835 } | 1791 } |
1836 }; | 1792 }; |
1837 | 1793 |
1838 | |
1839 class RawClosure : public RawInstance { | 1794 class RawClosure : public RawInstance { |
1840 private: | 1795 private: |
1841 RAW_HEAP_OBJECT_IMPLEMENTATION(Closure); | 1796 RAW_HEAP_OBJECT_IMPLEMENTATION(Closure); |
1842 | 1797 |
1843 RawObject** from() { | 1798 RawObject** from() { |
1844 return reinterpret_cast<RawObject**>(&ptr()->instantiator_type_arguments_); | 1799 return reinterpret_cast<RawObject**>(&ptr()->instantiator_type_arguments_); |
1845 } | 1800 } |
1846 | 1801 |
1847 // No instance fields should be declared before the following 4 fields whose | 1802 // No instance fields should be declared before the following 4 fields whose |
1848 // offsets must be identical in Dart and C++. | 1803 // offsets must be identical in Dart and C++. |
(...skipping 10 matching lines...) Expand all Loading... |
1859 // used to instantiate the signature of function_ when this closure is | 1814 // used to instantiate the signature of function_ when this closure is |
1860 // involved in a type test. In other words, these fields define the function | 1815 // involved in a type test. In other words, these fields define the function |
1861 // type of this closure instance, but they are not used when invoking it. | 1816 // type of this closure instance, but they are not used when invoking it. |
1862 // If this closure is generic, it can be invoked with function type arguments | 1817 // If this closure is generic, it can be invoked with function type arguments |
1863 // that will be processed in the prolog of the closure function_. For example, | 1818 // that will be processed in the prolog of the closure function_. For example, |
1864 // if the generic closure function_ has a generic parent function, the | 1819 // if the generic closure function_ has a generic parent function, the |
1865 // passed-in function type arguments get concatenated to the function type | 1820 // passed-in function type arguments get concatenated to the function type |
1866 // arguments of the parent that are found in the context_. | 1821 // arguments of the parent that are found in the context_. |
1867 }; | 1822 }; |
1868 | 1823 |
1869 | |
1870 class RawNumber : public RawInstance { | 1824 class RawNumber : public RawInstance { |
1871 RAW_OBJECT_IMPLEMENTATION(Number); | 1825 RAW_OBJECT_IMPLEMENTATION(Number); |
1872 }; | 1826 }; |
1873 | 1827 |
1874 | |
1875 class RawInteger : public RawNumber { | 1828 class RawInteger : public RawNumber { |
1876 RAW_OBJECT_IMPLEMENTATION(Integer); | 1829 RAW_OBJECT_IMPLEMENTATION(Integer); |
1877 }; | 1830 }; |
1878 | 1831 |
1879 | |
1880 class RawSmi : public RawInteger { | 1832 class RawSmi : public RawInteger { |
1881 RAW_OBJECT_IMPLEMENTATION(Smi); | 1833 RAW_OBJECT_IMPLEMENTATION(Smi); |
1882 }; | 1834 }; |
1883 | 1835 |
1884 | |
1885 class RawMint : public RawInteger { | 1836 class RawMint : public RawInteger { |
1886 RAW_HEAP_OBJECT_IMPLEMENTATION(Mint); | 1837 RAW_HEAP_OBJECT_IMPLEMENTATION(Mint); |
1887 | 1838 |
1888 ALIGN8 int64_t value_; | 1839 ALIGN8 int64_t value_; |
1889 | 1840 |
1890 friend class Api; | 1841 friend class Api; |
1891 friend class SnapshotReader; | 1842 friend class SnapshotReader; |
1892 }; | 1843 }; |
1893 COMPILE_ASSERT(sizeof(RawMint) == 16); | 1844 COMPILE_ASSERT(sizeof(RawMint) == 16); |
1894 | 1845 |
1895 | |
1896 class RawBigint : public RawInteger { | 1846 class RawBigint : public RawInteger { |
1897 RAW_HEAP_OBJECT_IMPLEMENTATION(Bigint); | 1847 RAW_HEAP_OBJECT_IMPLEMENTATION(Bigint); |
1898 | 1848 |
1899 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->neg_); } | 1849 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->neg_); } |
1900 RawBool* neg_; | 1850 RawBool* neg_; |
1901 RawSmi* used_; | 1851 RawSmi* used_; |
1902 RawTypedData* digits_; | 1852 RawTypedData* digits_; |
1903 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->digits_); } | 1853 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->digits_); } |
1904 }; | 1854 }; |
1905 | 1855 |
1906 | |
1907 class RawDouble : public RawNumber { | 1856 class RawDouble : public RawNumber { |
1908 RAW_HEAP_OBJECT_IMPLEMENTATION(Double); | 1857 RAW_HEAP_OBJECT_IMPLEMENTATION(Double); |
1909 | 1858 |
1910 ALIGN8 double value_; | 1859 ALIGN8 double value_; |
1911 | 1860 |
1912 friend class Api; | 1861 friend class Api; |
1913 friend class SnapshotReader; | 1862 friend class SnapshotReader; |
1914 }; | 1863 }; |
1915 COMPILE_ASSERT(sizeof(RawDouble) == 16); | 1864 COMPILE_ASSERT(sizeof(RawDouble) == 16); |
1916 | 1865 |
1917 | |
1918 class RawString : public RawInstance { | 1866 class RawString : public RawInstance { |
1919 RAW_HEAP_OBJECT_IMPLEMENTATION(String); | 1867 RAW_HEAP_OBJECT_IMPLEMENTATION(String); |
1920 | 1868 |
1921 protected: | 1869 protected: |
1922 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } | 1870 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } |
1923 RawSmi* length_; | 1871 RawSmi* length_; |
1924 #if !defined(HASH_IN_OBJECT_HEADER) | 1872 #if !defined(HASH_IN_OBJECT_HEADER) |
1925 RawSmi* hash_; | 1873 RawSmi* hash_; |
1926 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); } | 1874 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); } |
1927 #else | 1875 #else |
1928 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } | 1876 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } |
1929 #endif | 1877 #endif |
1930 | 1878 |
1931 private: | 1879 private: |
1932 friend class Library; | 1880 friend class Library; |
1933 friend class OneByteStringSerializationCluster; | 1881 friend class OneByteStringSerializationCluster; |
1934 friend class TwoByteStringSerializationCluster; | 1882 friend class TwoByteStringSerializationCluster; |
1935 friend class OneByteStringDeserializationCluster; | 1883 friend class OneByteStringDeserializationCluster; |
1936 friend class TwoByteStringDeserializationCluster; | 1884 friend class TwoByteStringDeserializationCluster; |
1937 friend class RODataSerializationCluster; | 1885 friend class RODataSerializationCluster; |
1938 }; | 1886 }; |
1939 | 1887 |
1940 | |
1941 class RawOneByteString : public RawString { | 1888 class RawOneByteString : public RawString { |
1942 RAW_HEAP_OBJECT_IMPLEMENTATION(OneByteString); | 1889 RAW_HEAP_OBJECT_IMPLEMENTATION(OneByteString); |
1943 | 1890 |
1944 // Variable length data follows here. | 1891 // Variable length data follows here. |
1945 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } | 1892 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } |
1946 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); } | 1893 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); } |
1947 | 1894 |
1948 friend class ApiMessageReader; | 1895 friend class ApiMessageReader; |
1949 friend class RODataSerializationCluster; | 1896 friend class RODataSerializationCluster; |
1950 friend class SnapshotReader; | 1897 friend class SnapshotReader; |
1951 friend class String; | 1898 friend class String; |
1952 }; | 1899 }; |
1953 | 1900 |
1954 | |
1955 class RawTwoByteString : public RawString { | 1901 class RawTwoByteString : public RawString { |
1956 RAW_HEAP_OBJECT_IMPLEMENTATION(TwoByteString); | 1902 RAW_HEAP_OBJECT_IMPLEMENTATION(TwoByteString); |
1957 | 1903 |
1958 // Variable length data follows here. | 1904 // Variable length data follows here. |
1959 uint16_t* data() { OPEN_ARRAY_START(uint16_t, uint16_t); } | 1905 uint16_t* data() { OPEN_ARRAY_START(uint16_t, uint16_t); } |
1960 const uint16_t* data() const { OPEN_ARRAY_START(uint16_t, uint16_t); } | 1906 const uint16_t* data() const { OPEN_ARRAY_START(uint16_t, uint16_t); } |
1961 | 1907 |
1962 friend class RODataSerializationCluster; | 1908 friend class RODataSerializationCluster; |
1963 friend class SnapshotReader; | 1909 friend class SnapshotReader; |
1964 friend class String; | 1910 friend class String; |
1965 }; | 1911 }; |
1966 | 1912 |
1967 | |
1968 template <typename T> | 1913 template <typename T> |
1969 class ExternalStringData { | 1914 class ExternalStringData { |
1970 public: | 1915 public: |
1971 ExternalStringData(const T* data, void* peer, Dart_PeerFinalizer callback) | 1916 ExternalStringData(const T* data, void* peer, Dart_PeerFinalizer callback) |
1972 : data_(data), peer_(peer), callback_(callback) {} | 1917 : data_(data), peer_(peer), callback_(callback) {} |
1973 ~ExternalStringData() { | 1918 ~ExternalStringData() { |
1974 if (callback_ != NULL) (*callback_)(peer_); | 1919 if (callback_ != NULL) (*callback_)(peer_); |
1975 } | 1920 } |
1976 | 1921 |
1977 const T* data() { return data_; } | 1922 const T* data() { return data_; } |
1978 void* peer() { return peer_; } | 1923 void* peer() { return peer_; } |
1979 | 1924 |
1980 static intptr_t data_offset() { | 1925 static intptr_t data_offset() { |
1981 return OFFSET_OF(ExternalStringData<T>, data_); | 1926 return OFFSET_OF(ExternalStringData<T>, data_); |
1982 } | 1927 } |
1983 | 1928 |
1984 private: | 1929 private: |
1985 const T* data_; | 1930 const T* data_; |
1986 void* peer_; | 1931 void* peer_; |
1987 Dart_PeerFinalizer callback_; | 1932 Dart_PeerFinalizer callback_; |
1988 }; | 1933 }; |
1989 | 1934 |
1990 | |
1991 class RawExternalOneByteString : public RawString { | 1935 class RawExternalOneByteString : public RawString { |
1992 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalOneByteString); | 1936 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalOneByteString); |
1993 | 1937 |
1994 public: | 1938 public: |
1995 typedef ExternalStringData<uint8_t> ExternalData; | 1939 typedef ExternalStringData<uint8_t> ExternalData; |
1996 | 1940 |
1997 private: | 1941 private: |
1998 ExternalData* external_data_; | 1942 ExternalData* external_data_; |
1999 friend class Api; | 1943 friend class Api; |
2000 friend class String; | 1944 friend class String; |
2001 }; | 1945 }; |
2002 | 1946 |
2003 | |
2004 class RawExternalTwoByteString : public RawString { | 1947 class RawExternalTwoByteString : public RawString { |
2005 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTwoByteString); | 1948 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTwoByteString); |
2006 | 1949 |
2007 public: | 1950 public: |
2008 typedef ExternalStringData<uint16_t> ExternalData; | 1951 typedef ExternalStringData<uint16_t> ExternalData; |
2009 | 1952 |
2010 private: | 1953 private: |
2011 ExternalData* external_data_; | 1954 ExternalData* external_data_; |
2012 friend class Api; | 1955 friend class Api; |
2013 friend class String; | 1956 friend class String; |
2014 }; | 1957 }; |
2015 | 1958 |
2016 | |
2017 class RawBool : public RawInstance { | 1959 class RawBool : public RawInstance { |
2018 RAW_HEAP_OBJECT_IMPLEMENTATION(Bool); | 1960 RAW_HEAP_OBJECT_IMPLEMENTATION(Bool); |
2019 | 1961 |
2020 bool value_; | 1962 bool value_; |
2021 }; | 1963 }; |
2022 | 1964 |
2023 | |
2024 class RawArray : public RawInstance { | 1965 class RawArray : public RawInstance { |
2025 RAW_HEAP_OBJECT_IMPLEMENTATION(Array); | 1966 RAW_HEAP_OBJECT_IMPLEMENTATION(Array); |
2026 | 1967 |
2027 RawObject** from() { | 1968 RawObject** from() { |
2028 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); | 1969 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); |
2029 } | 1970 } |
2030 RawTypeArguments* type_arguments_; | 1971 RawTypeArguments* type_arguments_; |
2031 RawSmi* length_; | 1972 RawSmi* length_; |
2032 // Variable length data follows here. | 1973 // Variable length data follows here. |
2033 RawObject** data() { OPEN_ARRAY_START(RawObject*, RawObject*); } | 1974 RawObject** data() { OPEN_ARRAY_START(RawObject*, RawObject*); } |
2034 RawObject* const* data() const { OPEN_ARRAY_START(RawObject*, RawObject*); } | 1975 RawObject* const* data() const { OPEN_ARRAY_START(RawObject*, RawObject*); } |
2035 RawObject** to(intptr_t length) { | 1976 RawObject** to(intptr_t length) { |
2036 return reinterpret_cast<RawObject**>(&ptr()->data()[length - 1]); | 1977 return reinterpret_cast<RawObject**>(&ptr()->data()[length - 1]); |
2037 } | 1978 } |
2038 | 1979 |
2039 friend class LinkedHashMapSerializationCluster; | 1980 friend class LinkedHashMapSerializationCluster; |
2040 friend class LinkedHashMapDeserializationCluster; | 1981 friend class LinkedHashMapDeserializationCluster; |
2041 friend class Deserializer; | 1982 friend class Deserializer; |
2042 friend class RawCode; | 1983 friend class RawCode; |
2043 friend class RawImmutableArray; | 1984 friend class RawImmutableArray; |
2044 friend class SnapshotReader; | 1985 friend class SnapshotReader; |
2045 friend class GrowableObjectArray; | 1986 friend class GrowableObjectArray; |
2046 friend class LinkedHashMap; | 1987 friend class LinkedHashMap; |
2047 friend class RawLinkedHashMap; | 1988 friend class RawLinkedHashMap; |
2048 friend class Object; | 1989 friend class Object; |
2049 friend class ICData; // For high performance access. | 1990 friend class ICData; // For high performance access. |
2050 friend class SubtypeTestCache; // For high performance access. | 1991 friend class SubtypeTestCache; // For high performance access. |
2051 }; | 1992 }; |
2052 | 1993 |
2053 | |
2054 class RawImmutableArray : public RawArray { | 1994 class RawImmutableArray : public RawArray { |
2055 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray); | 1995 RAW_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray); |
2056 | 1996 |
2057 friend class SnapshotReader; | 1997 friend class SnapshotReader; |
2058 }; | 1998 }; |
2059 | 1999 |
2060 | |
2061 class RawGrowableObjectArray : public RawInstance { | 2000 class RawGrowableObjectArray : public RawInstance { |
2062 RAW_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray); | 2001 RAW_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray); |
2063 | 2002 |
2064 RawObject** from() { | 2003 RawObject** from() { |
2065 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); | 2004 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); |
2066 } | 2005 } |
2067 RawTypeArguments* type_arguments_; | 2006 RawTypeArguments* type_arguments_; |
2068 RawSmi* length_; | 2007 RawSmi* length_; |
2069 RawArray* data_; | 2008 RawArray* data_; |
2070 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->data_); } | 2009 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->data_); } |
2071 | 2010 |
2072 friend class SnapshotReader; | 2011 friend class SnapshotReader; |
2073 }; | 2012 }; |
2074 | 2013 |
2075 | |
2076 class RawLinkedHashMap : public RawInstance { | 2014 class RawLinkedHashMap : public RawInstance { |
2077 RAW_HEAP_OBJECT_IMPLEMENTATION(LinkedHashMap); | 2015 RAW_HEAP_OBJECT_IMPLEMENTATION(LinkedHashMap); |
2078 | 2016 |
2079 RawObject** from() { | 2017 RawObject** from() { |
2080 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); | 2018 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); |
2081 } | 2019 } |
2082 RawTypeArguments* type_arguments_; | 2020 RawTypeArguments* type_arguments_; |
2083 RawTypedData* index_; | 2021 RawTypedData* index_; |
2084 RawSmi* hash_mask_; | 2022 RawSmi* hash_mask_; |
2085 RawArray* data_; | 2023 RawArray* data_; |
2086 RawSmi* used_data_; | 2024 RawSmi* used_data_; |
2087 RawSmi* deleted_keys_; | 2025 RawSmi* deleted_keys_; |
2088 RawObject** to() { | 2026 RawObject** to() { |
2089 return reinterpret_cast<RawObject**>(&ptr()->deleted_keys_); | 2027 return reinterpret_cast<RawObject**>(&ptr()->deleted_keys_); |
2090 } | 2028 } |
2091 | 2029 |
2092 friend class SnapshotReader; | 2030 friend class SnapshotReader; |
2093 }; | 2031 }; |
2094 | 2032 |
2095 | |
2096 class RawFloat32x4 : public RawInstance { | 2033 class RawFloat32x4 : public RawInstance { |
2097 RAW_HEAP_OBJECT_IMPLEMENTATION(Float32x4); | 2034 RAW_HEAP_OBJECT_IMPLEMENTATION(Float32x4); |
2098 | 2035 |
2099 ALIGN8 float value_[4]; | 2036 ALIGN8 float value_[4]; |
2100 | 2037 |
2101 friend class SnapshotReader; | 2038 friend class SnapshotReader; |
2102 | 2039 |
2103 public: | 2040 public: |
2104 float x() const { return value_[0]; } | 2041 float x() const { return value_[0]; } |
2105 float y() const { return value_[1]; } | 2042 float y() const { return value_[1]; } |
2106 float z() const { return value_[2]; } | 2043 float z() const { return value_[2]; } |
2107 float w() const { return value_[3]; } | 2044 float w() const { return value_[3]; } |
2108 }; | 2045 }; |
2109 COMPILE_ASSERT(sizeof(RawFloat32x4) == 24); | 2046 COMPILE_ASSERT(sizeof(RawFloat32x4) == 24); |
2110 | 2047 |
2111 | |
2112 class RawInt32x4 : public RawInstance { | 2048 class RawInt32x4 : public RawInstance { |
2113 RAW_HEAP_OBJECT_IMPLEMENTATION(Int32x4); | 2049 RAW_HEAP_OBJECT_IMPLEMENTATION(Int32x4); |
2114 | 2050 |
2115 ALIGN8 int32_t value_[4]; | 2051 ALIGN8 int32_t value_[4]; |
2116 | 2052 |
2117 friend class SnapshotReader; | 2053 friend class SnapshotReader; |
2118 | 2054 |
2119 public: | 2055 public: |
2120 int32_t x() const { return value_[0]; } | 2056 int32_t x() const { return value_[0]; } |
2121 int32_t y() const { return value_[1]; } | 2057 int32_t y() const { return value_[1]; } |
2122 int32_t z() const { return value_[2]; } | 2058 int32_t z() const { return value_[2]; } |
2123 int32_t w() const { return value_[3]; } | 2059 int32_t w() const { return value_[3]; } |
2124 }; | 2060 }; |
2125 COMPILE_ASSERT(sizeof(RawInt32x4) == 24); | 2061 COMPILE_ASSERT(sizeof(RawInt32x4) == 24); |
2126 | 2062 |
2127 | |
2128 class RawFloat64x2 : public RawInstance { | 2063 class RawFloat64x2 : public RawInstance { |
2129 RAW_HEAP_OBJECT_IMPLEMENTATION(Float64x2); | 2064 RAW_HEAP_OBJECT_IMPLEMENTATION(Float64x2); |
2130 | 2065 |
2131 ALIGN8 double value_[2]; | 2066 ALIGN8 double value_[2]; |
2132 | 2067 |
2133 friend class SnapshotReader; | 2068 friend class SnapshotReader; |
2134 | 2069 |
2135 public: | 2070 public: |
2136 double x() const { return value_[0]; } | 2071 double x() const { return value_[0]; } |
2137 double y() const { return value_[1]; } | 2072 double y() const { return value_[1]; } |
2138 }; | 2073 }; |
2139 COMPILE_ASSERT(sizeof(RawFloat64x2) == 24); | 2074 COMPILE_ASSERT(sizeof(RawFloat64x2) == 24); |
2140 | 2075 |
2141 | |
2142 // Define an aliases for intptr_t. | 2076 // Define an aliases for intptr_t. |
2143 #if defined(ARCH_IS_32_BIT) | 2077 #if defined(ARCH_IS_32_BIT) |
2144 #define kIntPtrCid kTypedDataInt32ArrayCid | 2078 #define kIntPtrCid kTypedDataInt32ArrayCid |
2145 #define SetIntPtr SetInt32 | 2079 #define SetIntPtr SetInt32 |
2146 #elif defined(ARCH_IS_64_BIT) | 2080 #elif defined(ARCH_IS_64_BIT) |
2147 #define kIntPtrCid kTypedDataInt64ArrayCid | 2081 #define kIntPtrCid kTypedDataInt64ArrayCid |
2148 #define SetIntPtr SetInt64 | 2082 #define SetIntPtr SetInt64 |
2149 #else | 2083 #else |
2150 #error Architecture is not 32-bit or 64-bit. | 2084 #error Architecture is not 32-bit or 64-bit. |
2151 #endif // ARCH_IS_32_BIT | 2085 #endif // ARCH_IS_32_BIT |
2152 | 2086 |
2153 | |
2154 class RawTypedData : public RawInstance { | 2087 class RawTypedData : public RawInstance { |
2155 RAW_HEAP_OBJECT_IMPLEMENTATION(TypedData); | 2088 RAW_HEAP_OBJECT_IMPLEMENTATION(TypedData); |
2156 | 2089 |
2157 protected: | 2090 protected: |
2158 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } | 2091 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } |
2159 RawSmi* length_; | 2092 RawSmi* length_; |
2160 // Variable length data follows here. | 2093 // Variable length data follows here. |
2161 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } | 2094 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } |
2162 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); } | 2095 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); } |
2163 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } | 2096 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } |
2164 | 2097 |
2165 friend class Api; | 2098 friend class Api; |
2166 friend class Object; | 2099 friend class Object; |
2167 friend class Instance; | 2100 friend class Instance; |
2168 friend class SnapshotReader; | 2101 friend class SnapshotReader; |
2169 friend class ObjectPool; | 2102 friend class ObjectPool; |
2170 friend class RawObjectPool; | 2103 friend class RawObjectPool; |
2171 friend class ObjectPoolSerializationCluster; | 2104 friend class ObjectPoolSerializationCluster; |
2172 friend class ObjectPoolDeserializationCluster; | 2105 friend class ObjectPoolDeserializationCluster; |
2173 }; | 2106 }; |
2174 | 2107 |
2175 | |
2176 class RawExternalTypedData : public RawInstance { | 2108 class RawExternalTypedData : public RawInstance { |
2177 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTypedData); | 2109 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTypedData); |
2178 | 2110 |
2179 protected: | 2111 protected: |
2180 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } | 2112 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } |
2181 RawSmi* length_; | 2113 RawSmi* length_; |
2182 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } | 2114 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } |
2183 | 2115 |
2184 uint8_t* data_; | 2116 uint8_t* data_; |
2185 | 2117 |
2186 friend class TokenStream; | 2118 friend class TokenStream; |
2187 friend class RawTokenStream; | 2119 friend class RawTokenStream; |
2188 }; | 2120 }; |
2189 | 2121 |
2190 // VM implementations of the basic types in the isolate. | 2122 // VM implementations of the basic types in the isolate. |
2191 class RawCapability : public RawInstance { | 2123 class RawCapability : public RawInstance { |
2192 RAW_HEAP_OBJECT_IMPLEMENTATION(Capability); | 2124 RAW_HEAP_OBJECT_IMPLEMENTATION(Capability); |
2193 uint64_t id_; | 2125 uint64_t id_; |
2194 }; | 2126 }; |
2195 | 2127 |
2196 | |
2197 class RawSendPort : public RawInstance { | 2128 class RawSendPort : public RawInstance { |
2198 RAW_HEAP_OBJECT_IMPLEMENTATION(SendPort); | 2129 RAW_HEAP_OBJECT_IMPLEMENTATION(SendPort); |
2199 Dart_Port id_; | 2130 Dart_Port id_; |
2200 Dart_Port origin_id_; | 2131 Dart_Port origin_id_; |
2201 | 2132 |
2202 friend class ReceivePort; | 2133 friend class ReceivePort; |
2203 }; | 2134 }; |
2204 | 2135 |
2205 | |
2206 class RawReceivePort : public RawInstance { | 2136 class RawReceivePort : public RawInstance { |
2207 RAW_HEAP_OBJECT_IMPLEMENTATION(ReceivePort); | 2137 RAW_HEAP_OBJECT_IMPLEMENTATION(ReceivePort); |
2208 | 2138 |
2209 RawObject** from() { | 2139 RawObject** from() { |
2210 return reinterpret_cast<RawObject**>(&ptr()->send_port_); | 2140 return reinterpret_cast<RawObject**>(&ptr()->send_port_); |
2211 } | 2141 } |
2212 RawSendPort* send_port_; | 2142 RawSendPort* send_port_; |
2213 RawInstance* handler_; | 2143 RawInstance* handler_; |
2214 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->handler_); } | 2144 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->handler_); } |
2215 }; | 2145 }; |
2216 | 2146 |
2217 | |
2218 // VM type for capturing stacktraces when exceptions are thrown, | 2147 // VM type for capturing stacktraces when exceptions are thrown, |
2219 // Currently we don't have any interface that this object is supposed | 2148 // Currently we don't have any interface that this object is supposed |
2220 // to implement so we just support the 'toString' method which | 2149 // to implement so we just support the 'toString' method which |
2221 // converts the stack trace into a string. | 2150 // converts the stack trace into a string. |
2222 class RawStackTrace : public RawInstance { | 2151 class RawStackTrace : public RawInstance { |
2223 RAW_HEAP_OBJECT_IMPLEMENTATION(StackTrace); | 2152 RAW_HEAP_OBJECT_IMPLEMENTATION(StackTrace); |
2224 | 2153 |
2225 RawObject** from() { | 2154 RawObject** from() { |
2226 return reinterpret_cast<RawObject**>(&ptr()->async_link_); | 2155 return reinterpret_cast<RawObject**>(&ptr()->async_link_); |
2227 } | 2156 } |
2228 RawStackTrace* async_link_; // Link to parent async stack trace. | 2157 RawStackTrace* async_link_; // Link to parent async stack trace. |
2229 RawArray* code_array_; // Code object for each frame in the stack trace. | 2158 RawArray* code_array_; // Code object for each frame in the stack trace. |
2230 RawArray* pc_offset_array_; // Offset of PC for each frame. | 2159 RawArray* pc_offset_array_; // Offset of PC for each frame. |
2231 RawObject** to() { | 2160 RawObject** to() { |
2232 return reinterpret_cast<RawObject**>(&ptr()->pc_offset_array_); | 2161 return reinterpret_cast<RawObject**>(&ptr()->pc_offset_array_); |
2233 } | 2162 } |
2234 // False for pre-allocated stack trace (used in OOM and Stack overflow). | 2163 // False for pre-allocated stack trace (used in OOM and Stack overflow). |
2235 bool expand_inlined_; | 2164 bool expand_inlined_; |
2236 }; | 2165 }; |
2237 | 2166 |
2238 | |
2239 // VM type for capturing JS regular expressions. | 2167 // VM type for capturing JS regular expressions. |
2240 class RawRegExp : public RawInstance { | 2168 class RawRegExp : public RawInstance { |
2241 RAW_HEAP_OBJECT_IMPLEMENTATION(RegExp); | 2169 RAW_HEAP_OBJECT_IMPLEMENTATION(RegExp); |
2242 | 2170 |
2243 RawObject** from() { | 2171 RawObject** from() { |
2244 return reinterpret_cast<RawObject**>(&ptr()->num_bracket_expressions_); | 2172 return reinterpret_cast<RawObject**>(&ptr()->num_bracket_expressions_); |
2245 } | 2173 } |
2246 RawSmi* num_bracket_expressions_; | 2174 RawSmi* num_bracket_expressions_; |
2247 RawString* pattern_; // Pattern to be used for matching. | 2175 RawString* pattern_; // Pattern to be used for matching. |
2248 union { | 2176 union { |
(...skipping 22 matching lines...) Expand all Loading... |
2271 } | 2199 } |
2272 | 2200 |
2273 intptr_t num_registers_; | 2201 intptr_t num_registers_; |
2274 | 2202 |
2275 // A bitfield with two fields: | 2203 // A bitfield with two fields: |
2276 // type: Uninitialized, simple or complex. | 2204 // type: Uninitialized, simple or complex. |
2277 // flags: Represents global/local, case insensitive, multiline. | 2205 // flags: Represents global/local, case insensitive, multiline. |
2278 int8_t type_flags_; | 2206 int8_t type_flags_; |
2279 }; | 2207 }; |
2280 | 2208 |
2281 | |
2282 class RawWeakProperty : public RawInstance { | 2209 class RawWeakProperty : public RawInstance { |
2283 RAW_HEAP_OBJECT_IMPLEMENTATION(WeakProperty); | 2210 RAW_HEAP_OBJECT_IMPLEMENTATION(WeakProperty); |
2284 | 2211 |
2285 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->key_); } | 2212 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->key_); } |
2286 RawObject* key_; | 2213 RawObject* key_; |
2287 RawObject* value_; | 2214 RawObject* value_; |
2288 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); } | 2215 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); } |
2289 | 2216 |
2290 // Linked list is chaining all pending weak properties. | 2217 // Linked list is chaining all pending weak properties. |
2291 // Untyped to make it clear that it is not to be visited by GC. | 2218 // Untyped to make it clear that it is not to be visited by GC. |
(...skipping 11 matching lines...) Expand all Loading... |
2303 class RawMirrorReference : public RawInstance { | 2230 class RawMirrorReference : public RawInstance { |
2304 RAW_HEAP_OBJECT_IMPLEMENTATION(MirrorReference); | 2231 RAW_HEAP_OBJECT_IMPLEMENTATION(MirrorReference); |
2305 | 2232 |
2306 RawObject** from() { | 2233 RawObject** from() { |
2307 return reinterpret_cast<RawObject**>(&ptr()->referent_); | 2234 return reinterpret_cast<RawObject**>(&ptr()->referent_); |
2308 } | 2235 } |
2309 RawObject* referent_; | 2236 RawObject* referent_; |
2310 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->referent_); } | 2237 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->referent_); } |
2311 }; | 2238 }; |
2312 | 2239 |
2313 | |
2314 // UserTag are used by the profiler to track Dart script state. | 2240 // UserTag are used by the profiler to track Dart script state. |
2315 class RawUserTag : public RawInstance { | 2241 class RawUserTag : public RawInstance { |
2316 RAW_HEAP_OBJECT_IMPLEMENTATION(UserTag); | 2242 RAW_HEAP_OBJECT_IMPLEMENTATION(UserTag); |
2317 | 2243 |
2318 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->label_); } | 2244 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->label_); } |
2319 | 2245 |
2320 RawString* label_; | 2246 RawString* label_; |
2321 | 2247 |
2322 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->label_); } | 2248 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->label_); } |
2323 | 2249 |
(...skipping 11 matching lines...) Expand all Loading... |
2335 | 2261 |
2336 inline bool RawObject::IsErrorClassId(intptr_t index) { | 2262 inline bool RawObject::IsErrorClassId(intptr_t index) { |
2337 // Make sure this function is updated when new Error types are added. | 2263 // Make sure this function is updated when new Error types are added. |
2338 COMPILE_ASSERT( | 2264 COMPILE_ASSERT( |
2339 kApiErrorCid == kErrorCid + 1 && kLanguageErrorCid == kErrorCid + 2 && | 2265 kApiErrorCid == kErrorCid + 1 && kLanguageErrorCid == kErrorCid + 2 && |
2340 kUnhandledExceptionCid == kErrorCid + 3 && | 2266 kUnhandledExceptionCid == kErrorCid + 3 && |
2341 kUnwindErrorCid == kErrorCid + 4 && kInstanceCid == kErrorCid + 5); | 2267 kUnwindErrorCid == kErrorCid + 4 && kInstanceCid == kErrorCid + 5); |
2342 return (index >= kErrorCid && index < kInstanceCid); | 2268 return (index >= kErrorCid && index < kInstanceCid); |
2343 } | 2269 } |
2344 | 2270 |
2345 | |
2346 inline bool RawObject::IsNumberClassId(intptr_t index) { | 2271 inline bool RawObject::IsNumberClassId(intptr_t index) { |
2347 // Make sure this function is updated when new Number types are added. | 2272 // Make sure this function is updated when new Number types are added. |
2348 COMPILE_ASSERT(kIntegerCid == kNumberCid + 1 && kSmiCid == kNumberCid + 2 && | 2273 COMPILE_ASSERT(kIntegerCid == kNumberCid + 1 && kSmiCid == kNumberCid + 2 && |
2349 kMintCid == kNumberCid + 3 && kBigintCid == kNumberCid + 4 && | 2274 kMintCid == kNumberCid + 3 && kBigintCid == kNumberCid + 4 && |
2350 kDoubleCid == kNumberCid + 5); | 2275 kDoubleCid == kNumberCid + 5); |
2351 return (index >= kNumberCid && index < kBoolCid); | 2276 return (index >= kNumberCid && index < kBoolCid); |
2352 } | 2277 } |
2353 | 2278 |
2354 | |
2355 inline bool RawObject::IsIntegerClassId(intptr_t index) { | 2279 inline bool RawObject::IsIntegerClassId(intptr_t index) { |
2356 // Make sure this function is updated when new Integer types are added. | 2280 // Make sure this function is updated when new Integer types are added. |
2357 COMPILE_ASSERT(kSmiCid == kIntegerCid + 1 && kMintCid == kIntegerCid + 2 && | 2281 COMPILE_ASSERT(kSmiCid == kIntegerCid + 1 && kMintCid == kIntegerCid + 2 && |
2358 kBigintCid == kIntegerCid + 3 && | 2282 kBigintCid == kIntegerCid + 3 && |
2359 kDoubleCid == kIntegerCid + 4); | 2283 kDoubleCid == kIntegerCid + 4); |
2360 return (index >= kIntegerCid && index < kDoubleCid); | 2284 return (index >= kIntegerCid && index < kDoubleCid); |
2361 } | 2285 } |
2362 | 2286 |
2363 | |
2364 inline bool RawObject::IsStringClassId(intptr_t index) { | 2287 inline bool RawObject::IsStringClassId(intptr_t index) { |
2365 // Make sure this function is updated when new StringCid types are added. | 2288 // Make sure this function is updated when new StringCid types are added. |
2366 COMPILE_ASSERT(kOneByteStringCid == kStringCid + 1 && | 2289 COMPILE_ASSERT(kOneByteStringCid == kStringCid + 1 && |
2367 kTwoByteStringCid == kStringCid + 2 && | 2290 kTwoByteStringCid == kStringCid + 2 && |
2368 kExternalOneByteStringCid == kStringCid + 3 && | 2291 kExternalOneByteStringCid == kStringCid + 3 && |
2369 kExternalTwoByteStringCid == kStringCid + 4); | 2292 kExternalTwoByteStringCid == kStringCid + 4); |
2370 return (index >= kStringCid && index <= kExternalTwoByteStringCid); | 2293 return (index >= kStringCid && index <= kExternalTwoByteStringCid); |
2371 } | 2294 } |
2372 | 2295 |
2373 | |
2374 inline bool RawObject::IsOneByteStringClassId(intptr_t index) { | 2296 inline bool RawObject::IsOneByteStringClassId(intptr_t index) { |
2375 // Make sure this function is updated when new StringCid types are added. | 2297 // Make sure this function is updated when new StringCid types are added. |
2376 COMPILE_ASSERT(kOneByteStringCid == kStringCid + 1 && | 2298 COMPILE_ASSERT(kOneByteStringCid == kStringCid + 1 && |
2377 kTwoByteStringCid == kStringCid + 2 && | 2299 kTwoByteStringCid == kStringCid + 2 && |
2378 kExternalOneByteStringCid == kStringCid + 3 && | 2300 kExternalOneByteStringCid == kStringCid + 3 && |
2379 kExternalTwoByteStringCid == kStringCid + 4); | 2301 kExternalTwoByteStringCid == kStringCid + 4); |
2380 return (index == kOneByteStringCid || index == kExternalOneByteStringCid); | 2302 return (index == kOneByteStringCid || index == kExternalOneByteStringCid); |
2381 } | 2303 } |
2382 | 2304 |
2383 | |
2384 inline bool RawObject::IsTwoByteStringClassId(intptr_t index) { | 2305 inline bool RawObject::IsTwoByteStringClassId(intptr_t index) { |
2385 // Make sure this function is updated when new StringCid types are added. | 2306 // Make sure this function is updated when new StringCid types are added. |
2386 COMPILE_ASSERT(kOneByteStringCid == kStringCid + 1 && | 2307 COMPILE_ASSERT(kOneByteStringCid == kStringCid + 1 && |
2387 kTwoByteStringCid == kStringCid + 2 && | 2308 kTwoByteStringCid == kStringCid + 2 && |
2388 kExternalOneByteStringCid == kStringCid + 3 && | 2309 kExternalOneByteStringCid == kStringCid + 3 && |
2389 kExternalTwoByteStringCid == kStringCid + 4); | 2310 kExternalTwoByteStringCid == kStringCid + 4); |
2390 return (index == kTwoByteStringCid || index == kExternalTwoByteStringCid); | 2311 return (index == kTwoByteStringCid || index == kExternalTwoByteStringCid); |
2391 } | 2312 } |
2392 | 2313 |
2393 | |
2394 inline bool RawObject::IsExternalStringClassId(intptr_t index) { | 2314 inline bool RawObject::IsExternalStringClassId(intptr_t index) { |
2395 // Make sure this function is updated when new StringCid types are added. | 2315 // Make sure this function is updated when new StringCid types are added. |
2396 COMPILE_ASSERT(kOneByteStringCid == kStringCid + 1 && | 2316 COMPILE_ASSERT(kOneByteStringCid == kStringCid + 1 && |
2397 kTwoByteStringCid == kStringCid + 2 && | 2317 kTwoByteStringCid == kStringCid + 2 && |
2398 kExternalOneByteStringCid == kStringCid + 3 && | 2318 kExternalOneByteStringCid == kStringCid + 3 && |
2399 kExternalTwoByteStringCid == kStringCid + 4); | 2319 kExternalTwoByteStringCid == kStringCid + 4); |
2400 return (index == kExternalOneByteStringCid || | 2320 return (index == kExternalOneByteStringCid || |
2401 index == kExternalTwoByteStringCid); | 2321 index == kExternalTwoByteStringCid); |
2402 } | 2322 } |
2403 | 2323 |
2404 | |
2405 inline bool RawObject::IsBuiltinListClassId(intptr_t index) { | 2324 inline bool RawObject::IsBuiltinListClassId(intptr_t index) { |
2406 // Make sure this function is updated when new builtin List types are added. | 2325 // Make sure this function is updated when new builtin List types are added. |
2407 COMPILE_ASSERT(kImmutableArrayCid == kArrayCid + 1); | 2326 COMPILE_ASSERT(kImmutableArrayCid == kArrayCid + 1); |
2408 return ((index >= kArrayCid && index <= kImmutableArrayCid) || | 2327 return ((index >= kArrayCid && index <= kImmutableArrayCid) || |
2409 (index == kGrowableObjectArrayCid) || IsTypedDataClassId(index) || | 2328 (index == kGrowableObjectArrayCid) || IsTypedDataClassId(index) || |
2410 IsTypedDataViewClassId(index) || IsExternalTypedDataClassId(index) || | 2329 IsTypedDataViewClassId(index) || IsExternalTypedDataClassId(index) || |
2411 (index == kByteBufferCid)); | 2330 (index == kByteBufferCid)); |
2412 } | 2331 } |
2413 | 2332 |
2414 | |
2415 inline bool RawObject::IsTypedDataClassId(intptr_t index) { | 2333 inline bool RawObject::IsTypedDataClassId(intptr_t index) { |
2416 // Make sure this is updated when new TypedData types are added. | 2334 // Make sure this is updated when new TypedData types are added. |
2417 COMPILE_ASSERT(kTypedDataUint8ArrayCid == kTypedDataInt8ArrayCid + 1 && | 2335 COMPILE_ASSERT(kTypedDataUint8ArrayCid == kTypedDataInt8ArrayCid + 1 && |
2418 kTypedDataUint8ClampedArrayCid == kTypedDataInt8ArrayCid + 2 && | 2336 kTypedDataUint8ClampedArrayCid == kTypedDataInt8ArrayCid + 2 && |
2419 kTypedDataInt16ArrayCid == kTypedDataInt8ArrayCid + 3 && | 2337 kTypedDataInt16ArrayCid == kTypedDataInt8ArrayCid + 3 && |
2420 kTypedDataUint16ArrayCid == kTypedDataInt8ArrayCid + 4 && | 2338 kTypedDataUint16ArrayCid == kTypedDataInt8ArrayCid + 4 && |
2421 kTypedDataInt32ArrayCid == kTypedDataInt8ArrayCid + 5 && | 2339 kTypedDataInt32ArrayCid == kTypedDataInt8ArrayCid + 5 && |
2422 kTypedDataUint32ArrayCid == kTypedDataInt8ArrayCid + 6 && | 2340 kTypedDataUint32ArrayCid == kTypedDataInt8ArrayCid + 6 && |
2423 kTypedDataInt64ArrayCid == kTypedDataInt8ArrayCid + 7 && | 2341 kTypedDataInt64ArrayCid == kTypedDataInt8ArrayCid + 7 && |
2424 kTypedDataUint64ArrayCid == kTypedDataInt8ArrayCid + 8 && | 2342 kTypedDataUint64ArrayCid == kTypedDataInt8ArrayCid + 8 && |
2425 kTypedDataFloat32ArrayCid == kTypedDataInt8ArrayCid + 9 && | 2343 kTypedDataFloat32ArrayCid == kTypedDataInt8ArrayCid + 9 && |
2426 kTypedDataFloat64ArrayCid == kTypedDataInt8ArrayCid + 10 && | 2344 kTypedDataFloat64ArrayCid == kTypedDataInt8ArrayCid + 10 && |
2427 kTypedDataFloat32x4ArrayCid == kTypedDataInt8ArrayCid + 11 && | 2345 kTypedDataFloat32x4ArrayCid == kTypedDataInt8ArrayCid + 11 && |
2428 kTypedDataInt32x4ArrayCid == kTypedDataInt8ArrayCid + 12 && | 2346 kTypedDataInt32x4ArrayCid == kTypedDataInt8ArrayCid + 12 && |
2429 kTypedDataFloat64x2ArrayCid == kTypedDataInt8ArrayCid + 13 && | 2347 kTypedDataFloat64x2ArrayCid == kTypedDataInt8ArrayCid + 13 && |
2430 kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); | 2348 kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); |
2431 return (index >= kTypedDataInt8ArrayCid && | 2349 return (index >= kTypedDataInt8ArrayCid && |
2432 index <= kTypedDataFloat64x2ArrayCid); | 2350 index <= kTypedDataFloat64x2ArrayCid); |
2433 } | 2351 } |
2434 | 2352 |
2435 | |
2436 inline bool RawObject::IsTypedDataViewClassId(intptr_t index) { | 2353 inline bool RawObject::IsTypedDataViewClassId(intptr_t index) { |
2437 // Make sure this is updated when new TypedData types are added. | 2354 // Make sure this is updated when new TypedData types are added. |
2438 COMPILE_ASSERT( | 2355 COMPILE_ASSERT( |
2439 kTypedDataUint8ArrayViewCid == kTypedDataInt8ArrayViewCid + 1 && | 2356 kTypedDataUint8ArrayViewCid == kTypedDataInt8ArrayViewCid + 1 && |
2440 kTypedDataUint8ClampedArrayViewCid == kTypedDataInt8ArrayViewCid + 2 && | 2357 kTypedDataUint8ClampedArrayViewCid == kTypedDataInt8ArrayViewCid + 2 && |
2441 kTypedDataInt16ArrayViewCid == kTypedDataInt8ArrayViewCid + 3 && | 2358 kTypedDataInt16ArrayViewCid == kTypedDataInt8ArrayViewCid + 3 && |
2442 kTypedDataUint16ArrayViewCid == kTypedDataInt8ArrayViewCid + 4 && | 2359 kTypedDataUint16ArrayViewCid == kTypedDataInt8ArrayViewCid + 4 && |
2443 kTypedDataInt32ArrayViewCid == kTypedDataInt8ArrayViewCid + 5 && | 2360 kTypedDataInt32ArrayViewCid == kTypedDataInt8ArrayViewCid + 5 && |
2444 kTypedDataUint32ArrayViewCid == kTypedDataInt8ArrayViewCid + 6 && | 2361 kTypedDataUint32ArrayViewCid == kTypedDataInt8ArrayViewCid + 6 && |
2445 kTypedDataInt64ArrayViewCid == kTypedDataInt8ArrayViewCid + 7 && | 2362 kTypedDataInt64ArrayViewCid == kTypedDataInt8ArrayViewCid + 7 && |
2446 kTypedDataUint64ArrayViewCid == kTypedDataInt8ArrayViewCid + 8 && | 2363 kTypedDataUint64ArrayViewCid == kTypedDataInt8ArrayViewCid + 8 && |
2447 kTypedDataFloat32ArrayViewCid == kTypedDataInt8ArrayViewCid + 9 && | 2364 kTypedDataFloat32ArrayViewCid == kTypedDataInt8ArrayViewCid + 9 && |
2448 kTypedDataFloat64ArrayViewCid == kTypedDataInt8ArrayViewCid + 10 && | 2365 kTypedDataFloat64ArrayViewCid == kTypedDataInt8ArrayViewCid + 10 && |
2449 kTypedDataFloat32x4ArrayViewCid == kTypedDataInt8ArrayViewCid + 11 && | 2366 kTypedDataFloat32x4ArrayViewCid == kTypedDataInt8ArrayViewCid + 11 && |
2450 kTypedDataInt32x4ArrayViewCid == kTypedDataInt8ArrayViewCid + 12 && | 2367 kTypedDataInt32x4ArrayViewCid == kTypedDataInt8ArrayViewCid + 12 && |
2451 kTypedDataFloat64x2ArrayViewCid == kTypedDataInt8ArrayViewCid + 13 && | 2368 kTypedDataFloat64x2ArrayViewCid == kTypedDataInt8ArrayViewCid + 13 && |
2452 kByteDataViewCid == kTypedDataInt8ArrayViewCid + 14 && | 2369 kByteDataViewCid == kTypedDataInt8ArrayViewCid + 14 && |
2453 kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 15); | 2370 kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 15); |
2454 return (index >= kTypedDataInt8ArrayViewCid && index <= kByteDataViewCid); | 2371 return (index >= kTypedDataInt8ArrayViewCid && index <= kByteDataViewCid); |
2455 } | 2372 } |
2456 | 2373 |
2457 | |
2458 inline bool RawObject::IsExternalTypedDataClassId(intptr_t index) { | 2374 inline bool RawObject::IsExternalTypedDataClassId(intptr_t index) { |
2459 // Make sure this is updated when new ExternalTypedData types are added. | 2375 // Make sure this is updated when new ExternalTypedData types are added. |
2460 COMPILE_ASSERT( | 2376 COMPILE_ASSERT( |
2461 (kExternalTypedDataUint8ArrayCid == kExternalTypedDataInt8ArrayCid + 1) && | 2377 (kExternalTypedDataUint8ArrayCid == kExternalTypedDataInt8ArrayCid + 1) && |
2462 (kExternalTypedDataUint8ClampedArrayCid == | 2378 (kExternalTypedDataUint8ClampedArrayCid == |
2463 kExternalTypedDataInt8ArrayCid + 2) && | 2379 kExternalTypedDataInt8ArrayCid + 2) && |
2464 (kExternalTypedDataInt16ArrayCid == kExternalTypedDataInt8ArrayCid + 3) && | 2380 (kExternalTypedDataInt16ArrayCid == kExternalTypedDataInt8ArrayCid + 3) && |
2465 (kExternalTypedDataUint16ArrayCid == | 2381 (kExternalTypedDataUint16ArrayCid == |
2466 kExternalTypedDataInt8ArrayCid + 4) && | 2382 kExternalTypedDataInt8ArrayCid + 4) && |
2467 (kExternalTypedDataInt32ArrayCid == kExternalTypedDataInt8ArrayCid + 5) && | 2383 (kExternalTypedDataInt32ArrayCid == kExternalTypedDataInt8ArrayCid + 5) && |
(...skipping 10 matching lines...) Expand all Loading... |
2478 kExternalTypedDataInt8ArrayCid + 11) && | 2394 kExternalTypedDataInt8ArrayCid + 11) && |
2479 (kExternalTypedDataInt32x4ArrayCid == | 2395 (kExternalTypedDataInt32x4ArrayCid == |
2480 kExternalTypedDataInt8ArrayCid + 12) && | 2396 kExternalTypedDataInt8ArrayCid + 12) && |
2481 (kExternalTypedDataFloat64x2ArrayCid == | 2397 (kExternalTypedDataFloat64x2ArrayCid == |
2482 kExternalTypedDataInt8ArrayCid + 13) && | 2398 kExternalTypedDataInt8ArrayCid + 13) && |
2483 (kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14)); | 2399 (kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14)); |
2484 return (index >= kExternalTypedDataInt8ArrayCid && | 2400 return (index >= kExternalTypedDataInt8ArrayCid && |
2485 index <= kExternalTypedDataFloat64x2ArrayCid); | 2401 index <= kExternalTypedDataFloat64x2ArrayCid); |
2486 } | 2402 } |
2487 | 2403 |
2488 | |
2489 inline bool RawObject::IsInternalVMdefinedClassId(intptr_t index) { | 2404 inline bool RawObject::IsInternalVMdefinedClassId(intptr_t index) { |
2490 return ((index < kNumPredefinedCids) && | 2405 return ((index < kNumPredefinedCids) && |
2491 !RawObject::IsImplicitFieldClassId(index)); | 2406 !RawObject::IsImplicitFieldClassId(index)); |
2492 } | 2407 } |
2493 | 2408 |
2494 | |
2495 inline bool RawObject::IsVariableSizeClassId(intptr_t index) { | 2409 inline bool RawObject::IsVariableSizeClassId(intptr_t index) { |
2496 return (index == kArrayCid) || (index == kImmutableArrayCid) || | 2410 return (index == kArrayCid) || (index == kImmutableArrayCid) || |
2497 RawObject::IsOneByteStringClassId(index) || | 2411 RawObject::IsOneByteStringClassId(index) || |
2498 RawObject::IsTwoByteStringClassId(index) || | 2412 RawObject::IsTwoByteStringClassId(index) || |
2499 RawObject::IsTypedDataClassId(index) || (index == kContextCid) || | 2413 RawObject::IsTypedDataClassId(index) || (index == kContextCid) || |
2500 (index == kTypeArgumentsCid) || (index == kInstructionsCid) || | 2414 (index == kTypeArgumentsCid) || (index == kInstructionsCid) || |
2501 (index == kObjectPoolCid) || (index == kPcDescriptorsCid) || | 2415 (index == kObjectPoolCid) || (index == kPcDescriptorsCid) || |
2502 (index == kCodeSourceMapCid) || (index == kStackMapCid) || | 2416 (index == kCodeSourceMapCid) || (index == kStackMapCid) || |
2503 (index == kLocalVarDescriptorsCid) || | 2417 (index == kLocalVarDescriptorsCid) || |
2504 (index == kExceptionHandlersCid) || (index == kCodeCid) || | 2418 (index == kExceptionHandlersCid) || (index == kCodeCid) || |
2505 (index == kContextScopeCid) || (index == kInstanceCid) || | 2419 (index == kContextScopeCid) || (index == kInstanceCid) || |
2506 (index == kRegExpCid); | 2420 (index == kRegExpCid); |
2507 } | 2421 } |
2508 | 2422 |
2509 | |
2510 // This is a set of classes that are not Dart classes whose representation | 2423 // This is a set of classes that are not Dart classes whose representation |
2511 // is defined by the VM but are used in the VM code by computing the | 2424 // is defined by the VM but are used in the VM code by computing the |
2512 // implicit field offsets of the various fields in the dart object. | 2425 // implicit field offsets of the various fields in the dart object. |
2513 inline bool RawObject::IsImplicitFieldClassId(intptr_t index) { | 2426 inline bool RawObject::IsImplicitFieldClassId(intptr_t index) { |
2514 return (IsTypedDataViewClassId(index) || index == kByteBufferCid); | 2427 return (IsTypedDataViewClassId(index) || index == kByteBufferCid); |
2515 } | 2428 } |
2516 | 2429 |
2517 | |
2518 inline intptr_t RawObject::NumberOfTypedDataClasses() { | 2430 inline intptr_t RawObject::NumberOfTypedDataClasses() { |
2519 // Make sure this is updated when new TypedData types are added. | 2431 // Make sure this is updated when new TypedData types are added. |
2520 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); | 2432 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); |
2521 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2433 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
2522 kTypedDataInt8ArrayViewCid + 15); | 2434 kTypedDataInt8ArrayViewCid + 15); |
2523 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2435 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
2524 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2436 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
2525 return (kNullCid - kTypedDataInt8ArrayCid); | 2437 return (kNullCid - kTypedDataInt8ArrayCid); |
2526 } | 2438 } |
2527 | 2439 |
2528 | |
2529 } // namespace dart | 2440 } // namespace dart |
2530 | 2441 |
2531 #endif // RUNTIME_VM_RAW_OBJECT_H_ | 2442 #endif // RUNTIME_VM_RAW_OBJECT_H_ |
OLD | NEW |