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

Unified Diff: src/bootstrapper.cc

Issue 2475433008: Set global proxy internal field count based on the global object template. (Closed)
Patch Set: Address comments Created 4 years, 1 month 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-natives.cc ('k') | src/factory.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 e484c80203fe6e9b4817c3215cc18ee95a7887e3..566fde2de2e503e5eb690a9a1a328e9ca2fb712f 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -962,7 +962,7 @@ Handle<JSGlobalObject> Genesis::CreateNewGlobals(
Handle<Code> code = isolate()->builtins()->Illegal();
global_proxy_function =
factory()->NewFunction(name, code, JS_GLOBAL_PROXY_TYPE,
- JSGlobalProxy::kSizeWithInternalFields);
+ JSGlobalProxy::SizeWithInternalFields(0));
} else {
Handle<ObjectTemplateInfo> data =
v8::Utils::OpenHandle(*global_proxy_template);
@@ -4368,7 +4368,12 @@ Genesis::Genesis(Isolate* isolate,
// and initialize it later in CreateNewGlobals.
Handle<JSGlobalProxy> global_proxy;
if (!maybe_global_proxy.ToHandle(&global_proxy)) {
- global_proxy = isolate->factory()->NewUninitializedJSGlobalProxy();
+ const int internal_field_count =
+ !global_proxy_template.IsEmpty()
+ ? global_proxy_template->InternalFieldCount()
+ : 0;
+ global_proxy = isolate->factory()->NewUninitializedJSGlobalProxy(
+ JSGlobalProxy::SizeWithInternalFields(internal_field_count));
}
// We can only de-serialize a context if the isolate was initialized from
@@ -4477,9 +4482,12 @@ Genesis::Genesis(Isolate* isolate,
return;
}
+ const int proxy_size = JSGlobalProxy::SizeWithInternalFields(
+ global_proxy_template->InternalFieldCount());
+
Handle<JSGlobalProxy> global_proxy;
if (!maybe_global_proxy.ToHandle(&global_proxy)) {
- global_proxy = factory()->NewUninitializedJSGlobalProxy();
+ global_proxy = factory()->NewUninitializedJSGlobalProxy(proxy_size);
}
// CreateNewGlobals.
@@ -4496,10 +4504,9 @@ Genesis::Genesis(Isolate* isolate,
isolate->factory()->NewFunctionFromSharedFunctionInfo(
initial_map, shared, factory()->undefined_value());
DCHECK_EQ(global_proxy_data->internal_field_count(),
- v8::Context::kProxyInternalFieldCount);
+ global_proxy_template->InternalFieldCount());
Handle<Map> global_proxy_map = isolate->factory()->NewMap(
- JS_GLOBAL_PROXY_TYPE, JSGlobalProxy::kSizeWithInternalFields,
- FAST_HOLEY_SMI_ELEMENTS);
+ JS_GLOBAL_PROXY_TYPE, proxy_size, FAST_HOLEY_SMI_ELEMENTS);
JSFunction::SetInitialMap(global_proxy_function, global_proxy_map,
factory()->null_value());
global_proxy_map->set_is_access_check_needed(true);
« no previous file with comments | « src/api-natives.cc ('k') | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698