| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_SNAPSHOT_H_ | 5 #ifndef VM_SNAPSHOT_H_ |
| 6 #define VM_SNAPSHOT_H_ | 6 #define VM_SNAPSHOT_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
| 10 #include "vm/bitfield.h" | 10 #include "vm/bitfield.h" |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 // Returns the id for the object it it exists in the list. | 786 // Returns the id for the object it it exists in the list. |
| 787 intptr_t FindObject(RawObject* raw); | 787 intptr_t FindObject(RawObject* raw); |
| 788 | 788 |
| 789 // Exhaustively processes all unserialized objects in this list. 'writer' may | 789 // Exhaustively processes all unserialized objects in this list. 'writer' may |
| 790 // concurrently add more objects. | 790 // concurrently add more objects. |
| 791 void SerializeAll(ObjectVisitor* writer); | 791 void SerializeAll(ObjectVisitor* writer); |
| 792 | 792 |
| 793 // Restores the tags of all objects in this list. | 793 // Restores the tags of all objects in this list. |
| 794 void UnmarkAll() const; | 794 void UnmarkAll() const; |
| 795 | 795 |
| 796 // Set state of object in forward list. |
| 797 void SetState(RawObject* raw, SerializeState state); |
| 798 |
| 796 private: | 799 private: |
| 797 intptr_t first_object_id() const { return first_object_id_; } | 800 intptr_t first_object_id() const { return first_object_id_; } |
| 798 intptr_t next_object_id() const { return nodes_.length() + first_object_id_; } | 801 intptr_t next_object_id() const { return nodes_.length() + first_object_id_; } |
| 799 | 802 |
| 800 const intptr_t first_object_id_; | 803 const intptr_t first_object_id_; |
| 801 GrowableArray<Node*> nodes_; | 804 GrowableArray<Node*> nodes_; |
| 802 intptr_t first_unprocessed_object_id_; | 805 intptr_t first_unprocessed_object_id_; |
| 803 | 806 |
| 804 friend class FullSnapshotWriter; | 807 friend class FullSnapshotWriter; |
| 805 DISALLOW_COPY_AND_ASSIGN(ForwardList); | 808 DISALLOW_COPY_AND_ASSIGN(ForwardList); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 | 884 |
| 882 public: | 885 public: |
| 883 // Snapshot kind. | 886 // Snapshot kind. |
| 884 Snapshot::Kind kind() const { return kind_; } | 887 Snapshot::Kind kind() const { return kind_; } |
| 885 | 888 |
| 886 // Serialize an object into the buffer. | 889 // Serialize an object into the buffer. |
| 887 void WriteObject(RawObject* raw); | 890 void WriteObject(RawObject* raw); |
| 888 | 891 |
| 889 uword GetObjectTags(RawObject* raw); | 892 uword GetObjectTags(RawObject* raw); |
| 890 | 893 |
| 894 intptr_t GetObjectId(RawObject* raw); |
| 895 |
| 891 Exceptions::ExceptionType exception_type() const { | 896 Exceptions::ExceptionType exception_type() const { |
| 892 return exception_type_; | 897 return exception_type_; |
| 893 } | 898 } |
| 894 void set_exception_type(Exceptions::ExceptionType type) { | 899 void set_exception_type(Exceptions::ExceptionType type) { |
| 895 exception_type_ = type; | 900 exception_type_ = type; |
| 896 } | 901 } |
| 897 const char* exception_msg() const { return exception_msg_; } | 902 const char* exception_msg() const { return exception_msg_; } |
| 898 void set_exception_msg(const char* msg) { | 903 void set_exception_msg(const char* msg) { |
| 899 exception_msg_ = msg; | 904 exception_msg_ = msg; |
| 900 } | 905 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 927 } | 932 } |
| 928 | 933 |
| 929 bool CheckAndWritePredefinedObject(RawObject* raw); | 934 bool CheckAndWritePredefinedObject(RawObject* raw); |
| 930 bool HandleVMIsolateObject(RawObject* raw); | 935 bool HandleVMIsolateObject(RawObject* raw); |
| 931 | 936 |
| 932 void WriteClassId(RawClass* cls); | 937 void WriteClassId(RawClass* cls); |
| 933 void WriteStaticImplicitClosure(intptr_t object_id, | 938 void WriteStaticImplicitClosure(intptr_t object_id, |
| 934 RawFunction* func, | 939 RawFunction* func, |
| 935 intptr_t tags); | 940 intptr_t tags); |
| 936 void WriteObjectImpl(RawObject* raw, bool as_reference); | 941 void WriteObjectImpl(RawObject* raw, bool as_reference); |
| 937 void WriteObjectRef(RawObject* raw); | 942 void WriteMarkedObjectImpl(RawObject* raw, |
| 938 void WriteInlinedObject(RawObject* raw); | 943 intptr_t tags, |
| 944 intptr_t object_id, |
| 945 bool as_reference); |
| 939 void WriteForwardedObjects(); | 946 void WriteForwardedObjects(); |
| 940 void ArrayWriteTo(intptr_t object_id, | 947 void ArrayWriteTo(intptr_t object_id, |
| 941 intptr_t array_kind, | 948 intptr_t array_kind, |
| 942 intptr_t tags, | 949 intptr_t tags, |
| 943 RawSmi* length, | 950 RawSmi* length, |
| 944 RawTypeArguments* type_arguments, | 951 RawTypeArguments* type_arguments, |
| 945 RawObject* data[]); | 952 RawObject* data[], |
| 953 bool as_reference); |
| 946 RawFunction* IsSerializableClosure(RawClass* cls, RawObject* obj); | 954 RawFunction* IsSerializableClosure(RawClass* cls, RawObject* obj); |
| 947 RawClass* GetFunctionOwner(RawFunction* func); | 955 RawClass* GetFunctionOwner(RawFunction* func); |
| 948 void CheckForNativeFields(RawClass* cls); | 956 void CheckForNativeFields(RawClass* cls); |
| 949 void SetWriteException(Exceptions::ExceptionType type, const char* msg); | 957 void SetWriteException(Exceptions::ExceptionType type, const char* msg); |
| 950 void WriteInstance(intptr_t object_id, | 958 void WriteInstance(RawObject* raw, |
| 951 RawObject* raw, | |
| 952 RawClass* cls, | 959 RawClass* cls, |
| 953 intptr_t tags); | 960 intptr_t tags, |
| 954 void WriteInstanceRef(RawObject* raw, RawClass* cls); | 961 intptr_t object_id, |
| 962 bool as_reference); |
| 955 bool AllowObjectsInDartLibrary(RawLibrary* library); | 963 bool AllowObjectsInDartLibrary(RawLibrary* library); |
| 956 intptr_t FindVmSnapshotObject(RawObject* rawobj); | 964 intptr_t FindVmSnapshotObject(RawObject* rawobj); |
| 957 | 965 |
| 958 void InitializeForwardList(ForwardList* forward_list) { | 966 void InitializeForwardList(ForwardList* forward_list) { |
| 959 ASSERT(forward_list_ == NULL); | 967 ASSERT(forward_list_ == NULL); |
| 960 forward_list_ = forward_list; | 968 forward_list_ = forward_list; |
| 961 } | 969 } |
| 962 void ResetForwardList() { | 970 void ResetForwardList() { |
| 963 ASSERT(forward_list_ != NULL); | 971 ASSERT(forward_list_ != NULL); |
| 964 forward_list_ = NULL; | 972 forward_list_ = NULL; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1126 private: | 1134 private: |
| 1127 SnapshotWriter* writer_; | 1135 SnapshotWriter* writer_; |
| 1128 bool as_references_; | 1136 bool as_references_; |
| 1129 | 1137 |
| 1130 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); | 1138 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); |
| 1131 }; | 1139 }; |
| 1132 | 1140 |
| 1133 } // namespace dart | 1141 } // namespace dart |
| 1134 | 1142 |
| 1135 #endif // VM_SNAPSHOT_H_ | 1143 #endif // VM_SNAPSHOT_H_ |
| OLD | NEW |