Commit 2ca82f21 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

Remove unused native context fields

Maps have a hard limit of 256 (non-inclusive) for the instance size in
words. For the native context object, we are very close to this upper
bound. This CL removes a few unused fields to give us a bit of
breathing room (parts of which I will use in a follow-up CL).

Bug: v8:5577
Change-Id: I096a45e47661f78f6bf23d71cbc29100e6e0592b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1706055
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62765}
parent e16e1b24
......@@ -1441,23 +1441,17 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
isolate_, object_function, "create", Builtins::kObjectCreate, 2, false);
native_context()->set_object_create(*object_create);
Handle<JSFunction> object_define_properties =
SimpleInstallFunction(isolate_, object_function, "defineProperties",
Builtins::kObjectDefineProperties, 2, true);
native_context()->set_object_define_properties(*object_define_properties);
SimpleInstallFunction(isolate_, object_function, "defineProperties",
Builtins::kObjectDefineProperties, 2, true);
Handle<JSFunction> object_define_property =
SimpleInstallFunction(isolate_, object_function, "defineProperty",
Builtins::kObjectDefineProperty, 3, true);
native_context()->set_object_define_property(*object_define_property);
SimpleInstallFunction(isolate_, object_function, "defineProperty",
Builtins::kObjectDefineProperty, 3, true);
SimpleInstallFunction(isolate_, object_function, "freeze",
Builtins::kObjectFreeze, 1, false);
Handle<JSFunction> object_get_prototype_of =
SimpleInstallFunction(isolate_, object_function, "getPrototypeOf",
Builtins::kObjectGetPrototypeOf, 1, true);
native_context()->set_object_get_prototype_of(*object_get_prototype_of);
SimpleInstallFunction(isolate_, object_function, "getPrototypeOf",
Builtins::kObjectGetPrototypeOf, 1, true);
SimpleInstallFunction(isolate_, object_function, "setPrototypeOf",
Builtins::kObjectSetPrototypeOf, 2, true);
......@@ -1466,14 +1460,11 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
SimpleInstallFunction(isolate_, object_function, "isFrozen",
Builtins::kObjectIsFrozen, 1, false);
Handle<JSFunction> object_is_sealed =
SimpleInstallFunction(isolate_, object_function, "isSealed",
Builtins::kObjectIsSealed, 1, false);
native_context()->set_object_is_sealed(*object_is_sealed);
SimpleInstallFunction(isolate_, object_function, "isSealed",
Builtins::kObjectIsSealed, 1, false);
Handle<JSFunction> object_keys = SimpleInstallFunction(
isolate_, object_function, "keys", Builtins::kObjectKeys, 1, true);
native_context()->set_object_keys(*object_keys);
SimpleInstallFunction(isolate_, object_function, "keys",
Builtins::kObjectKeys, 1, true);
SimpleInstallFunction(isolate_, object_function, "entries",
Builtins::kObjectEntries, 1, true);
SimpleInstallFunction(isolate_, object_function, "fromEntries",
......@@ -1659,10 +1650,8 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
JSFunction::SetPrototype(array_function, proto);
native_context()->set_initial_array_prototype(*proto);
Handle<JSFunction> is_arraylike = SimpleInstallFunction(
isolate_, array_function, "isArray", Builtins::kArrayIsArray, 1, true);
native_context()->set_is_arraylike(*is_arraylike);
SimpleInstallFunction(isolate_, array_function, "isArray",
Builtins::kArrayIsArray, 1, true);
SimpleInstallFunction(isolate_, array_function, "from",
Builtins::kArrayFrom, 1, false);
SimpleInstallFunction(isolate_, array_function, "of", Builtins::kArrayOf, 0,
......@@ -3673,15 +3662,11 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
factory->NewJSObject(isolate_->object_function(), AllocationType::kOld);
JSObject::AddProperty(isolate_, global, reflect_string, reflect, DONT_ENUM);
Handle<JSFunction> define_property =
SimpleInstallFunction(isolate_, reflect, "defineProperty",
Builtins::kReflectDefineProperty, 3, true);
native_context()->set_reflect_define_property(*define_property);
Handle<JSFunction> delete_property =
SimpleInstallFunction(isolate_, reflect, "deleteProperty",
Builtins::kReflectDeleteProperty, 2, true);
native_context()->set_reflect_delete_property(*delete_property);
Handle<JSFunction> apply = SimpleInstallFunction(
isolate_, reflect, "apply", Builtins::kReflectApply, 3, false);
......@@ -4338,7 +4323,6 @@ void Genesis::InitializeGlobal_harmony_weak_refs() {
Handle<Map> weak_ref_map =
factory->NewMap(JS_WEAK_REF_TYPE, JSWeakRef::kSize);
DCHECK(weak_ref_map->IsJSObjectMap());
native_context()->set_js_weak_ref_map(*weak_ref_map);
Handle<JSObject> weak_ref_prototype = factory->NewJSObject(
isolate()->object_function(), AllocationType::kOld);
......
......@@ -38,9 +38,6 @@ enum ContextLookupFlags {
// Factory::NewContext.
#define NATIVE_CONTEXT_INTRINSIC_FUNCTIONS(V) \
V(ASYNC_FUNCTION_PROMISE_CREATE_INDEX, JSFunction, \
async_function_promise_create) \
V(IS_ARRAYLIKE, JSFunction, is_arraylike) \
V(GENERATOR_NEXT_INTERNAL, JSFunction, generator_next_internal) \
V(MAKE_ERROR_INDEX, JSFunction, make_error) \
V(MAKE_RANGE_ERROR_INDEX, JSFunction, make_range_error) \
......@@ -48,20 +45,10 @@ enum ContextLookupFlags {
V(MAKE_TYPE_ERROR_INDEX, JSFunction, make_type_error) \
V(MAKE_URI_ERROR_INDEX, JSFunction, make_uri_error) \
V(OBJECT_CREATE, JSFunction, object_create) \
V(OBJECT_DEFINE_PROPERTIES, JSFunction, object_define_properties) \
V(OBJECT_DEFINE_PROPERTY, JSFunction, object_define_property) \
V(OBJECT_GET_PROTOTYPE_OF, JSFunction, object_get_prototype_of) \
V(OBJECT_IS_EXTENSIBLE, JSFunction, object_is_extensible) \
V(OBJECT_IS_FROZEN, JSFunction, object_is_frozen) \
V(OBJECT_IS_SEALED, JSFunction, object_is_sealed) \
V(OBJECT_KEYS, JSFunction, object_keys) \
V(REFLECT_APPLY_INDEX, JSFunction, reflect_apply) \
V(REFLECT_CONSTRUCT_INDEX, JSFunction, reflect_construct) \
V(REFLECT_DEFINE_PROPERTY_INDEX, JSFunction, reflect_define_property) \
V(REFLECT_DELETE_PROPERTY_INDEX, JSFunction, reflect_delete_property) \
V(MATH_FLOOR_INDEX, JSFunction, math_floor) \
V(MATH_POW_INDEX, JSFunction, math_pow) \
V(NEW_PROMISE_CAPABILITY_INDEX, JSFunction, new_promise_capability) \
V(PROMISE_INTERNAL_CONSTRUCTOR_INDEX, JSFunction, \
promise_internal_constructor) \
V(IS_PROMISE_INDEX, JSFunction, is_promise) \
......@@ -193,7 +180,6 @@ enum ContextLookupFlags {
V(JS_FINALIZATION_GROUP_CLEANUP_ITERATOR_MAP_INDEX, Map, \
js_finalization_group_cleanup_iterator_map) \
V(JS_WEAK_MAP_FUN_INDEX, JSFunction, js_weak_map_fun) \
V(JS_WEAK_REF_MAP_INDEX, Map, js_weak_ref_map) \
V(JS_WEAK_SET_FUN_INDEX, JSFunction, js_weak_set_fun) \
V(MAP_CACHE_INDEX, Object, map_cache) \
V(MAP_KEY_ITERATOR_MAP_INDEX, Map, map_key_iterator_map) \
......@@ -304,7 +290,6 @@ enum ContextLookupFlags {
V(SYMBOL_FUNCTION_INDEX, JSFunction, symbol_function) \
V(WASM_EXPORTED_FUNCTION_MAP_INDEX, Map, wasm_exported_function_map) \
V(WASM_EXCEPTION_CONSTRUCTOR_INDEX, JSFunction, wasm_exception_constructor) \
V(WASM_FUNCTION_CONSTRUCTOR_INDEX, JSFunction, wasm_function_constructor) \
V(WASM_GLOBAL_CONSTRUCTOR_INDEX, JSFunction, wasm_global_constructor) \
V(WASM_INSTANCE_CONSTRUCTOR_INDEX, JSFunction, wasm_instance_constructor) \
V(WASM_MEMORY_CONSTRUCTOR_INDEX, JSFunction, wasm_memory_constructor) \
......
......@@ -2243,7 +2243,6 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
if (enabled_features.type_reflection) {
Handle<JSFunction> function_constructor = InstallConstructorFunc(
isolate, webassembly, "Function", WebAssemblyFunction);
context->set_wasm_function_constructor(*function_constructor);
SetDummyInstanceTemplate(isolate, function_constructor);
JSFunction::EnsureHasInitialMap(function_constructor);
Handle<JSObject> function_proto(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment