OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_SNAPSHOT_CODE_SERIALIZER_H_ | 5 #ifndef V8_SNAPSHOT_CODE_SERIALIZER_H_ |
6 #define V8_SNAPSHOT_CODE_SERIALIZER_H_ | 6 #define V8_SNAPSHOT_CODE_SERIALIZER_H_ |
7 | 7 |
8 #include "src/parsing/preparse-data.h" | 8 #include "src/parsing/preparse-data.h" |
9 #include "src/snapshot/serializer.h" | 9 #include "src/snapshot/serializer.h" |
10 | 10 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 Vector<const uint32_t> CodeStubKeys() const; | 109 Vector<const uint32_t> CodeStubKeys() const; |
110 | 110 |
111 static uint32_t SourceHash(Handle<String> source); | 111 static uint32_t SourceHash(Handle<String> source); |
112 | 112 |
113 private: | 113 private: |
114 explicit SerializedCodeData(ScriptData* data); | 114 explicit SerializedCodeData(ScriptData* data); |
115 SerializedCodeData(const byte* data, int size) | 115 SerializedCodeData(const byte* data, int size) |
116 : SerializedData(const_cast<byte*>(data), size) {} | 116 : SerializedData(const_cast<byte*>(data), size) {} |
117 | 117 |
| 118 Vector<const byte> DataWithoutHeader() const { |
| 119 return Vector<const byte>(data_ + kHeaderSize, size_ - kHeaderSize); |
| 120 } |
| 121 |
118 SanityCheckResult SanityCheck(Isolate* isolate, | 122 SanityCheckResult SanityCheck(Isolate* isolate, |
119 uint32_t expected_source_hash) const; | 123 uint32_t expected_source_hash) const; |
120 // The data header consists of uint32_t-sized entries: | 124 // The data header consists of uint32_t-sized entries: |
121 // [0] magic number and external reference count | 125 // [0] magic number and external reference count |
122 // [1] version hash | 126 // [1] version hash |
123 // [2] source hash | 127 // [2] source hash |
124 // [3] cpu features | 128 // [3] cpu features |
125 // [4] flag hash | 129 // [4] flag hash |
126 // [5] number of code stub keys | 130 // [5] number of code stub keys |
127 // [6] number of reservation size entries | 131 // [6] number of reservation size entries |
(...skipping 12 matching lines...) Expand all Loading... |
140 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size; | 144 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size; |
141 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size; | 145 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size; |
142 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size; | 146 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size; |
143 static const int kHeaderSize = kChecksum2Offset + kInt32Size; | 147 static const int kHeaderSize = kChecksum2Offset + kInt32Size; |
144 }; | 148 }; |
145 | 149 |
146 } // namespace internal | 150 } // namespace internal |
147 } // namespace v8 | 151 } // namespace v8 |
148 | 152 |
149 #endif // V8_SNAPSHOT_CODE_SERIALIZER_H_ | 153 #endif // V8_SNAPSHOT_CODE_SERIALIZER_H_ |
OLD | NEW |