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

Unified Diff: src/bootstrapper.cc

Issue 2585693002: [serializer] allocate global proxy with the expected size. (Closed)
Patch Set: Created 4 years 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/api.cc ('k') | src/heap/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index ef12f48eec4be2279678e90ea79d39203a99f088..44eb95bec8cfeafbcbf362a14c97ea704440c4ac 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -4502,12 +4502,22 @@ Genesis::Genesis(Isolate* isolate,
// and initialize it later in CreateNewGlobals.
Handle<JSGlobalProxy> global_proxy;
if (!maybe_global_proxy.ToHandle(&global_proxy)) {
- const int internal_field_count =
- !global_proxy_template.IsEmpty()
- ? global_proxy_template->InternalFieldCount()
- : 0;
- global_proxy = isolate->factory()->NewUninitializedJSGlobalProxy(
- JSGlobalProxy::SizeWithInternalFields(internal_field_count));
+ int instance_size = 0;
+ if (context_snapshot_index > 0) {
+ // The global proxy function to reinitialize this global proxy is in the
+ // context that is yet to be deserialized. We need to prepare a global
+ // proxy of the correct size.
+ Object* size = isolate->heap()->serialized_global_proxy_sizes()->get(
+ static_cast<int>(context_snapshot_index) - 1);
+ instance_size = Smi::cast(size)->value();
+ } else {
+ instance_size = JSGlobalProxy::SizeWithInternalFields(
+ global_proxy_template.IsEmpty()
+ ? 0
+ : global_proxy_template->InternalFieldCount());
+ }
+ global_proxy =
+ isolate->factory()->NewUninitializedJSGlobalProxy(instance_size);
}
// We can only de-serialize a context if the isolate was initialized from
« no previous file with comments | « src/api.cc ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698