Chromium Code Reviews| 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 kCheckSumOffset = |
|
Yang
2017/03/07 11:28:11
Now that I see it, this name is a bit misleading.
Jakob Kummerow
2017/03/07 12:39:15
Done (moved).
| |
| 50 kExtraExternalReferencesOffset + kInt32Size; | |
| 49 static const int kNumReservationsOffset = kCheckSumOffset + kInt32Size; | 51 static const int kNumReservationsOffset = kCheckSumOffset + kInt32Size; |
| 50 static const int kPayloadLengthOffset = kNumReservationsOffset + kInt32Size; | 52 static const int kPayloadLengthOffset = kNumReservationsOffset + kInt32Size; |
| 51 static const int kHeaderSize = kPayloadLengthOffset + kInt32Size; | 53 static const int kHeaderSize = kPayloadLengthOffset + kInt32Size; |
| 52 }; | 54 }; |
| 53 | 55 |
| 54 class Snapshot : public AllStatic { | 56 class Snapshot : public AllStatic { |
| 55 public: | 57 public: |
| 56 // Initialize the Isolate from the internal snapshot. Returns false if no | 58 // Initialize the Isolate from the internal snapshot. Returns false if no |
| 57 // snapshot could be found. | 59 // snapshot could be found. |
| 58 static bool Initialize(Isolate* isolate); | 60 static bool Initialize(Isolate* isolate); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 }; | 113 }; |
| 112 | 114 |
| 113 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 115 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 114 void SetSnapshotFromFile(StartupData* snapshot_blob); | 116 void SetSnapshotFromFile(StartupData* snapshot_blob); |
| 115 #endif | 117 #endif |
| 116 | 118 |
| 117 } // namespace internal | 119 } // namespace internal |
| 118 } // namespace v8 | 120 } // namespace v8 |
| 119 | 121 |
| 120 #endif // V8_SNAPSHOT_SNAPSHOT_H_ | 122 #endif // V8_SNAPSHOT_SNAPSHOT_H_ |
| OLD | NEW |