Commit d254ef2b authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[cleanup] Pass isolate down to JSFunction::SetInitialMap

We have it readily available at all call-sites. There is no need to
request it via GetIsolate on the function itself.

Change-Id: I4936177c47c8adf9dfeafe1e320f8411ae358a5b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2761200Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73470}
parent c4568e43
......@@ -739,7 +739,8 @@ Handle<JSFunction> ApiNatives::CreateApiFunction(
if (immutable_proto) map->set_is_immutable_proto(true);
JSFunction::SetInitialMap(result, map, Handle<JSObject>::cast(prototype));
JSFunction::SetInitialMap(isolate, result, map,
Handle<JSObject>::cast(prototype));
return result;
}
......
......@@ -449,7 +449,7 @@ V8_NOINLINE Handle<JSFunction> CreateFunctionForBuiltinWithPrototype(
if (!IsResumableFunction(info->kind()) && prototype->IsTheHole(isolate)) {
prototype = factory->NewFunctionPrototype(result);
}
JSFunction::SetInitialMap(result, initial_map, prototype);
JSFunction::SetInitialMap(isolate, result, initial_map, prototype);
return result;
}
......
......@@ -414,7 +414,7 @@ void SetInstancePrototype(Isolate* isolate, Handle<JSFunction> function,
} else {
Handle<Map> new_map =
Map::Copy(isolate, initial_map, "SetInstancePrototype");
JSFunction::SetInitialMap(function, new_map, value);
JSFunction::SetInitialMap(isolate, function, new_map, value);
// If the function is used as the global Array function, cache the
// updated initial maps (and transitioned versions) in the native context.
......@@ -486,15 +486,14 @@ void JSFunction::SetPrototype(Handle<JSFunction> function,
SetInstancePrototype(isolate, function, construct_prototype);
}
void JSFunction::SetInitialMap(Handle<JSFunction> function, Handle<Map> map,
Handle<HeapObject> prototype) {
SetInitialMap(function, map, prototype, function);
void JSFunction::SetInitialMap(Isolate* isolate, Handle<JSFunction> function,
Handle<Map> map, Handle<HeapObject> prototype) {
SetInitialMap(isolate, function, map, prototype, function);
}
void JSFunction::SetInitialMap(Handle<JSFunction> function, Handle<Map> map,
Handle<HeapObject> prototype,
void JSFunction::SetInitialMap(Isolate* isolate, Handle<JSFunction> function,
Handle<Map> map, Handle<HeapObject> prototype,
Handle<JSFunction> constructor) {
Isolate* isolate = function->GetIsolate();
if (map->prototype() != *prototype) {
Map::SetPrototype(isolate, map, prototype);
}
......@@ -553,7 +552,7 @@ void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) {
// Finally link initial map and constructor function.
DCHECK(prototype->IsJSReceiver());
JSFunction::SetInitialMap(function, map, prototype);
JSFunction::SetInitialMap(isolate, function, map, prototype);
map->StartInobjectSlackTracking();
}
......@@ -725,7 +724,7 @@ bool FastInitializeDerivedMap(Isolate* isolate, Handle<JSFunction> new_target,
in_object_properties, unused_property_fields);
map->set_new_target_is_base(false);
Handle<HeapObject> prototype(new_target->instance_prototype(), isolate);
JSFunction::SetInitialMap(new_target, map, prototype, constructor);
JSFunction::SetInitialMap(isolate, new_target, map, prototype, constructor);
DCHECK(new_target->instance_prototype().IsJSReceiver());
map->set_construction_counter(Map::kNoSlackTracking);
map->StartInobjectSlackTracking();
......
......@@ -221,10 +221,10 @@ class JSFunction : public JSFunctionOrBoundFunction {
// The initial map for an object created by this constructor.
DECL_GETTER(initial_map, Map)
static void SetInitialMap(Handle<JSFunction> function, Handle<Map> map,
Handle<HeapObject> prototype);
static void SetInitialMap(Handle<JSFunction> function, Handle<Map> map,
Handle<HeapObject> prototype,
static void SetInitialMap(Isolate* isolate, Handle<JSFunction> function,
Handle<Map> map, Handle<HeapObject> prototype);
static void SetInitialMap(Isolate* isolate, Handle<JSFunction> function,
Handle<Map> map, Handle<HeapObject> prototype,
Handle<JSFunction> constructor);
DECL_GETTER(has_initial_map, bool)
V8_EXPORT_PRIVATE static void EnsureHasInitialMap(
......
......@@ -2159,7 +2159,7 @@ Handle<Map> Map::TransitionToDataProperty(Isolate* isolate, Handle<Map> map,
reason);
initial_map->DeprecateTransitionTree(isolate);
Handle<HeapObject> prototype(result->prototype(), isolate);
JSFunction::SetInitialMap(constructor, result, prototype);
JSFunction::SetInitialMap(isolate, constructor, result, prototype);
// Deoptimize all code that embeds the previous initial map.
initial_map->dependent_code().DeoptimizeDependentCodeGroup(
......
......@@ -2145,7 +2145,8 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
JSObject::cast(module_constructor->instance_prototype()), isolate);
Handle<Map> module_map = isolate->factory()->NewMap(
i::WASM_MODULE_OBJECT_TYPE, WasmModuleObject::kHeaderSize);
JSFunction::SetInitialMap(module_constructor, module_map, module_proto);
JSFunction::SetInitialMap(isolate, module_constructor, module_map,
module_proto);
InstallFunc(isolate, module_constructor, "imports", WebAssemblyModuleImports,
1);
InstallFunc(isolate, module_constructor, "exports", WebAssemblyModuleExports,
......@@ -2165,7 +2166,8 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
JSObject::cast(instance_constructor->instance_prototype()), isolate);
Handle<Map> instance_map = isolate->factory()->NewMap(
i::WASM_INSTANCE_OBJECT_TYPE, WasmInstanceObject::kHeaderSize);
JSFunction::SetInitialMap(instance_constructor, instance_map, instance_proto);
JSFunction::SetInitialMap(isolate, instance_constructor, instance_map,
instance_proto);
InstallGetter(isolate, instance_proto, "exports",
WebAssemblyInstanceGetExports);
JSObject::AddProperty(isolate, instance_proto,
......@@ -2187,7 +2189,7 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
JSObject::cast(table_constructor->instance_prototype()), isolate);
Handle<Map> table_map = isolate->factory()->NewMap(
i::WASM_TABLE_OBJECT_TYPE, WasmTableObject::kHeaderSize);
JSFunction::SetInitialMap(table_constructor, table_map, table_proto);
JSFunction::SetInitialMap(isolate, table_constructor, table_map, table_proto);
InstallGetter(isolate, table_proto, "length", WebAssemblyTableGetLength);
InstallFunc(isolate, table_proto, "grow", WebAssemblyTableGrow, 1);
InstallFunc(isolate, table_proto, "get", WebAssemblyTableGet, 1);
......@@ -2208,7 +2210,8 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
JSObject::cast(memory_constructor->instance_prototype()), isolate);
Handle<Map> memory_map = isolate->factory()->NewMap(
i::WASM_MEMORY_OBJECT_TYPE, WasmMemoryObject::kHeaderSize);
JSFunction::SetInitialMap(memory_constructor, memory_map, memory_proto);
JSFunction::SetInitialMap(isolate, memory_constructor, memory_map,
memory_proto);
InstallFunc(isolate, memory_proto, "grow", WebAssemblyMemoryGrow, 1);
InstallGetter(isolate, memory_proto, "buffer", WebAssemblyMemoryGetBuffer);
if (enabled_features.has_type_reflection()) {
......@@ -2227,7 +2230,8 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
JSObject::cast(global_constructor->instance_prototype()), isolate);
Handle<Map> global_map = isolate->factory()->NewMap(
i::WASM_GLOBAL_OBJECT_TYPE, WasmGlobalObject::kHeaderSize);
JSFunction::SetInitialMap(global_constructor, global_map, global_proto);
JSFunction::SetInitialMap(isolate, global_constructor, global_map,
global_proto);
InstallFunc(isolate, global_proto, "valueOf", WebAssemblyGlobalValueOf, 0);
InstallGetterSetter(isolate, global_proto, "value", WebAssemblyGlobalGetValue,
WebAssemblyGlobalSetValue);
......@@ -2256,7 +2260,7 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
JSObject::cast(exception_constructor->instance_prototype()), isolate);
Handle<Map> exception_map = isolate->factory()->NewMap(
i::WASM_EXCEPTION_OBJECT_TYPE, WasmExceptionObject::kHeaderSize);
JSFunction::SetInitialMap(exception_constructor, exception_map,
JSFunction::SetInitialMap(isolate, exception_constructor, exception_map,
exception_proto);
// Setup Function
......@@ -2274,7 +2278,7 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
handle(context->function_function().prototype(), isolate), false,
kDontThrow)
.FromJust());
JSFunction::SetInitialMap(function_constructor, function_map,
JSFunction::SetInitialMap(isolate, function_constructor, function_map,
function_proto);
InstallFunc(isolate, function_constructor, "type", WebAssemblyFunctionType,
1);
......
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