diff --git a/src/api/api-natives.cc b/src/api/api-natives.cc index 44415e2055..a97b479d4f 100644 --- a/src/api/api-natives.cc +++ b/src/api/api-natives.cc @@ -405,7 +405,8 @@ MaybeHandle InstantiateFunction( Handle protoype_provider_templ( data->GetPrototypeProviderTemplate(), isolate); if (IsUndefined(*protoype_provider_templ, isolate)) { - prototype = isolate->factory()->NewJSObject(isolate->object_function()); + prototype = isolate->factory()->NewJSObject( + handle(native_context->object_function(), isolate)); } else { ASSIGN_RETURN_ON_EXCEPTION( isolate, prototype, diff --git a/src/objects/map.cc b/src/objects/map.cc index 8385c49a8e..a93b973287 100644 --- a/src/objects/map.cc +++ b/src/objects/map.cc @@ -1266,13 +1266,20 @@ Handle Map::Normalize(Isolate* isolate, Handle fast_map, const char* reason) { DCHECK(!fast_map->is_dictionary_map()); - Handle maybe_cache(isolate->native_context()->normalized_map_cache(), - isolate); - if (fast_map->is_prototype_map() || IsUndefined(*maybe_cache, isolate)) { + Tagged meta_map = fast_map->map(); + if (fast_map->is_prototype_map()) { use_cache = false; } Handle cache; - if (use_cache) cache = Handle::cast(maybe_cache); + if (use_cache) { + Tagged normalized_map_cache = + meta_map->native_context()->normalized_map_cache(); + use_cache = !IsUndefined(normalized_map_cache, isolate); + if (use_cache) { + cache = Handle::cast( + handle(normalized_map_cache, isolate)); + } + } Handle new_map; if (use_cache && cache