| 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 // Used for building with external snapshots. | 5 // Used for building with external snapshots. |
| 6 | 6 |
| 7 #include "src/snapshot.h" | 7 #include "src/snapshot.h" |
| 8 | 8 |
| 9 #include "src/serialize.h" | 9 #include "src/serialize.h" |
| 10 #include "src/snapshot-source-sink.h" | 10 #include "src/snapshot-source-sink.h" |
| 11 #include "src/v8.h" // for V8::Initialize | 11 #include "src/v8.h" // for V8::Initialize |
| 12 | 12 |
| 13 | 13 |
| 14 #ifndef V8_USE_EXTERNAL_STARTUP_DATA | 14 #ifndef V8_USE_EXTERNAL_STARTUP_DATA |
| 15 #error snapshot-external.cc is used only for the external snapshot build. | 15 #error snapshot-external.cc is used only for the external snapshot build. |
| 16 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 16 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
| 17 | 17 |
| 18 | 18 |
| 19 namespace v8 { | 19 namespace v8 { |
| 20 namespace internal { | 20 namespace internal { |
| 21 | 21 |
| 22 static v8::StartupData external_startup_blob = {NULL, 0}; | 22 static v8::StartupData external_startup_blob = {NULL, 0}; |
| 23 | 23 |
| 24 void SetSnapshotFromFile(StartupData* snapshot_blob) { | 24 void SetSnapshotFromFile(StartupData* snapshot_blob) { |
| 25 DCHECK(snapshot_blob); | 25 DCHECK(snapshot_blob); |
| 26 DCHECK(snapshot_blob->data); | 26 DCHECK(snapshot_blob->data); |
| 27 DCHECK(snapshot_blob->raw_size > 0); | 27 DCHECK(snapshot_blob->raw_size > 0); |
| 28 DCHECK(!external_startup_blob.data); | 28 DCHECK(!external_startup_blob.data); |
| 29 // Validate snapshot blob. |
| 30 DCHECK(!Snapshot::ExtractStartupData(snapshot_blob).is_empty()); |
| 31 DCHECK(!Snapshot::ExtractContextData(snapshot_blob).is_empty()); |
| 29 external_startup_blob = *snapshot_blob; | 32 external_startup_blob = *snapshot_blob; |
| 30 | |
| 31 // Validate snapshot blob. | |
| 32 DCHECK(!Snapshot::StartupSnapshot().is_empty()); | |
| 33 DCHECK(!Snapshot::ContextSnapshot().is_empty()); | |
| 34 } | 33 } |
| 35 | 34 |
| 36 | 35 |
| 37 const v8::StartupData Snapshot::SnapshotBlob() { return external_startup_blob; } | 36 const v8::StartupData Snapshot::SnapshotBlob() { return external_startup_blob; } |
| 38 } } // namespace v8::internal | 37 } } // namespace v8::internal |
| OLD | NEW |