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