Index: src/snapshot/snapshot-common.cc |
diff --git a/src/snapshot/snapshot-common.cc b/src/snapshot/snapshot-common.cc |
index 5eac4af6eeb08f42e75cdf2359bfa315f88d192b..fed45d16b6c3528d241284765bbeb8631c489617 100644 |
--- a/src/snapshot/snapshot-common.cc |
+++ b/src/snapshot/snapshot-common.cc |
@@ -22,11 +22,13 @@ bool Snapshot::SnapshotIsValid(v8::StartupData* snapshot_blob) { |
} |
#endif // DEBUG |
- |
-bool Snapshot::HaveASnapshotToStartFrom(Isolate* isolate) { |
+bool Snapshot::HasContextSnapshot(Isolate* isolate, size_t index) { |
// Do not use snapshots if the isolate is used to create snapshots. |
- return isolate->snapshot_blob() != NULL && |
- isolate->snapshot_blob()->data != NULL; |
+ const v8::StartupData* blob = isolate->snapshot_blob(); |
+ if (blob == nullptr) return false; |
+ if (blob->data == nullptr) return false; |
+ size_t num_contexts = static_cast<size_t>(ExtractNumContexts(blob)); |
+ return index < num_contexts; |
} |