OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_SERIALIZE_H_ | 5 #ifndef V8_SERIALIZE_H_ |
6 #define V8_SERIALIZE_H_ | 6 #define V8_SERIALIZE_H_ |
7 | 7 |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/hashmap.h" | 9 #include "src/hashmap.h" |
10 #include "src/heap-profiler.h" | 10 #include "src/heap-profiler.h" |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 }; | 858 }; |
859 | 859 |
860 | 860 |
861 // Wrapper around reservation sizes and the serialization payload. | 861 // Wrapper around reservation sizes and the serialization payload. |
862 class SnapshotData : public SerializedData { | 862 class SnapshotData : public SerializedData { |
863 public: | 863 public: |
864 // Used when producing. | 864 // Used when producing. |
865 SnapshotData(const SnapshotByteSink& sink, const Serializer& ser); | 865 SnapshotData(const SnapshotByteSink& sink, const Serializer& ser); |
866 | 866 |
867 // Used when consuming. | 867 // Used when consuming. |
868 explicit SnapshotData(const byte* data, int size) | 868 explicit SnapshotData(const Vector<const byte> snapshot) |
869 : SerializedData(const_cast<byte*>(data), size) { | 869 : SerializedData(const_cast<byte*>(snapshot.begin()), snapshot.length()) { |
870 CHECK(IsSane()); | 870 CHECK(IsSane()); |
871 } | 871 } |
872 | 872 |
873 Vector<const Reservation> Reservations() const; | 873 Vector<const Reservation> Reservations() const; |
874 Vector<const byte> Payload() const; | 874 Vector<const byte> Payload() const; |
875 | 875 |
876 Vector<const byte> RawData() const { | 876 Vector<const byte> RawData() const { |
877 return Vector<const byte>(data_, size_); | 877 return Vector<const byte>(data_, size_); |
878 } | 878 } |
879 | 879 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 static const int kCheckSumOffset = 0; | 933 static const int kCheckSumOffset = 0; |
934 static const int kNumInternalizedStringsOffset = 1; | 934 static const int kNumInternalizedStringsOffset = 1; |
935 static const int kReservationsOffset = 2; | 935 static const int kReservationsOffset = 2; |
936 static const int kNumCodeStubKeysOffset = 3; | 936 static const int kNumCodeStubKeysOffset = 3; |
937 static const int kPayloadLengthOffset = 4; | 937 static const int kPayloadLengthOffset = 4; |
938 static const int kHeaderSize = (kPayloadLengthOffset + 1) * kIntSize; | 938 static const int kHeaderSize = (kPayloadLengthOffset + 1) * kIntSize; |
939 }; | 939 }; |
940 } } // namespace v8::internal | 940 } } // namespace v8::internal |
941 | 941 |
942 #endif // V8_SERIALIZE_H_ | 942 #endif // V8_SERIALIZE_H_ |
OLD | NEW |