OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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_SNAPSHOT_H_ | 5 #ifndef V8_SNAPSHOT_SNAPSHOT_H_ |
6 #define V8_SNAPSHOT_SNAPSHOT_H_ | 6 #define V8_SNAPSHOT_SNAPSHOT_H_ |
7 | 7 |
8 #include "src/snapshot/partial-serializer.h" | 8 #include "src/snapshot/partial-serializer.h" |
9 #include "src/snapshot/startup-serializer.h" | 9 #include "src/snapshot/startup-serializer.h" |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 Vector<const byte> Payload() const; | 32 Vector<const byte> Payload() const; |
33 | 33 |
34 Vector<const byte> RawData() const { | 34 Vector<const byte> RawData() const { |
35 return Vector<const byte>(data_, size_); | 35 return Vector<const byte>(data_, size_); |
36 } | 36 } |
37 | 37 |
38 private: | 38 private: |
39 bool IsSane(); | 39 bool IsSane(); |
40 | 40 |
41 // The data header consists of uint32_t-sized entries: | 41 // The data header consists of uint32_t-sized entries: |
42 // [0] magic number and external reference count | 42 // [0] magic number and (internal) external reference count |
43 // [1] version hash | 43 // [1] API-provided external reference count |
44 // [2] number of reservation size entries | 44 // [2] version hash |
45 // [3] payload length | 45 // [3] number of reservation size entries |
| 46 // [4] payload length |
46 // ... reservations | 47 // ... reservations |
47 // ... serialized payload | 48 // ... serialized payload |
48 static const int kCheckSumOffset = kMagicNumberOffset + kInt32Size; | 49 static const int kNumReservationsOffset = kVersionHashOffset + kInt32Size; |
49 static const int kNumReservationsOffset = kCheckSumOffset + kInt32Size; | |
50 static const int kPayloadLengthOffset = kNumReservationsOffset + kInt32Size; | 50 static const int kPayloadLengthOffset = kNumReservationsOffset + kInt32Size; |
51 static const int kHeaderSize = kPayloadLengthOffset + kInt32Size; | 51 static const int kHeaderSize = kPayloadLengthOffset + kInt32Size; |
52 }; | 52 }; |
53 | 53 |
54 class Snapshot : public AllStatic { | 54 class Snapshot : public AllStatic { |
55 public: | 55 public: |
56 // Initialize the Isolate from the internal snapshot. Returns false if no | 56 // Initialize the Isolate from the internal snapshot. Returns false if no |
57 // snapshot could be found. | 57 // snapshot could be found. |
58 static bool Initialize(Isolate* isolate); | 58 static bool Initialize(Isolate* isolate); |
59 // Create a new context using the internal partial snapshot. | 59 // Create a new context using the internal partial snapshot. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 }; | 111 }; |
112 | 112 |
113 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 113 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
114 void SetSnapshotFromFile(StartupData* snapshot_blob); | 114 void SetSnapshotFromFile(StartupData* snapshot_blob); |
115 #endif | 115 #endif |
116 | 116 |
117 } // namespace internal | 117 } // namespace internal |
118 } // namespace v8 | 118 } // namespace v8 |
119 | 119 |
120 #endif // V8_SNAPSHOT_SNAPSHOT_H_ | 120 #endif // V8_SNAPSHOT_SNAPSHOT_H_ |
OLD | NEW |