Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 1 | // Copyright 2006-2008 the V8 project authors. All rights reserved. |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 4 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 5 | #include "src/isolate.h" |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 6 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 7 | #ifndef V8_SNAPSHOT_H_ |
| 8 | #define V8_SNAPSHOT_H_ |
| 9 | |
| 10 | namespace v8 { |
| 11 | namespace internal { |
| 12 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 13 | class Snapshot : public AllStatic { |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 14 | public: |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 15 | // Initialize the Isolate from the internal snapshot. Returns false if no |
| 16 | // snapshot could be found. |
| 17 | static bool Initialize(Isolate* isolate); |
Andrei Popescu | 3100271 | 2010-02-23 13:46:05 +0000 | [diff] [blame] | 18 | // Create a new context using the internal partial snapshot. |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 19 | static Handle<Context> NewContextFromSnapshot(Isolate* isolate); |
Andrei Popescu | 3100271 | 2010-02-23 13:46:05 +0000 | [diff] [blame] | 20 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 21 | static bool HaveASnapshotToStartFrom(); |
| 22 | |
| 23 | // To be implemented by the snapshot source. |
| 24 | static const v8::StartupData SnapshotBlob(); |
| 25 | |
| 26 | static v8::StartupData CreateSnapshotBlob( |
| 27 | const Vector<const byte> startup_data, |
| 28 | const Vector<const byte> context_data); |
| 29 | |
| 30 | static Vector<const byte> ExtractStartupData(const v8::StartupData* data); |
| 31 | static Vector<const byte> ExtractContextData(const v8::StartupData* data); |
Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 32 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 33 | private: |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 34 | DISALLOW_IMPLICIT_CONSTRUCTORS(Snapshot); |
| 35 | }; |
| 36 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 37 | #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 38 | void SetSnapshotFromFile(StartupData* snapshot_blob); |
| 39 | #endif |
| 40 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 41 | } } // namespace v8::internal |
| 42 | |
| 43 | #endif // V8_SNAPSHOT_H_ |