Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1199)

Side by Side Diff: runtime/vm/raw_object.h

Issue 2032153003: Use clustered serialization for full snapshots. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: . Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_RAW_OBJECT_H_ 5 #ifndef VM_RAW_OBJECT_H_
6 #define VM_RAW_OBJECT_H_ 6 #define VM_RAW_OBJECT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/atomic.h" 9 #include "vm/atomic.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 VerifiedMemory::Write(const_cast<RawSmi**>(addr), value); 602 VerifiedMemory::Write(const_cast<RawSmi**>(addr), value);
603 } 603 }
604 604
605 #if defined(DEBUG) 605 #if defined(DEBUG)
606 static void ValidateOverwrittenPointer(RawObject* raw); 606 static void ValidateOverwrittenPointer(RawObject* raw);
607 static void ValidateOverwrittenSmi(RawSmi* raw); 607 static void ValidateOverwrittenSmi(RawSmi* raw);
608 #endif // DEBUG 608 #endif // DEBUG
609 609
610 friend class Api; 610 friend class Api;
611 friend class ApiMessageReader; // GetClassId 611 friend class ApiMessageReader; // GetClassId
612 friend class Serializer; // GetClassId
612 friend class Array; 613 friend class Array;
613 friend class Bigint; 614 friend class Bigint;
614 friend class ByteBuffer; 615 friend class ByteBuffer;
615 friend class Closure; 616 friend class Closure;
616 friend class Code; 617 friend class Code;
617 friend class Double; 618 friend class Double;
618 friend class ForwardPointersVisitor; // StorePointer 619 friend class ForwardPointersVisitor; // StorePointer
619 friend class FreeListElement; 620 friend class FreeListElement;
620 friend class Function; 621 friend class Function;
621 friend class GCMarker; 622 friend class GCMarker;
(...skipping 15 matching lines...) Expand all
637 friend class Scavenger; 638 friend class Scavenger;
638 friend class ScavengerVisitor; 639 friend class ScavengerVisitor;
639 friend class SizeExcludingClassVisitor; // GetClassId 640 friend class SizeExcludingClassVisitor; // GetClassId
640 friend class InstanceAccumulator; // GetClassId 641 friend class InstanceAccumulator; // GetClassId
641 friend class RetainingPathVisitor; // GetClassId 642 friend class RetainingPathVisitor; // GetClassId
642 friend class SkippedCodeFunctions; // StorePointer 643 friend class SkippedCodeFunctions; // StorePointer
643 friend class InstructionsReader; // tags_ check 644 friend class InstructionsReader; // tags_ check
644 friend class AssemblyInstructionsWriter; 645 friend class AssemblyInstructionsWriter;
645 friend class BlobInstructionsWriter; 646 friend class BlobInstructionsWriter;
646 friend class SnapshotReader; 647 friend class SnapshotReader;
648 friend class Deserializer;
647 friend class SnapshotWriter; 649 friend class SnapshotWriter;
648 friend class String; 650 friend class String;
649 friend class Type; // GetClassId 651 friend class Type; // GetClassId
650 friend class TypedData; 652 friend class TypedData;
651 friend class TypedDataView; 653 friend class TypedDataView;
652 friend class WeakProperty; // StorePointer 654 friend class WeakProperty; // StorePointer
653 friend class Instance; // StorePointer 655 friend class Instance; // StorePointer
654 friend class StackFrame; // GetCodeObject assertion. 656 friend class StackFrame; // GetCodeObject assertion.
655 friend class CodeLookupTableBuilder; // profiler 657 friend class CodeLookupTableBuilder; // profiler
656 friend class NativeEntry; // GetClassId 658 friend class NativeEntry; // GetClassId
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 int16_t num_own_type_arguments_; // Number of non-overlapping type arguments. 725 int16_t num_own_type_arguments_; // Number of non-overlapping type arguments.
724 uint16_t num_native_fields_; // Number of native fields in class. 726 uint16_t num_native_fields_; // Number of native fields in class.
725 uint16_t state_bits_; 727 uint16_t state_bits_;
726 728
727 friend class Instance; 729 friend class Instance;
728 friend class Isolate; 730 friend class Isolate;
729 friend class Object; 731 friend class Object;
730 friend class RawInstance; 732 friend class RawInstance;
731 friend class RawInstructions; 733 friend class RawInstructions;
732 friend class SnapshotReader; 734 friend class SnapshotReader;
735 friend class ClassSerializationCluster;
736 friend class ClassDeserializationCluster;
737 friend class InstanceSerializationCluster;
733 }; 738 };
734 739
735 740
736 class RawUnresolvedClass : public RawObject { 741 class RawUnresolvedClass : public RawObject {
737 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); 742 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass);
738 743
739 RawObject** from() { 744 RawObject** from() {
740 return reinterpret_cast<RawObject**>(&ptr()->library_prefix_); 745 return reinterpret_cast<RawObject**>(&ptr()->library_prefix_);
741 } 746 }
742 RawLibraryPrefix* library_prefix_; // Library prefix qualifier for the ident. 747 RawLibraryPrefix* library_prefix_; // Library prefix qualifier for the ident.
743 RawString* ident_; // Name of the unresolved identifier. 748 RawString* ident_; // Name of the unresolved identifier.
744 RawObject** to() { 749 RawObject** to() {
745 return reinterpret_cast<RawObject**>(&ptr()->ident_); 750 return reinterpret_cast<RawObject**>(&ptr()->ident_);
746 } 751 }
747 TokenPosition token_pos_; 752 TokenPosition token_pos_;
753
754 friend class UnresolvedClassSerializationCluster;
Florian Schneider 2016/06/14 20:32:20 Have you tried making these friend declarations pa
rmacnak 2016/06/21 17:53:03 Done.
755 friend class UnresolvedClassDeserializationCluster;
748 }; 756 };
749 757
750 758
751 class RawTypeArguments : public RawObject { 759 class RawTypeArguments : public RawObject {
752 private: 760 private:
753 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeArguments); 761 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeArguments);
754 762
755 RawObject** from() { 763 RawObject** from() {
756 return reinterpret_cast<RawObject**>(&ptr()->instantiations_); 764 return reinterpret_cast<RawObject**>(&ptr()->instantiations_);
757 } 765 }
(...skipping 11 matching lines...) Expand all
769 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*); 777 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*);
770 } 778 }
771 RawAbstractType** types() { 779 RawAbstractType** types() {
772 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*); 780 OPEN_ARRAY_START(RawAbstractType*, RawAbstractType*);
773 } 781 }
774 RawObject** to(intptr_t length) { 782 RawObject** to(intptr_t length) {
775 return reinterpret_cast<RawObject**>(&ptr()->types()[length - 1]); 783 return reinterpret_cast<RawObject**>(&ptr()->types()[length - 1]);
776 } 784 }
777 785
778 friend class SnapshotReader; 786 friend class SnapshotReader;
787 friend class TypeArgumentsSerializationCluster;
788 friend class TypeArgumentsDeserializationCluster;
779 }; 789 };
780 790
781 791
782 class RawPatchClass : public RawObject { 792 class RawPatchClass : public RawObject {
783 private: 793 private:
784 RAW_HEAP_OBJECT_IMPLEMENTATION(PatchClass); 794 RAW_HEAP_OBJECT_IMPLEMENTATION(PatchClass);
785 795
786 RawObject** from() { 796 RawObject** from() {
787 return reinterpret_cast<RawObject**>(&ptr()->patched_class_); 797 return reinterpret_cast<RawObject**>(&ptr()->patched_class_);
788 } 798 }
789 RawClass* patched_class_; 799 RawClass* patched_class_;
790 RawClass* origin_class_; 800 RawClass* origin_class_;
791 RawScript* script_; 801 RawScript* script_;
792 RawObject** to() { 802 RawObject** to() {
793 return reinterpret_cast<RawObject**>(&ptr()->script_); 803 return reinterpret_cast<RawObject**>(&ptr()->script_);
794 } 804 }
795 805
796 friend class Function; 806 friend class Function;
807 friend class PatchClassSerializationCluster;
808 friend class PatchClassDeserializationCluster;
797 }; 809 };
798 810
799 811
800 class RawFunction : public RawObject { 812 class RawFunction : public RawObject {
801 public: 813 public:
802 enum Kind { 814 enum Kind {
803 kRegularFunction, 815 kRegularFunction,
804 kClosureFunction, 816 kClosureFunction,
805 kSignatureFunction, // represents a signature only without actual code. 817 kSignatureFunction, // represents a signature only without actual code.
806 kGetterFunction, // represents getter functions e.g: get foo() { .. }. 818 kGetterFunction, // represents getter functions e.g: get foo() { .. }.
(...skipping 15 matching lines...) Expand all
822 kGeneratorBit = 0x2, 834 kGeneratorBit = 0x2,
823 kAsync = kAsyncBit, 835 kAsync = kAsyncBit,
824 kSyncGen = kGeneratorBit, 836 kSyncGen = kGeneratorBit,
825 kAsyncGen = kAsyncBit | kGeneratorBit, 837 kAsyncGen = kAsyncBit | kGeneratorBit,
826 }; 838 };
827 839
828 private: 840 private:
829 // So that the SkippedCodeFunctions::DetachCode can null out the code fields. 841 // So that the SkippedCodeFunctions::DetachCode can null out the code fields.
830 friend class SkippedCodeFunctions; 842 friend class SkippedCodeFunctions;
831 friend class Class; 843 friend class Class;
844 friend class FunctionSerializationCluster;
845 friend class FunctionDeserializationCluster;
846
832 RAW_HEAP_OBJECT_IMPLEMENTATION(Function); 847 RAW_HEAP_OBJECT_IMPLEMENTATION(Function);
848
833 static bool ShouldVisitCode(RawCode* raw_code); 849 static bool ShouldVisitCode(RawCode* raw_code);
834 static bool CheckUsageCounter(RawFunction* raw_fun); 850 static bool CheckUsageCounter(RawFunction* raw_fun);
835 851
836 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } 852 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
837 RawString* name_; 853 RawString* name_;
838 RawObject* owner_; // Class or patch class or mixin class 854 RawObject* owner_; // Class or patch class or mixin class
839 // where this function is defined. 855 // where this function is defined.
840 RawAbstractType* result_type_; 856 RawAbstractType* result_type_;
841 RawArray* parameter_types_; 857 RawArray* parameter_types_;
842 RawArray* parameter_names_; 858 RawArray* parameter_names_;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 } 893 }
878 RawContextScope* context_scope_; 894 RawContextScope* context_scope_;
879 RawFunction* parent_function_; // Enclosing function of this local function. 895 RawFunction* parent_function_; // Enclosing function of this local function.
880 RawType* signature_type_; 896 RawType* signature_type_;
881 RawInstance* closure_; // Closure object for static implicit closures. 897 RawInstance* closure_; // Closure object for static implicit closures.
882 RawObject** to() { 898 RawObject** to() {
883 return reinterpret_cast<RawObject**>(&ptr()->closure_); 899 return reinterpret_cast<RawObject**>(&ptr()->closure_);
884 } 900 }
885 901
886 friend class Function; 902 friend class Function;
903 friend class ClosureDataSerializationCluster;
904 friend class ClosureDataDeserializationCluster;
887 }; 905 };
888 906
889 907
890 class RawRedirectionData : public RawObject { 908 class RawRedirectionData : public RawObject {
891 private: 909 private:
892 RAW_HEAP_OBJECT_IMPLEMENTATION(RedirectionData); 910 RAW_HEAP_OBJECT_IMPLEMENTATION(RedirectionData);
893 911
894 RawObject** from() { 912 RawObject** from() {
895 return reinterpret_cast<RawObject**>(&ptr()->type_); 913 return reinterpret_cast<RawObject**>(&ptr()->type_);
896 } 914 }
897 RawType* type_; 915 RawType* type_;
898 RawString* identifier_; 916 RawString* identifier_;
899 RawFunction* target_; 917 RawFunction* target_;
900 RawObject** to() { 918 RawObject** to() {
901 return reinterpret_cast<RawObject**>(&ptr()->target_); 919 return reinterpret_cast<RawObject**>(&ptr()->target_);
902 } 920 }
921
922 friend class RedirectionDataSerializationCluster;
923 friend class RedirectionDataDeserializationCluster;
903 }; 924 };
904 925
905 926
906 class RawField : public RawObject { 927 class RawField : public RawObject {
907 RAW_HEAP_OBJECT_IMPLEMENTATION(Field); 928 RAW_HEAP_OBJECT_IMPLEMENTATION(Field);
908 929
909 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } 930 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
910 RawString* name_; 931 RawString* name_;
911 RawObject* owner_; // Class or patch class or mixin class 932 RawObject* owner_; // Class or patch class or mixin class
912 // where this field is defined or original field. 933 // where this field is defined or original field.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 TokenPosition token_pos_; 970 TokenPosition token_pos_;
950 classid_t guarded_cid_; 971 classid_t guarded_cid_;
951 classid_t is_nullable_; // kNullCid if field can contain null value and 972 classid_t is_nullable_; // kNullCid if field can contain null value and
952 // any other value otherwise. 973 // any other value otherwise.
953 // Offset to the guarded length field inside an instance of class matching 974 // Offset to the guarded length field inside an instance of class matching
954 // guarded_cid_. Stored corrected by -kHeapObjectTag to simplify code 975 // guarded_cid_. Stored corrected by -kHeapObjectTag to simplify code
955 // generated on platforms with weak addressing modes (ARM, MIPS). 976 // generated on platforms with weak addressing modes (ARM, MIPS).
956 int8_t guarded_list_length_in_object_offset_; 977 int8_t guarded_list_length_in_object_offset_;
957 978
958 uint8_t kind_bits_; // static, final, const, has initializer.... 979 uint8_t kind_bits_; // static, final, const, has initializer....
980
981 friend class FieldSerializationCluster;
982 friend class FieldDeserializationCluster;
959 }; 983 };
960 984
961 985
962 class RawLiteralToken : public RawObject { 986 class RawLiteralToken : public RawObject {
963 RAW_HEAP_OBJECT_IMPLEMENTATION(LiteralToken); 987 RAW_HEAP_OBJECT_IMPLEMENTATION(LiteralToken);
964 988
965 RawObject** from() { 989 RawObject** from() {
966 return reinterpret_cast<RawObject**>(&ptr()->literal_); 990 return reinterpret_cast<RawObject**>(&ptr()->literal_);
967 } 991 }
968 RawString* literal_; // Literal characters as they appear in source text. 992 RawString* literal_; // Literal characters as they appear in source text.
969 RawObject* value_; // The actual object corresponding to the token. 993 RawObject* value_; // The actual object corresponding to the token.
970 RawObject** to() { 994 RawObject** to() {
971 return reinterpret_cast<RawObject**>(&ptr()->value_); 995 return reinterpret_cast<RawObject**>(&ptr()->value_);
972 } 996 }
973 Token::Kind kind_; // The literal kind (string, integer, double). 997 Token::Kind kind_; // The literal kind (string, integer, double).
974 998
975 friend class SnapshotReader; 999 friend class SnapshotReader;
1000 friend class LiteralTokenSerializationCluster;
1001 friend class LiteralTokenDeserializationCluster;
976 }; 1002 };
977 1003
978 1004
979 class RawTokenStream : public RawObject { 1005 class RawTokenStream : public RawObject {
980 RAW_HEAP_OBJECT_IMPLEMENTATION(TokenStream); 1006 RAW_HEAP_OBJECT_IMPLEMENTATION(TokenStream);
981 1007
982 RawObject** from() { 1008 RawObject** from() {
983 return reinterpret_cast<RawObject**>(&ptr()->private_key_); 1009 return reinterpret_cast<RawObject**>(&ptr()->private_key_);
984 } 1010 }
985 RawString* private_key_; // Key used for private identifiers. 1011 RawString* private_key_; // Key used for private identifiers.
986 RawGrowableObjectArray* token_objects_; 1012 RawGrowableObjectArray* token_objects_;
987 RawExternalTypedData* stream_; 1013 RawExternalTypedData* stream_;
988 RawObject** to() { 1014 RawObject** to() {
989 return reinterpret_cast<RawObject**>(&ptr()->stream_); 1015 return reinterpret_cast<RawObject**>(&ptr()->stream_);
990 } 1016 }
991 1017
992 friend class SnapshotReader; 1018 friend class SnapshotReader;
1019 friend class TokenStreamSerializationCluster;
1020 friend class TokenStreamDeserializationCluster;
993 }; 1021 };
994 1022
995 1023
996 class RawScript : public RawObject { 1024 class RawScript : public RawObject {
997 public: 1025 public:
998 enum Kind { 1026 enum Kind {
999 kScriptTag = 0, 1027 kScriptTag = 0,
1000 kLibraryTag, 1028 kLibraryTag,
1001 kSourceTag, 1029 kSourceTag,
1002 kPatchTag, 1030 kPatchTag,
(...skipping 22 matching lines...) Expand all
1025 break; 1053 break;
1026 } 1054 }
1027 UNREACHABLE(); 1055 UNREACHABLE();
1028 return NULL; 1056 return NULL;
1029 } 1057 }
1030 1058
1031 int32_t line_offset_; 1059 int32_t line_offset_;
1032 int32_t col_offset_; 1060 int32_t col_offset_;
1033 int8_t kind_; // Of type Kind. 1061 int8_t kind_; // Of type Kind.
1034 int64_t load_timestamp_; 1062 int64_t load_timestamp_;
1063
1064 friend class ScriptSerializationCluster;
1065 friend class ScriptDeserializationCluster;
1035 }; 1066 };
1036 1067
1037 1068
1038 class RawLibrary : public RawObject { 1069 class RawLibrary : public RawObject {
1039 enum LibraryState { 1070 enum LibraryState {
1040 kAllocated, // Initial state. 1071 kAllocated, // Initial state.
1041 kLoadRequested, // Compiler or script requested load of library. 1072 kLoadRequested, // Compiler or script requested load of library.
1042 kLoadInProgress, // Library is in the process of being loaded. 1073 kLoadInProgress, // Library is in the process of being loaded.
1043 kLoaded, // Library is loaded. 1074 kLoaded, // Library is loaded.
1044 kLoadError, // Error occurred during load of the Library. 1075 kLoadError, // Error occurred during load of the Library.
(...skipping 27 matching lines...) Expand all
1072 classid_t index_; // Library id number. 1103 classid_t index_; // Library id number.
1073 uint16_t num_imports_; // Number of entries in imports_. 1104 uint16_t num_imports_; // Number of entries in imports_.
1074 int8_t load_state_; // Of type LibraryState. 1105 int8_t load_state_; // Of type LibraryState.
1075 bool corelib_imported_; 1106 bool corelib_imported_;
1076 bool is_dart_scheme_; 1107 bool is_dart_scheme_;
1077 bool debuggable_; // True if debugger can stop in library. 1108 bool debuggable_; // True if debugger can stop in library.
1078 bool is_in_fullsnapshot_; // True if library is in a full snapshot. 1109 bool is_in_fullsnapshot_; // True if library is in a full snapshot.
1079 1110
1080 friend class Class; 1111 friend class Class;
1081 friend class Isolate; 1112 friend class Isolate;
1113 friend class LibrarySerializationCluster;
1114 friend class LibraryDeserializationCluster;
1082 }; 1115 };
1083 1116
1084 1117
1085 class RawNamespace : public RawObject { 1118 class RawNamespace : public RawObject {
1086 RAW_HEAP_OBJECT_IMPLEMENTATION(Namespace); 1119 RAW_HEAP_OBJECT_IMPLEMENTATION(Namespace);
1087 1120
1088 RawObject** from() { 1121 RawObject** from() {
1089 return reinterpret_cast<RawObject**>(&ptr()->library_); 1122 return reinterpret_cast<RawObject**>(&ptr()->library_);
1090 } 1123 }
1091 RawLibrary* library_; // library with name dictionary. 1124 RawLibrary* library_; // library with name dictionary.
1092 RawArray* show_names_; // list of names that are exported. 1125 RawArray* show_names_; // list of names that are exported.
1093 RawArray* hide_names_; // blacklist of names that are not exported. 1126 RawArray* hide_names_; // blacklist of names that are not exported.
1094 RawField* metadata_field_; // remembers the token pos of metadata if any, 1127 RawField* metadata_field_; // remembers the token pos of metadata if any,
1095 // and the metadata values if computed. 1128 // and the metadata values if computed.
1096 RawObject** to() { 1129 RawObject** to() {
1097 return reinterpret_cast<RawObject**>(&ptr()->metadata_field_); 1130 return reinterpret_cast<RawObject**>(&ptr()->metadata_field_);
1098 } 1131 }
1132
1133 friend class NamespaceSerializationCluster;
1134 friend class NamespaceDeserializationCluster;
1099 }; 1135 };
1100 1136
1101 1137
1102 class RawCode : public RawObject { 1138 class RawCode : public RawObject {
1103 enum InlinedMetadataIndex { 1139 enum InlinedMetadataIndex {
1104 kInlinedIntervalsIndex = 0, 1140 kInlinedIntervalsIndex = 0,
1105 kInlinedIdToFunctionIndex = 1, 1141 kInlinedIdToFunctionIndex = 1,
1106 kInlinedCallerIdMapIndex = 2, 1142 kInlinedCallerIdMapIndex = 2,
1107 kInlinedIdToTokenPosIndex = 3, 1143 kInlinedIdToTokenPosIndex = 3,
1108 kInlinedMetadataSize = 4, 1144 kInlinedMetadataSize = 4,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 int32_t* data() { OPEN_ARRAY_START(int32_t, int32_t); } 1190 int32_t* data() { OPEN_ARRAY_START(int32_t, int32_t); }
1155 const int32_t* data() const { OPEN_ARRAY_START(int32_t, int32_t); } 1191 const int32_t* data() const { OPEN_ARRAY_START(int32_t, int32_t); }
1156 1192
1157 static bool ContainsPC(RawObject* raw_obj, uword pc); 1193 static bool ContainsPC(RawObject* raw_obj, uword pc);
1158 1194
1159 friend class Function; 1195 friend class Function;
1160 template<bool> friend class MarkingVisitorBase; 1196 template<bool> friend class MarkingVisitorBase;
1161 friend class SkippedCodeFunctions; 1197 friend class SkippedCodeFunctions;
1162 friend class StackFrame; 1198 friend class StackFrame;
1163 friend class Profiler; 1199 friend class Profiler;
1200 friend class CodeSerializationCluster;
1201 friend class CodeDeserializationCluster;
1202 friend class FunctionDeserializationCluster;
1164 }; 1203 };
1165 1204
1166 1205
1167 class RawObjectPool : public RawObject { 1206 class RawObjectPool : public RawObject {
1168 RAW_HEAP_OBJECT_IMPLEMENTATION(ObjectPool); 1207 RAW_HEAP_OBJECT_IMPLEMENTATION(ObjectPool);
1169 1208
1170 intptr_t length_; 1209 intptr_t length_;
1171 RawTypedData* info_array_; 1210 RawTypedData* info_array_;
1172 1211
1173 struct Entry { 1212 struct Entry {
1174 union { 1213 union {
1175 RawObject* raw_obj_; 1214 RawObject* raw_obj_;
1176 uword raw_value_; 1215 uword raw_value_;
1177 }; 1216 };
1178 }; 1217 };
1179 Entry* data() { OPEN_ARRAY_START(Entry, Entry); } 1218 Entry* data() { OPEN_ARRAY_START(Entry, Entry); }
1180 Entry const* data() const { OPEN_ARRAY_START(Entry, Entry); } 1219 Entry const* data() const { OPEN_ARRAY_START(Entry, Entry); }
1181 1220
1182 Entry* first_entry() { return &ptr()->data()[0]; } 1221 Entry* first_entry() { return &ptr()->data()[0]; }
1183 1222
1184 friend class Object; 1223 friend class Object;
1185 friend class SnapshotReader; 1224 friend class SnapshotReader;
1225 friend class ObjectPoolSerializationCluster;
1226 friend class ObjectPoolDeserializationCluster;
1186 }; 1227 };
1187 1228
1188 1229
1189 class RawInstructions : public RawObject { 1230 class RawInstructions : public RawObject {
1190 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions); 1231 RAW_HEAP_OBJECT_IMPLEMENTATION(Instructions);
1191 1232
1192 int32_t size_; 1233 int32_t size_;
1193 1234
1194 // Variable length data follows here. 1235 // Variable length data follows here.
1195 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } 1236 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 // Array with [num_entries_] entries. Each entry is an array of all handled 1449 // Array with [num_entries_] entries. Each entry is an array of all handled
1409 // exception types. 1450 // exception types.
1410 RawArray* handled_types_data_; 1451 RawArray* handled_types_data_;
1411 1452
1412 // Exception handler info of length [num_entries_]. 1453 // Exception handler info of length [num_entries_].
1413 const HandlerInfo* data() const { OPEN_ARRAY_START(HandlerInfo, intptr_t); } 1454 const HandlerInfo* data() const { OPEN_ARRAY_START(HandlerInfo, intptr_t); }
1414 HandlerInfo* data() { OPEN_ARRAY_START(HandlerInfo, intptr_t); } 1455 HandlerInfo* data() { OPEN_ARRAY_START(HandlerInfo, intptr_t); }
1415 1456
1416 friend class Object; 1457 friend class Object;
1417 friend class SnapshotReader; 1458 friend class SnapshotReader;
1459 friend class ExceptionHandlersSerializationCluster;
1460 friend class ExceptionHandlersDeserializationCluster;
1418 }; 1461 };
1419 1462
1420 1463
1421 class RawContext : public RawObject { 1464 class RawContext : public RawObject {
1422 RAW_HEAP_OBJECT_IMPLEMENTATION(Context); 1465 RAW_HEAP_OBJECT_IMPLEMENTATION(Context);
1423 1466
1424 int32_t num_variables_; 1467 int32_t num_variables_;
1425 1468
1426 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->parent_); } 1469 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->parent_); }
1427 RawContext* parent_; 1470 RawContext* parent_;
1428 1471
1429 // Variable length data follows here. 1472 // Variable length data follows here.
1430 RawObject** data() { OPEN_ARRAY_START(RawObject*, RawObject*); } 1473 RawObject** data() { OPEN_ARRAY_START(RawObject*, RawObject*); }
1431 RawObject* const* data() const { 1474 RawObject* const* data() const {
1432 OPEN_ARRAY_START(RawObject*, RawObject*); 1475 OPEN_ARRAY_START(RawObject*, RawObject*);
1433 } 1476 }
1434 RawObject** to(intptr_t num_vars) { 1477 RawObject** to(intptr_t num_vars) {
1435 return reinterpret_cast<RawObject**>(&ptr()->data()[num_vars - 1]); 1478 return reinterpret_cast<RawObject**>(&ptr()->data()[num_vars - 1]);
1436 } 1479 }
1437 1480
1438 friend class SnapshotReader; 1481 friend class SnapshotReader;
1482 friend class ContextSerializationCluster;
1483 friend class ContextDeserializationCluster;
1439 }; 1484 };
1440 1485
1441 1486
1442 class RawContextScope : public RawObject { 1487 class RawContextScope : public RawObject {
1443 RAW_HEAP_OBJECT_IMPLEMENTATION(ContextScope); 1488 RAW_HEAP_OBJECT_IMPLEMENTATION(ContextScope);
1444 1489
1445 // TODO(iposva): Switch to conventional enum offset based structure to avoid 1490 // TODO(iposva): Switch to conventional enum offset based structure to avoid
1446 // alignment mishaps. 1491 // alignment mishaps.
1447 struct VariableDesc { 1492 struct VariableDesc {
1448 RawSmi* token_pos; 1493 RawSmi* token_pos;
(...skipping 24 matching lines...) Expand all
1473 } 1518 }
1474 RawObject** to(intptr_t num_vars) { 1519 RawObject** to(intptr_t num_vars) {
1475 uword end = reinterpret_cast<uword>(ptr()->VariableDescAddr(num_vars)); 1520 uword end = reinterpret_cast<uword>(ptr()->VariableDescAddr(num_vars));
1476 // 'end' is the address just beyond the last descriptor, so step back. 1521 // 'end' is the address just beyond the last descriptor, so step back.
1477 return reinterpret_cast<RawObject**>(end - kWordSize); 1522 return reinterpret_cast<RawObject**>(end - kWordSize);
1478 } 1523 }
1479 1524
1480 friend class Object; 1525 friend class Object;
1481 friend class RawClosureData; 1526 friend class RawClosureData;
1482 friend class SnapshotReader; 1527 friend class SnapshotReader;
1528 friend class ContextScopeSerializationCluster;
1529 friend class ContextScopeDeserializationCluster;
1483 }; 1530 };
1484 1531
1485 1532
1486 class RawICData : public RawObject { 1533 class RawICData : public RawObject {
1487 RAW_HEAP_OBJECT_IMPLEMENTATION(ICData); 1534 RAW_HEAP_OBJECT_IMPLEMENTATION(ICData);
1488 1535
1489 RawObject** from() { 1536 RawObject** from() {
1490 return reinterpret_cast<RawObject**>(&ptr()->ic_data_); 1537 return reinterpret_cast<RawObject**>(&ptr()->ic_data_);
1491 } 1538 }
1492 RawArray* ic_data_; // Contains class-ids, target and count. 1539 RawArray* ic_data_; // Contains class-ids, target and count.
(...skipping 19 matching lines...) Expand all
1512 UNREACHABLE(); 1559 UNREACHABLE();
1513 return NULL; 1560 return NULL;
1514 } 1561 }
1515 int32_t deopt_id_; // Deoptimization id corresponding to this IC. 1562 int32_t deopt_id_; // Deoptimization id corresponding to this IC.
1516 uint32_t state_bits_; // Number of arguments tested in IC, deopt reasons, 1563 uint32_t state_bits_; // Number of arguments tested in IC, deopt reasons,
1517 // range feedback. 1564 // range feedback.
1518 #if defined(TAG_IC_DATA) 1565 #if defined(TAG_IC_DATA)
1519 intptr_t tag_; // Debugging, verifying that the icdata is assigned to the 1566 intptr_t tag_; // Debugging, verifying that the icdata is assigned to the
1520 // same instruction again. Store -1 or Instruction::Tag. 1567 // same instruction again. Store -1 or Instruction::Tag.
1521 #endif 1568 #endif
1569
1570 friend class ICDataSerializationCluster;
1571 friend class ICDataDeserializationCluster;
1522 }; 1572 };
1523 1573
1524 1574
1525 class RawMegamorphicCache : public RawObject { 1575 class RawMegamorphicCache : public RawObject {
1526 RAW_HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache); 1576 RAW_HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache);
1527 1577
1528 RawObject** from() { 1578 RawObject** from() {
1529 return reinterpret_cast<RawObject**>(&ptr()->buckets_); 1579 return reinterpret_cast<RawObject**>(&ptr()->buckets_);
1530 } 1580 }
1531 RawArray* buckets_; 1581 RawArray* buckets_;
1532 RawSmi* mask_; 1582 RawSmi* mask_;
1533 RawString* target_name_; // Name of target function. 1583 RawString* target_name_; // Name of target function.
1534 RawArray* args_descriptor_; // Arguments descriptor. 1584 RawArray* args_descriptor_; // Arguments descriptor.
1535 RawObject** to() { 1585 RawObject** to() {
1536 return reinterpret_cast<RawObject**>(&ptr()->args_descriptor_); 1586 return reinterpret_cast<RawObject**>(&ptr()->args_descriptor_);
1537 } 1587 }
1538 1588
1539 int32_t filled_entry_count_; 1589 int32_t filled_entry_count_;
1590
1591 friend class MegamorphicCacheSerializationCluster;
1592 friend class MegamorphicCacheDeserializationCluster;
1540 }; 1593 };
1541 1594
1542 1595
1543 class RawSubtypeTestCache : public RawObject { 1596 class RawSubtypeTestCache : public RawObject {
1544 RAW_HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache); 1597 RAW_HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache);
1545 RawArray* cache_; 1598 RawArray* cache_;
1599
1600 friend class SubtypeTestCacheSerializationCluster;
1601 friend class SubtypeTestCacheDeserializationCluster;
1546 }; 1602 };
1547 1603
1548 1604
1549 class RawError : public RawObject { 1605 class RawError : public RawObject {
1550 RAW_HEAP_OBJECT_IMPLEMENTATION(Error); 1606 RAW_HEAP_OBJECT_IMPLEMENTATION(Error);
1551 }; 1607 };
1552 1608
1553 1609
1554 class RawApiError : public RawError { 1610 class RawApiError : public RawError {
1555 RAW_HEAP_OBJECT_IMPLEMENTATION(ApiError); 1611 RAW_HEAP_OBJECT_IMPLEMENTATION(ApiError);
(...skipping 17 matching lines...) Expand all
1573 RawError* previous_error_; // May be null. 1629 RawError* previous_error_; // May be null.
1574 RawScript* script_; 1630 RawScript* script_;
1575 RawString* message_; 1631 RawString* message_;
1576 RawString* formatted_message_; // Incl. previous error's formatted message. 1632 RawString* formatted_message_; // Incl. previous error's formatted message.
1577 RawObject** to() { 1633 RawObject** to() {
1578 return reinterpret_cast<RawObject**>(&ptr()->formatted_message_); 1634 return reinterpret_cast<RawObject**>(&ptr()->formatted_message_);
1579 } 1635 }
1580 TokenPosition token_pos_; // Source position in script_. 1636 TokenPosition token_pos_; // Source position in script_.
1581 bool report_after_token_; // Report message at or after the token. 1637 bool report_after_token_; // Report message at or after the token.
1582 int8_t kind_; // Of type LanguageError::Kind. 1638 int8_t kind_; // Of type LanguageError::Kind.
1639
1640 friend class LanguageErrorSerializationCluster;
1641 friend class LanguageErrorDeserializationCluster;
1583 }; 1642 };
1584 1643
1585 1644
1586 class RawUnhandledException : public RawError { 1645 class RawUnhandledException : public RawError {
1587 RAW_HEAP_OBJECT_IMPLEMENTATION(UnhandledException); 1646 RAW_HEAP_OBJECT_IMPLEMENTATION(UnhandledException);
1588 1647
1589 RawObject** from() { 1648 RawObject** from() {
1590 return reinterpret_cast<RawObject**>(&ptr()->exception_); 1649 return reinterpret_cast<RawObject**>(&ptr()->exception_);
1591 } 1650 }
1592 RawInstance* exception_; 1651 RawInstance* exception_;
1593 RawInstance* stacktrace_; 1652 RawInstance* stacktrace_;
1594 RawObject** to() { 1653 RawObject** to() {
1595 return reinterpret_cast<RawObject**>(&ptr()->stacktrace_); 1654 return reinterpret_cast<RawObject**>(&ptr()->stacktrace_);
1596 } 1655 }
1656
1657 friend class UnhandledExceptionSerializationCluster;
1658 friend class UnhandledExceptionDeserializationCluster;
1597 }; 1659 };
1598 1660
1599 1661
1600 class RawUnwindError : public RawError { 1662 class RawUnwindError : public RawError {
1601 RAW_HEAP_OBJECT_IMPLEMENTATION(UnwindError); 1663 RAW_HEAP_OBJECT_IMPLEMENTATION(UnwindError);
1602 1664
1603 RawObject** from() { 1665 RawObject** from() {
1604 return reinterpret_cast<RawObject**>(&ptr()->message_); 1666 return reinterpret_cast<RawObject**>(&ptr()->message_);
1605 } 1667 }
1606 RawString* message_; 1668 RawString* message_;
1607 RawObject** to() { 1669 RawObject** to() {
1608 return reinterpret_cast<RawObject**>(&ptr()->message_); 1670 return reinterpret_cast<RawObject**>(&ptr()->message_);
1609 } 1671 }
1610 bool is_user_initiated_; 1672 bool is_user_initiated_;
1611 bool is_vm_restart_; 1673 bool is_vm_restart_;
1612 }; 1674 };
1613 1675
1614 1676
1615 class RawInstance : public RawObject { 1677 class RawInstance : public RawObject {
1616 RAW_HEAP_OBJECT_IMPLEMENTATION(Instance); 1678 RAW_HEAP_OBJECT_IMPLEMENTATION(Instance);
1679
1680 friend class InstanceSerializationCluster;
1681 friend class InstanceDeserializationCluster;
1617 }; 1682 };
1618 1683
1619 1684
1620 class RawLibraryPrefix : public RawInstance { 1685 class RawLibraryPrefix : public RawInstance {
1621 RAW_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix); 1686 RAW_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix);
1622 1687
1623 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } 1688 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
1624 RawString* name_; // Library prefix name. 1689 RawString* name_; // Library prefix name.
1625 RawLibrary* importer_; // Library which declares this prefix. 1690 RawLibrary* importer_; // Library which declares this prefix.
1626 RawArray* imports_; // Libraries imported with this prefix. 1691 RawArray* imports_; // Libraries imported with this prefix.
(...skipping 14 matching lines...) Expand all
1641 case Snapshot::kNone: 1706 case Snapshot::kNone:
1642 case Snapshot::kInvalid: 1707 case Snapshot::kInvalid:
1643 break; 1708 break;
1644 } 1709 }
1645 UNREACHABLE(); 1710 UNREACHABLE();
1646 return NULL; 1711 return NULL;
1647 } 1712 }
1648 uint16_t num_imports_; // Number of library entries in libraries_. 1713 uint16_t num_imports_; // Number of library entries in libraries_.
1649 bool is_deferred_load_; 1714 bool is_deferred_load_;
1650 bool is_loaded_; 1715 bool is_loaded_;
1716
1717 friend class LibraryPrefixSerializationCluster;
1718 friend class LibraryPrefixDeserializationCluster;
1651 }; 1719 };
1652 1720
1653 1721
1654 class RawAbstractType : public RawInstance { 1722 class RawAbstractType : public RawInstance {
1655 protected: 1723 protected:
1656 enum TypeState { 1724 enum TypeState {
1657 kAllocated, // Initial state. 1725 kAllocated, // Initial state.
1658 kResolved, // Type class and type arguments resolved. 1726 kResolved, // Type class and type arguments resolved.
1659 kBeingFinalized, // In the process of being finalized. 1727 kBeingFinalized, // In the process of being finalized.
1660 kFinalizedInstantiated, // Instantiated type ready for use. 1728 kFinalizedInstantiated, // Instantiated type ready for use.
(...skipping 26 matching lines...) Expand all
1687 // can describe the issue without needing the signature. 1755 // can describe the issue without needing the signature.
1688 union { 1756 union {
1689 RawFunction* signature_; // If not null, this type is a function type. 1757 RawFunction* signature_; // If not null, this type is a function type.
1690 RawLanguageError* error_; // If not null, type is malformed or malbounded. 1758 RawLanguageError* error_; // If not null, type is malformed or malbounded.
1691 } sig_or_err_; 1759 } sig_or_err_;
1692 RawObject** to() { 1760 RawObject** to() {
1693 return reinterpret_cast<RawObject**>(&ptr()->sig_or_err_.error_); 1761 return reinterpret_cast<RawObject**>(&ptr()->sig_or_err_.error_);
1694 } 1762 }
1695 TokenPosition token_pos_; 1763 TokenPosition token_pos_;
1696 int8_t type_state_; 1764 int8_t type_state_;
1765
1766 friend class TypeSerializationCluster;
1767 friend class TypeDeserializationCluster;
1697 }; 1768 };
1698 1769
1699 1770
1700 class RawTypeRef : public RawAbstractType { 1771 class RawTypeRef : public RawAbstractType {
1701 private: 1772 private:
1702 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeRef); 1773 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeRef);
1703 1774
1704 RawObject** from() { 1775 RawObject** from() {
1705 return reinterpret_cast<RawObject**>(&ptr()->type_); 1776 return reinterpret_cast<RawObject**>(&ptr()->type_);
1706 } 1777 }
1707 RawAbstractType* type_; // The referenced type. 1778 RawAbstractType* type_; // The referenced type.
1708 RawObject** to() { 1779 RawObject** to() {
1709 return reinterpret_cast<RawObject**>(&ptr()->type_); 1780 return reinterpret_cast<RawObject**>(&ptr()->type_);
1710 } 1781 }
1782
1783 friend class TypeRefSerializationCluster;
1784 friend class TypeRefDeserializationCluster;
1711 }; 1785 };
1712 1786
1713 1787
1714 class RawTypeParameter : public RawAbstractType { 1788 class RawTypeParameter : public RawAbstractType {
1715 private: 1789 private:
1716 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter); 1790 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter);
1717 1791
1718 RawObject** from() { 1792 RawObject** from() {
1719 return reinterpret_cast<RawObject**>(&ptr()->name_); 1793 return reinterpret_cast<RawObject**>(&ptr()->name_);
1720 } 1794 }
1721 RawString* name_; 1795 RawString* name_;
1722 RawSmi* hash_; 1796 RawSmi* hash_;
1723 RawAbstractType* bound_; // ObjectType if no explicit bound specified. 1797 RawAbstractType* bound_; // ObjectType if no explicit bound specified.
1724 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->bound_); } 1798 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->bound_); }
1725 classid_t parameterized_class_id_; 1799 classid_t parameterized_class_id_;
1726 TokenPosition token_pos_; 1800 TokenPosition token_pos_;
1727 int16_t index_; 1801 int16_t index_;
1728 int8_t type_state_; 1802 int8_t type_state_;
1803
1804 friend class TypeParameterSerializationCluster;
1805 friend class TypeParameterDeserializationCluster;
1729 }; 1806 };
1730 1807
1731 1808
1732 class RawBoundedType : public RawAbstractType { 1809 class RawBoundedType : public RawAbstractType {
1733 private: 1810 private:
1734 RAW_HEAP_OBJECT_IMPLEMENTATION(BoundedType); 1811 RAW_HEAP_OBJECT_IMPLEMENTATION(BoundedType);
1735 1812
1736 RawObject** from() { 1813 RawObject** from() {
1737 return reinterpret_cast<RawObject**>(&ptr()->type_); 1814 return reinterpret_cast<RawObject**>(&ptr()->type_);
1738 } 1815 }
1739 RawAbstractType* type_; 1816 RawAbstractType* type_;
1740 RawAbstractType* bound_; 1817 RawAbstractType* bound_;
1741 RawSmi* hash_; 1818 RawSmi* hash_;
1742 RawTypeParameter* type_parameter_; // For more detailed error reporting. 1819 RawTypeParameter* type_parameter_; // For more detailed error reporting.
1743 RawObject** to() { 1820 RawObject** to() {
1744 return reinterpret_cast<RawObject**>(&ptr()->type_parameter_); 1821 return reinterpret_cast<RawObject**>(&ptr()->type_parameter_);
1745 } 1822 }
1823
1824 friend class BoundedTypeSerializationCluster;
1825 friend class BoundedTypeDeserializationCluster;
1746 }; 1826 };
1747 1827
1748 1828
1749 class RawMixinAppType : public RawAbstractType { 1829 class RawMixinAppType : public RawAbstractType {
1750 private: 1830 private:
1751 RAW_HEAP_OBJECT_IMPLEMENTATION(MixinAppType); 1831 RAW_HEAP_OBJECT_IMPLEMENTATION(MixinAppType);
1752 1832
1753 RawObject** from() { 1833 RawObject** from() {
1754 return reinterpret_cast<RawObject**>(&ptr()->super_type_); 1834 return reinterpret_cast<RawObject**>(&ptr()->super_type_);
1755 } 1835 }
(...skipping 14 matching lines...) Expand all
1770 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); 1850 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_);
1771 } 1851 }
1772 1852
1773 RawTypeArguments* type_arguments_; 1853 RawTypeArguments* type_arguments_;
1774 RawFunction* function_; 1854 RawFunction* function_;
1775 RawContext* context_; 1855 RawContext* context_;
1776 1856
1777 RawObject** to() { 1857 RawObject** to() {
1778 return reinterpret_cast<RawObject**>(&ptr()->context_); 1858 return reinterpret_cast<RawObject**>(&ptr()->context_);
1779 } 1859 }
1860
1861 friend class ClosureSerializationCluster;
1862 friend class ClosureDeserializationCluster;
1780 }; 1863 };
1781 1864
1782 1865
1783 class RawNumber : public RawInstance { 1866 class RawNumber : public RawInstance {
1784 RAW_OBJECT_IMPLEMENTATION(Number); 1867 RAW_OBJECT_IMPLEMENTATION(Number);
1785 }; 1868 };
1786 1869
1787 1870
1788 class RawInteger : public RawNumber { 1871 class RawInteger : public RawNumber {
1789 RAW_OBJECT_IMPLEMENTATION(Integer); 1872 RAW_OBJECT_IMPLEMENTATION(Integer);
1790 }; 1873 };
1791 1874
1792 1875
1793 class RawSmi : public RawInteger { 1876 class RawSmi : public RawInteger {
1794 RAW_OBJECT_IMPLEMENTATION(Smi); 1877 RAW_OBJECT_IMPLEMENTATION(Smi);
1795 }; 1878 };
1796 1879
1797 1880
1798 class RawMint : public RawInteger { 1881 class RawMint : public RawInteger {
1799 RAW_HEAP_OBJECT_IMPLEMENTATION(Mint); 1882 RAW_HEAP_OBJECT_IMPLEMENTATION(Mint);
1800 1883
1801 ALIGN8 int64_t value_; 1884 ALIGN8 int64_t value_;
1802 1885
1803 friend class Api; 1886 friend class Api;
1804 friend class SnapshotReader; 1887 friend class SnapshotReader;
1888 friend class SmiMintSerializationCluster;
1889 friend class SmiMintDeserializationCluster;
1805 }; 1890 };
1806 COMPILE_ASSERT(sizeof(RawMint) == 16); 1891 COMPILE_ASSERT(sizeof(RawMint) == 16);
1807 1892
1808 1893
1809 class RawBigint : public RawInteger { 1894 class RawBigint : public RawInteger {
1810 RAW_HEAP_OBJECT_IMPLEMENTATION(Bigint); 1895 RAW_HEAP_OBJECT_IMPLEMENTATION(Bigint);
1811 1896
1812 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->neg_); } 1897 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->neg_); }
1813 RawBool* neg_; 1898 RawBool* neg_;
1814 RawSmi* used_; 1899 RawSmi* used_;
1815 RawTypedData* digits_; 1900 RawTypedData* digits_;
1816 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->digits_); } 1901 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->digits_); }
1902
1903 friend class BigintSerializationCluster;
1904 friend class BigintDeserializationCluster;
1817 }; 1905 };
1818 1906
1819 1907
1820 class RawDouble : public RawNumber { 1908 class RawDouble : public RawNumber {
1821 RAW_HEAP_OBJECT_IMPLEMENTATION(Double); 1909 RAW_HEAP_OBJECT_IMPLEMENTATION(Double);
1822 1910
1823 ALIGN8 double value_; 1911 ALIGN8 double value_;
1824 1912
1825 friend class Api; 1913 friend class Api;
1826 friend class SnapshotReader; 1914 friend class SnapshotReader;
1915 friend class DoubleSerializationCluster;
1916 friend class DoubleDeserializationCluster;
1827 }; 1917 };
1828 COMPILE_ASSERT(sizeof(RawDouble) == 16); 1918 COMPILE_ASSERT(sizeof(RawDouble) == 16);
1829 1919
1830 1920
1831 class RawString : public RawInstance { 1921 class RawString : public RawInstance {
1832 RAW_HEAP_OBJECT_IMPLEMENTATION(String); 1922 RAW_HEAP_OBJECT_IMPLEMENTATION(String);
1833 1923
1834 protected: 1924 protected:
1835 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } 1925 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
1836 RawSmi* length_; 1926 RawSmi* length_;
1837 RawSmi* hash_; 1927 RawSmi* hash_;
1838 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); } 1928 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); }
1839 1929
1840 friend class Library; 1930 friend class Library;
1841 }; 1931 };
1842 1932
1843 1933
1844 class RawOneByteString : public RawString { 1934 class RawOneByteString : public RawString {
1845 RAW_HEAP_OBJECT_IMPLEMENTATION(OneByteString); 1935 RAW_HEAP_OBJECT_IMPLEMENTATION(OneByteString);
1846 1936
1847 // Variable length data follows here. 1937 // Variable length data follows here.
1848 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } 1938 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
1849 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); } 1939 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); }
1850 1940
1851 friend class ApiMessageReader; 1941 friend class ApiMessageReader;
1852 friend class SnapshotReader; 1942 friend class SnapshotReader;
1943 friend class OneByteStringSerializationCluster;
1944 friend class OneByteStringDeserializationCluster;
1945 friend class RODataSerializationCluster;
1853 }; 1946 };
1854 1947
1855 1948
1856 class RawTwoByteString : public RawString { 1949 class RawTwoByteString : public RawString {
1857 RAW_HEAP_OBJECT_IMPLEMENTATION(TwoByteString); 1950 RAW_HEAP_OBJECT_IMPLEMENTATION(TwoByteString);
1858 1951
1859 // Variable length data follows here. 1952 // Variable length data follows here.
1860 uint16_t* data() { OPEN_ARRAY_START(uint16_t, uint16_t); } 1953 uint16_t* data() { OPEN_ARRAY_START(uint16_t, uint16_t); }
1861 const uint16_t* data() const { OPEN_ARRAY_START(uint16_t, uint16_t); } 1954 const uint16_t* data() const { OPEN_ARRAY_START(uint16_t, uint16_t); }
1862 1955
1863 friend class SnapshotReader; 1956 friend class SnapshotReader;
1957 friend class TwoByteStringSerializationCluster;
1958 friend class TwoByteStringDeserializationCluster;
1959 friend class RODataSerializationCluster;
1864 }; 1960 };
1865 1961
1866 1962
1867 template<typename T> 1963 template<typename T>
1868 class ExternalStringData { 1964 class ExternalStringData {
1869 public: 1965 public:
1870 ExternalStringData(const T* data, void* peer, Dart_PeerFinalizer callback) : 1966 ExternalStringData(const T* data, void* peer, Dart_PeerFinalizer callback) :
1871 data_(data), peer_(peer), callback_(callback) { 1967 data_(data), peer_(peer), callback_(callback) {
1872 } 1968 }
1873 ~ExternalStringData() { 1969 ~ExternalStringData() {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 } 2025 }
1930 RawTypeArguments* type_arguments_; 2026 RawTypeArguments* type_arguments_;
1931 RawSmi* length_; 2027 RawSmi* length_;
1932 // Variable length data follows here. 2028 // Variable length data follows here.
1933 RawObject** data() { OPEN_ARRAY_START(RawObject*, RawObject*); } 2029 RawObject** data() { OPEN_ARRAY_START(RawObject*, RawObject*); }
1934 RawObject* const* data() const { OPEN_ARRAY_START(RawObject*, RawObject*); } 2030 RawObject* const* data() const { OPEN_ARRAY_START(RawObject*, RawObject*); }
1935 RawObject** to(intptr_t length) { 2031 RawObject** to(intptr_t length) {
1936 return reinterpret_cast<RawObject**>(&ptr()->data()[length - 1]); 2032 return reinterpret_cast<RawObject**>(&ptr()->data()[length - 1]);
1937 } 2033 }
1938 2034
2035 friend class ArraySerializationCluster;
2036 friend class ArrayDeserializationCluster;
2037 friend class LinkedHashMapSerializationCluster;
2038 friend class LinkedHashMapDeserializationCluster;
2039 friend class Deserializer;
1939 friend class RawCode; 2040 friend class RawCode;
1940 friend class RawImmutableArray; 2041 friend class RawImmutableArray;
1941 friend class SnapshotReader; 2042 friend class SnapshotReader;
1942 friend class GrowableObjectArray; 2043 friend class GrowableObjectArray;
1943 friend class LinkedHashMap; 2044 friend class LinkedHashMap;
1944 friend class RawLinkedHashMap; 2045 friend class RawLinkedHashMap;
1945 friend class Object; 2046 friend class Object;
1946 friend class ICData; // For high performance access. 2047 friend class ICData; // For high performance access.
1947 friend class SubtypeTestCache; // For high performance access. 2048 friend class SubtypeTestCache; // For high performance access.
1948 }; 2049 };
(...skipping 13 matching lines...) Expand all
1962 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); 2063 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_);
1963 } 2064 }
1964 RawTypeArguments* type_arguments_; 2065 RawTypeArguments* type_arguments_;
1965 RawSmi* length_; 2066 RawSmi* length_;
1966 RawArray* data_; 2067 RawArray* data_;
1967 RawObject** to() { 2068 RawObject** to() {
1968 return reinterpret_cast<RawObject**>(&ptr()->data_); 2069 return reinterpret_cast<RawObject**>(&ptr()->data_);
1969 } 2070 }
1970 2071
1971 friend class SnapshotReader; 2072 friend class SnapshotReader;
2073 friend class GrowableObjectArraySerializationCluster;
2074 friend class GrowableObjectArrayDeserializationCluster;
1972 }; 2075 };
1973 2076
1974 2077
1975 class RawLinkedHashMap : public RawInstance { 2078 class RawLinkedHashMap : public RawInstance {
1976 RAW_HEAP_OBJECT_IMPLEMENTATION(LinkedHashMap); 2079 RAW_HEAP_OBJECT_IMPLEMENTATION(LinkedHashMap);
1977 2080
1978 RawObject** from() { 2081 RawObject** from() {
1979 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_); 2082 return reinterpret_cast<RawObject**>(&ptr()->type_arguments_);
1980 } 2083 }
1981 RawTypeArguments* type_arguments_; 2084 RawTypeArguments* type_arguments_;
1982 RawTypedData* index_; 2085 RawTypedData* index_;
1983 RawSmi* hash_mask_; 2086 RawSmi* hash_mask_;
1984 RawArray* data_; 2087 RawArray* data_;
1985 RawSmi* used_data_; 2088 RawSmi* used_data_;
1986 RawSmi* deleted_keys_; 2089 RawSmi* deleted_keys_;
1987 RawObject** to() { 2090 RawObject** to() {
1988 return reinterpret_cast<RawObject**>(&ptr()->deleted_keys_); 2091 return reinterpret_cast<RawObject**>(&ptr()->deleted_keys_);
1989 } 2092 }
1990 2093
1991
1992 friend class SnapshotReader; 2094 friend class SnapshotReader;
2095 friend class LinkedHashMapSerializationCluster;
2096 friend class LinkedHashMapDeserializationCluster;
1993 }; 2097 };
1994 2098
1995 2099
1996 class RawFloat32x4 : public RawInstance { 2100 class RawFloat32x4 : public RawInstance {
1997 RAW_HEAP_OBJECT_IMPLEMENTATION(Float32x4); 2101 RAW_HEAP_OBJECT_IMPLEMENTATION(Float32x4);
1998 2102
1999 ALIGN8 float value_[4]; 2103 ALIGN8 float value_[4];
2000 2104
2001 friend class SnapshotReader; 2105 friend class SnapshotReader;
2106
2002 public: 2107 public:
2003 float x() const { return value_[0]; } 2108 float x() const { return value_[0]; }
2004 float y() const { return value_[1]; } 2109 float y() const { return value_[1]; }
2005 float z() const { return value_[2]; } 2110 float z() const { return value_[2]; }
2006 float w() const { return value_[3]; } 2111 float w() const { return value_[3]; }
2007 }; 2112 };
2008 COMPILE_ASSERT(sizeof(RawFloat32x4) == 24); 2113 COMPILE_ASSERT(sizeof(RawFloat32x4) == 24);
2009 2114
2010 2115
2011 class RawInt32x4 : public RawInstance { 2116 class RawInt32x4 : public RawInstance {
2012 RAW_HEAP_OBJECT_IMPLEMENTATION(Int32x4); 2117 RAW_HEAP_OBJECT_IMPLEMENTATION(Int32x4);
2013 2118
2014 ALIGN8 int32_t value_[4]; 2119 ALIGN8 int32_t value_[4];
2015 2120
2016 friend class SnapshotReader; 2121 friend class SnapshotReader;
2122
2017 public: 2123 public:
2018 int32_t x() const { return value_[0]; } 2124 int32_t x() const { return value_[0]; }
2019 int32_t y() const { return value_[1]; } 2125 int32_t y() const { return value_[1]; }
2020 int32_t z() const { return value_[2]; } 2126 int32_t z() const { return value_[2]; }
2021 int32_t w() const { return value_[3]; } 2127 int32_t w() const { return value_[3]; }
2022 }; 2128 };
2023 COMPILE_ASSERT(sizeof(RawInt32x4) == 24); 2129 COMPILE_ASSERT(sizeof(RawInt32x4) == 24);
2024 2130
2025 2131
2026 class RawFloat64x2 : public RawInstance { 2132 class RawFloat64x2 : public RawInstance {
2027 RAW_HEAP_OBJECT_IMPLEMENTATION(Float64x2); 2133 RAW_HEAP_OBJECT_IMPLEMENTATION(Float64x2);
2028 2134
2029 ALIGN8 double value_[2]; 2135 ALIGN8 double value_[2];
2030 2136
2031 friend class SnapshotReader; 2137 friend class SnapshotReader;
2138
2032 public: 2139 public:
2033 double x() const { return value_[0]; } 2140 double x() const { return value_[0]; }
2034 double y() const { return value_[1]; } 2141 double y() const { return value_[1]; }
2035 }; 2142 };
2036 COMPILE_ASSERT(sizeof(RawFloat64x2) == 24); 2143 COMPILE_ASSERT(sizeof(RawFloat64x2) == 24);
2037 2144
2038 2145
2039 // Define an aliases for intptr_t. 2146 // Define an aliases for intptr_t.
2040 #if defined(ARCH_IS_32_BIT) 2147 #if defined(ARCH_IS_32_BIT)
2041 #define kIntPtrCid kTypedDataInt32ArrayCid 2148 #define kIntPtrCid kTypedDataInt32ArrayCid
(...skipping 16 matching lines...) Expand all
2058 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } 2165 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); }
2059 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); } 2166 const uint8_t* data() const { OPEN_ARRAY_START(uint8_t, uint8_t); }
2060 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } 2167 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
2061 2168
2062 friend class Api; 2169 friend class Api;
2063 friend class Object; 2170 friend class Object;
2064 friend class Instance; 2171 friend class Instance;
2065 friend class SnapshotReader; 2172 friend class SnapshotReader;
2066 friend class ObjectPool; 2173 friend class ObjectPool;
2067 friend class RawObjectPool; 2174 friend class RawObjectPool;
2175 friend class TypedDataSerializationCluster;
2176 friend class TypedDataDeserializationCluster;
2177 friend class ObjectPoolSerializationCluster;
2178 friend class ObjectPoolDeserializationCluster;
2068 }; 2179 };
2069 2180
2070 2181
2071 class RawExternalTypedData : public RawInstance { 2182 class RawExternalTypedData : public RawInstance {
2072 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTypedData); 2183 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTypedData);
2073 2184
2074 protected: 2185 protected:
2075 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); } 2186 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
2076 RawSmi* length_; 2187 RawSmi* length_;
2077 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); } 2188 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->length_); }
2078 2189
2079 uint8_t* data_; 2190 uint8_t* data_;
2080 2191
2081 friend class TokenStream; 2192 friend class TokenStream;
2082 friend class RawTokenStream; 2193 friend class RawTokenStream;
2194 friend class ExternalTypedDataSerializationCluster;
2195 friend class ExternalTypedDataDeserializationCluster;
2083 }; 2196 };
2084 2197
2085 // VM implementations of the basic types in the isolate. 2198 // VM implementations of the basic types in the isolate.
2086 class RawCapability : public RawInstance { 2199 class RawCapability : public RawInstance {
2087 RAW_HEAP_OBJECT_IMPLEMENTATION(Capability); 2200 RAW_HEAP_OBJECT_IMPLEMENTATION(Capability);
2088 uint64_t id_; 2201 uint64_t id_;
2089 }; 2202 };
2090 2203
2091 2204
2092 class RawSendPort : public RawInstance { 2205 class RawSendPort : public RawInstance {
(...skipping 29 matching lines...) Expand all
2122 RawObject** from() { 2235 RawObject** from() {
2123 return reinterpret_cast<RawObject**>(&ptr()->code_array_); 2236 return reinterpret_cast<RawObject**>(&ptr()->code_array_);
2124 } 2237 }
2125 RawArray* code_array_; // Code object for each frame in the stack trace. 2238 RawArray* code_array_; // Code object for each frame in the stack trace.
2126 RawArray* pc_offset_array_; // Offset of PC for each frame. 2239 RawArray* pc_offset_array_; // Offset of PC for each frame.
2127 RawObject** to() { 2240 RawObject** to() {
2128 return reinterpret_cast<RawObject**>(&ptr()->pc_offset_array_); 2241 return reinterpret_cast<RawObject**>(&ptr()->pc_offset_array_);
2129 } 2242 }
2130 // False for pre-allocated stack trace (used in OOM and Stack overflow). 2243 // False for pre-allocated stack trace (used in OOM and Stack overflow).
2131 bool expand_inlined_; 2244 bool expand_inlined_;
2245
2246 friend class StacktraceSerializationCluster;
2247 friend class StacktraceDeserializationCluster;
2132 }; 2248 };
2133 2249
2134 2250
2135 // VM type for capturing JS regular expressions. 2251 // VM type for capturing JS regular expressions.
2136 class RawRegExp : public RawInstance { 2252 class RawRegExp : public RawInstance {
2137 RAW_HEAP_OBJECT_IMPLEMENTATION(RegExp); 2253 RAW_HEAP_OBJECT_IMPLEMENTATION(RegExp);
2138 2254
2139 RawObject** from() { 2255 RawObject** from() {
2140 return reinterpret_cast<RawObject**>(&ptr()->num_bracket_expressions_); 2256 return reinterpret_cast<RawObject**>(&ptr()->num_bracket_expressions_);
2141 } 2257 }
2142 RawSmi* num_bracket_expressions_; 2258 RawSmi* num_bracket_expressions_;
2143 RawString* pattern_; // Pattern to be used for matching. 2259 RawString* pattern_; // Pattern to be used for matching.
2144 RawFunction* one_byte_function_; 2260 RawFunction* one_byte_function_;
2145 RawFunction* two_byte_function_; 2261 RawFunction* two_byte_function_;
2146 RawFunction* external_one_byte_function_; 2262 RawFunction* external_one_byte_function_;
2147 RawFunction* external_two_byte_function_; 2263 RawFunction* external_two_byte_function_;
2148 RawTypedData* one_byte_bytecode_; 2264 RawTypedData* one_byte_bytecode_;
2149 RawTypedData* two_byte_bytecode_; 2265 RawTypedData* two_byte_bytecode_;
2150 RawObject** to() { 2266 RawObject** to() {
2151 return reinterpret_cast<RawObject**>(&ptr()->two_byte_bytecode_); 2267 return reinterpret_cast<RawObject**>(&ptr()->two_byte_bytecode_);
2152 } 2268 }
2153 2269
2154 intptr_t num_registers_; 2270 intptr_t num_registers_;
2155 2271
2156 // A bitfield with two fields: 2272 // A bitfield with two fields:
2157 // type: Uninitialized, simple or complex. 2273 // type: Uninitialized, simple or complex.
2158 // flags: Represents global/local, case insensitive, multiline. 2274 // flags: Represents global/local, case insensitive, multiline.
2159 int8_t type_flags_; 2275 int8_t type_flags_;
2276
2277 friend class RegExpSerializationCluster;
2278 friend class RegExpDeserializationCluster;
2160 }; 2279 };
2161 2280
2162 2281
2163 class RawWeakProperty : public RawInstance { 2282 class RawWeakProperty : public RawInstance {
2164 RAW_HEAP_OBJECT_IMPLEMENTATION(WeakProperty); 2283 RAW_HEAP_OBJECT_IMPLEMENTATION(WeakProperty);
2165 2284
2166 RawObject** from() { 2285 RawObject** from() {
2167 return reinterpret_cast<RawObject**>(&ptr()->key_); 2286 return reinterpret_cast<RawObject**>(&ptr()->key_);
2168 } 2287 }
2169 RawObject* key_; 2288 RawObject* key_;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
2432 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 2551 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
2433 kTypedDataInt8ArrayViewCid + 15); 2552 kTypedDataInt8ArrayViewCid + 15);
2434 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); 2553 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14);
2435 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); 2554 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1);
2436 return (kNullCid - kTypedDataInt8ArrayCid); 2555 return (kNullCid - kTypedDataInt8ArrayCid);
2437 } 2556 }
2438 2557
2439 } // namespace dart 2558 } // namespace dart
2440 2559
2441 #endif // VM_RAW_OBJECT_H_ 2560 #endif // VM_RAW_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698