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

Unified Diff: src/snapshot-common.cc

Issue 846023002: Update references to global object after deserializing context. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comments Created 5 years, 11 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.h ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot-common.cc
diff --git a/src/snapshot-common.cc b/src/snapshot-common.cc
index e38872d5d18711de53720d31daab7e58b90efd4c..09cf7223ffc931f8e889c524e7aebd965ad1b11d 100644
--- a/src/snapshot-common.cc
+++ b/src/snapshot-common.cc
@@ -38,7 +38,8 @@ bool Snapshot::Initialize(Isolate* isolate) {
}
-Handle<Context> Snapshot::NewContextFromSnapshot(Isolate* isolate) {
+MaybeHandle<Context> Snapshot::NewContextFromSnapshot(
+ Isolate* isolate, Handle<FixedArray>* outdated_contexts_out) {
if (!HaveASnapshotToStartFrom()) return Handle<Context>();
base::ElapsedTimer timer;
if (FLAG_profile_deserialization) timer.Start();
@@ -47,15 +48,18 @@ Handle<Context> Snapshot::NewContextFromSnapshot(Isolate* isolate) {
Vector<const byte> context_data = ExtractContextData(&blob);
SnapshotData snapshot_data(context_data);
Deserializer deserializer(&snapshot_data);
- Object* root;
- deserializer.DeserializePartial(isolate, &root);
- CHECK(root->IsContext());
+
+ MaybeHandle<Object> maybe_context =
+ deserializer.DeserializePartial(isolate, outdated_contexts_out);
+ Handle<Object> result;
+ if (!maybe_context.ToHandle(&result)) return MaybeHandle<Context>();
+ CHECK(result->IsContext());
if (FLAG_profile_deserialization) {
double ms = timer.Elapsed().InMillisecondsF();
int bytes = context_data.length();
PrintF("[Deserializing context (%d bytes) took %0.3f ms]\n", bytes, ms);
}
- return Handle<Context>(Context::cast(root));
+ return Handle<Context>::cast(result);
}
« no previous file with comments | « src/snapshot.h ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698