deps: V8: revert CL 5331688

On Windows debug builds, it is not allowed to dereference empty
iterators.

Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5331688
PR-URL: https://github.com/nodejs/node/pull/52465
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
PR-URL: https://github.com/nodejs/node/pull/54077
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
Michaël Zasso 2024-04-21 14:06:27 +02:00
parent dc4e702a45
commit 16c9348e60
No known key found for this signature in database
GPG Key ID: 770F7A9A5AE15600
7 changed files with 17 additions and 26 deletions

View File

@ -36,7 +36,7 @@
# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.6',
'v8_embedder_string': '-node.7',
##### V8 defaults for Node.js #####

View File

@ -865,10 +865,7 @@ ElementAccessFeedback const& JSHeapBroker::ProcessFeedbackMapsForElementAccess(
MapUpdaterGuardIfNeeded mumd_scope(this);
transition_target = map.object()->FindElementsKindTransitionedMap(
isolate(),
MapHandlesSpan(possible_transition_targets.begin(),
possible_transition_targets.end()),
ConcurrencyMode::kConcurrent);
isolate(), possible_transition_targets, ConcurrencyMode::kConcurrent);
}
if (transition_target.is_null()) {

20
deps/v8/src/ic/ic.cc vendored
View File

@ -375,7 +375,7 @@ void IC::ConfigureVectorState(Handle<Name> name, DirectHandle<Map> map,
OnFeedbackChanged(IsLoadGlobalIC() ? "LoadGlobal" : "Monomorphic");
}
void IC::ConfigureVectorState(Handle<Name> name, MapHandlesSpan maps,
void IC::ConfigureVectorState(Handle<Name> name, MapHandles const& maps,
MaybeObjectHandles* handlers) {
DCHECK(!IsGlobalIC());
std::vector<MapAndHandler> maps_and_handlers;
@ -741,9 +741,10 @@ bool IC::IsTransitionOfMonomorphicTarget(Tagged<Map> source_map,
source_map->elements_kind(), target_elements_kind);
Tagged<Map> transitioned_map;
if (more_general_transition) {
Handle<Map> single_map[1] = {handle(target_map, isolate_)};
MapHandles map_list;
map_list.push_back(handle(target_map, isolate_));
transitioned_map = source_map->FindElementsKindTransitionedMap(
isolate(), single_map, ConcurrencyMode::kSynchronous);
isolate(), map_list, ConcurrencyMode::kSynchronous);
}
return transitioned_map == target_map;
}
@ -1245,10 +1246,7 @@ void KeyedLoadIC::UpdateLoadElement(Handle<HeapObject> receiver,
} else if (target_receiver_maps.size() == 1) {
ConfigureVectorState(Handle<Name>(), target_receiver_maps[0], handlers[0]);
} else {
ConfigureVectorState(Handle<Name>(),
MapHandlesSpan(target_receiver_maps.begin(),
target_receiver_maps.end()),
&handlers);
ConfigureVectorState(Handle<Name>(), target_receiver_maps, &handlers);
}
}
@ -1447,9 +1445,7 @@ void KeyedLoadIC::LoadElementPolymorphicHandlers(
// generate an elements kind transition for this kind of receivers.
if (receiver_map->is_stable()) {
Tagged<Map> tmap = receiver_map->FindElementsKindTransitionedMap(
isolate(),
MapHandlesSpan(receiver_maps->begin(), receiver_maps->end()),
ConcurrencyMode::kSynchronous);
isolate(), *receiver_maps, ConcurrencyMode::kSynchronous);
if (!tmap.is_null()) {
receiver_map->NotifyLeafMapLayoutChange(isolate());
}
@ -2478,9 +2474,7 @@ void KeyedStoreIC::StoreElementPolymorphicHandlers(
} else {
{
Tagged<Map> tmap = receiver_map->FindElementsKindTransitionedMap(
isolate(),
MapHandlesSpan(receiver_maps.begin(), receiver_maps.end()),
ConcurrencyMode::kSynchronous);
isolate(), receiver_maps, ConcurrencyMode::kSynchronous);
if (!tmap.is_null()) {
if (receiver_map->is_stable()) {
receiver_map->NotifyLeafMapLayoutChange(isolate());

2
deps/v8/src/ic/ic.h vendored
View File

@ -88,7 +88,7 @@ class IC {
void ConfigureVectorState(Handle<Name> name, DirectHandle<Map> map,
const MaybeObjectHandle& handler);
// Configure the vector for POLYMORPHIC.
void ConfigureVectorState(Handle<Name> name, MapHandlesSpan maps,
void ConfigureVectorState(Handle<Name> name, MapHandles const& maps,
MaybeObjectHandles* handlers);
void ConfigureVectorState(
Handle<Name> name, std::vector<MapAndHandler> const& maps_and_handlers);

View File

@ -922,7 +922,7 @@ Handle<Map> Map::GetDerivedMap(Isolate* isolate, Handle<Map> from,
prototype);
}
static bool ContainsMap(MapHandlesSpan maps, Tagged<Map> map) {
static bool ContainsMap(MapHandles const& maps, Tagged<Map> map) {
DCHECK(!map.is_null());
for (Handle<Map> current : maps) {
if (!current.is_null() && *current == map) return true;
@ -930,7 +930,8 @@ static bool ContainsMap(MapHandlesSpan maps, Tagged<Map> map) {
return false;
}
static bool HasElementsKind(MapHandlesSpan maps, ElementsKind elements_kind) {
static bool HasElementsKind(MapHandles const& maps,
ElementsKind elements_kind) {
for (Handle<Map> current : maps) {
if (!current.is_null() && current->elements_kind() == elements_kind)
return true;
@ -939,7 +940,7 @@ static bool HasElementsKind(MapHandlesSpan maps, ElementsKind elements_kind) {
}
Tagged<Map> Map::FindElementsKindTransitionedMap(Isolate* isolate,
MapHandlesSpan candidates,
MapHandles const& candidates,
ConcurrencyMode cmode) {
DisallowGarbageCollection no_gc;

View File

@ -5,7 +5,6 @@
#ifndef V8_OBJECTS_MAP_H_
#define V8_OBJECTS_MAP_H_
#include "include/v8-memory-span.h"
#include "src/base/bit-field.h"
#include "src/common/globals.h"
#include "src/objects/code.h"
@ -138,7 +137,6 @@ enum class ObjectFields {
};
using MapHandles = std::vector<Handle<Map>>;
using MapHandlesSpan = v8::MemorySpan<Handle<Map>>;
#include "torque-generated/src/objects/map-tq.inc"
@ -851,7 +849,7 @@ class Map : public TorqueGeneratedMap<Map, HeapObject> {
// elements_kind that's found in |candidates|, or |nullptr| if no match is
// found at all.
V8_EXPORT_PRIVATE Tagged<Map> FindElementsKindTransitionedMap(
Isolate* isolate, MapHandlesSpan candidates, ConcurrencyMode cmode);
Isolate* isolate, MapHandles const& candidates, ConcurrencyMode cmode);
inline bool CanTransition() const;

View File

@ -1841,7 +1841,8 @@ static void TestReconfigureElementsKind_GeneralizeFieldInPlace(
// Ensure Map::FindElementsKindTransitionedMap() is able to find the
// transitioned map.
{
Handle<Map> map_list[1]{updated_map};
MapHandles map_list;
map_list.push_back(updated_map);
Tagged<Map> transitioned_map = map2->FindElementsKindTransitionedMap(
isolate, map_list, ConcurrencyMode::kSynchronous);
CHECK_EQ(*updated_map, transitioned_map);