Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1315)

Unified Diff: src/snapshot/snapshot-common.cc

Issue 2100073002: [snapshot] revisit snapshot API. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/snapshot/snapshot.h ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « src/snapshot/snapshot.h ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698