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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 static bool EmbedsScript(Isolate* isolate); | 30 static bool EmbedsScript(Isolate* isolate); |
31 | 31 |
32 static uint32_t SizeOfFirstPage(Isolate* isolate, AllocationSpace space); | 32 static uint32_t SizeOfFirstPage(Isolate* isolate, AllocationSpace space); |
33 | 33 |
34 | 34 |
35 // To be implemented by the snapshot source. | 35 // To be implemented by the snapshot source. |
36 static const v8::StartupData* DefaultSnapshotBlob(); | 36 static const v8::StartupData* DefaultSnapshotBlob(); |
37 | 37 |
38 static v8::StartupData CreateSnapshotBlob( | 38 static v8::StartupData CreateSnapshotBlob( |
39 const StartupSerializer& startup_ser, | 39 const StartupSerializer* startup_serializer, |
40 const PartialSerializer& context_ser); | 40 const PartialSerializer* context_serializer); |
41 | 41 |
42 #ifdef DEBUG | 42 #ifdef DEBUG |
43 static bool SnapshotIsValid(v8::StartupData* snapshot_blob); | 43 static bool SnapshotIsValid(v8::StartupData* snapshot_blob); |
44 #endif // DEBUG | 44 #endif // DEBUG |
45 | 45 |
46 private: | 46 private: |
47 static Vector<const byte> ExtractStartupData(const v8::StartupData* data); | 47 static Vector<const byte> ExtractStartupData(const v8::StartupData* data); |
48 static Vector<const byte> ExtractContextData(const v8::StartupData* data); | 48 static Vector<const byte> ExtractContextData(const v8::StartupData* data); |
49 | 49 |
50 // Snapshot blob layout: | 50 // Snapshot blob layout: |
(...skipping 17 matching lines...) Expand all Loading... |
68 }; | 68 }; |
69 | 69 |
70 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 70 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
71 void SetSnapshotFromFile(StartupData* snapshot_blob); | 71 void SetSnapshotFromFile(StartupData* snapshot_blob); |
72 #endif | 72 #endif |
73 | 73 |
74 // Wrapper around reservation sizes and the serialization payload. | 74 // Wrapper around reservation sizes and the serialization payload. |
75 class SnapshotData : public SerializedData { | 75 class SnapshotData : public SerializedData { |
76 public: | 76 public: |
77 // Used when producing. | 77 // Used when producing. |
78 explicit SnapshotData(const Serializer& ser); | 78 explicit SnapshotData(const Serializer* serializer); |
79 | 79 |
80 // Used when consuming. | 80 // Used when consuming. |
81 explicit SnapshotData(const Vector<const byte> snapshot) | 81 explicit SnapshotData(const Vector<const byte> snapshot) |
82 : SerializedData(const_cast<byte*>(snapshot.begin()), snapshot.length()) { | 82 : SerializedData(const_cast<byte*>(snapshot.begin()), snapshot.length()) { |
83 CHECK(IsSane()); | 83 CHECK(IsSane()); |
84 } | 84 } |
85 | 85 |
86 Vector<const Reservation> Reservations() const; | 86 Vector<const Reservation> Reservations() const; |
87 Vector<const byte> Payload() const; | 87 Vector<const byte> Payload() const; |
88 | 88 |
(...skipping 14 matching lines...) Expand all Loading... |
103 static const int kCheckSumOffset = kMagicNumberOffset + kInt32Size; | 103 static const int kCheckSumOffset = kMagicNumberOffset + kInt32Size; |
104 static const int kNumReservationsOffset = kCheckSumOffset + kInt32Size; | 104 static const int kNumReservationsOffset = kCheckSumOffset + kInt32Size; |
105 static const int kPayloadLengthOffset = kNumReservationsOffset + kInt32Size; | 105 static const int kPayloadLengthOffset = kNumReservationsOffset + kInt32Size; |
106 static const int kHeaderSize = kPayloadLengthOffset + kInt32Size; | 106 static const int kHeaderSize = kPayloadLengthOffset + kInt32Size; |
107 }; | 107 }; |
108 | 108 |
109 } // namespace internal | 109 } // namespace internal |
110 } // namespace v8 | 110 } // namespace v8 |
111 | 111 |
112 #endif // V8_SNAPSHOT_SNAPSHOT_H_ | 112 #endif // V8_SNAPSHOT_SNAPSHOT_H_ |
OLD | NEW |