From 0d6ac38b1305b3800dc17fab3ee5b614ced4b077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sun, 21 Apr 2024 14:06:27 +0200 Subject: [PATCH] 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 Reviewed-By: Rafael Gonzaga Reviewed-By: Michael Dawson --- common.gypi | 2 +- deps/v8/src/compiler/js-heap-broker.cc | 5 +---- deps/v8/src/ic/ic.cc | 20 +++++++------------ deps/v8/src/ic/ic.h | 2 +- deps/v8/src/objects/map.cc | 7 ++++--- deps/v8/src/objects/map.h | 4 +--- .../test/cctest/test-field-type-tracking.cc | 3 ++- 7 files changed, 17 insertions(+), 26 deletions(-) diff --git a/common.gypi b/common.gypi index 655885de455..de019fdd6d7 100644 --- a/common.gypi +++ b/common.gypi @@ -37,7 +37,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.8', + 'v8_embedder_string': '-node.9', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/compiler/js-heap-broker.cc b/deps/v8/src/compiler/js-heap-broker.cc index c354bac375f..5355f3d9308 100644 --- a/deps/v8/src/compiler/js-heap-broker.cc +++ b/deps/v8/src/compiler/js-heap-broker.cc @@ -832,10 +832,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()) { diff --git a/deps/v8/src/ic/ic.cc b/deps/v8/src/ic/ic.cc index 8a082357f2c..4f2a88a90ef 100644 --- a/deps/v8/src/ic/ic.cc +++ b/deps/v8/src/ic/ic.cc @@ -374,7 +374,7 @@ void IC::ConfigureVectorState(Handle name, Handle map, OnFeedbackChanged(IsLoadGlobalIC() ? "LoadGlobal" : "Monomorphic"); } -void IC::ConfigureVectorState(Handle name, MapHandlesSpan maps, +void IC::ConfigureVectorState(Handle name, MapHandles const& maps, MaybeObjectHandles* handlers) { DCHECK(!IsGlobalIC()); std::vector maps_and_handlers; @@ -740,9 +740,10 @@ bool IC::IsTransitionOfMonomorphicTarget(Tagged source_map, source_map->elements_kind(), target_elements_kind); Tagged transitioned_map; if (more_general_transition) { - Handle 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; } @@ -1241,10 +1242,7 @@ void KeyedLoadIC::UpdateLoadElement(Handle receiver, if (target_receiver_maps.size() == 1) { ConfigureVectorState(Handle(), target_receiver_maps[0], handlers[0]); } else { - ConfigureVectorState(Handle(), - MapHandlesSpan(target_receiver_maps.begin(), - target_receiver_maps.end()), - &handlers); + ConfigureVectorState(Handle(), target_receiver_maps, &handlers); } } @@ -1441,9 +1439,7 @@ void KeyedLoadIC::LoadElementPolymorphicHandlers( // generate an elements kind transition for this kind of receivers. if (receiver_map->is_stable()) { Tagged 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()); } @@ -2470,9 +2466,7 @@ void KeyedStoreIC::StoreElementPolymorphicHandlers( } else { { Tagged 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()); diff --git a/deps/v8/src/ic/ic.h b/deps/v8/src/ic/ic.h index 7c97b6fb9b2..22deda652be 100644 --- a/deps/v8/src/ic/ic.h +++ b/deps/v8/src/ic/ic.h @@ -87,7 +87,7 @@ class IC { void ConfigureVectorState(Handle name, Handle map, const MaybeObjectHandle& handler); // Configure the vector for POLYMORPHIC. - void ConfigureVectorState(Handle name, MapHandlesSpan maps, + void ConfigureVectorState(Handle name, MapHandles const& maps, MaybeObjectHandles* handlers); void ConfigureVectorState( Handle name, std::vector const& maps_and_handlers); diff --git a/deps/v8/src/objects/map.cc b/deps/v8/src/objects/map.cc index 91cd461f5da..6014e8f16cd 100644 --- a/deps/v8/src/objects/map.cc +++ b/deps/v8/src/objects/map.cc @@ -936,7 +936,7 @@ Handle Map::GetDerivedMap(Isolate* isolate, Handle from, prototype); } -static bool ContainsMap(MapHandlesSpan maps, Tagged map) { +static bool ContainsMap(MapHandles const& maps, Tagged map) { DCHECK(!map.is_null()); for (Handle current : maps) { if (!current.is_null() && *current == map) return true; @@ -944,7 +944,8 @@ static bool ContainsMap(MapHandlesSpan maps, Tagged map) { return false; } -static bool HasElementsKind(MapHandlesSpan maps, ElementsKind elements_kind) { +static bool HasElementsKind(MapHandles const& maps, + ElementsKind elements_kind) { for (Handle current : maps) { if (!current.is_null() && current->elements_kind() == elements_kind) return true; @@ -953,7 +954,7 @@ static bool HasElementsKind(MapHandlesSpan maps, ElementsKind elements_kind) { } Tagged Map::FindElementsKindTransitionedMap(Isolate* isolate, - MapHandlesSpan candidates, + MapHandles const& candidates, ConcurrencyMode cmode) { DisallowGarbageCollection no_gc; diff --git a/deps/v8/src/objects/map.h b/deps/v8/src/objects/map.h index 35422a592f8..cf0f105e215 100644 --- a/deps/v8/src/objects/map.h +++ b/deps/v8/src/objects/map.h @@ -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" @@ -136,7 +135,6 @@ enum class ObjectFields { }; using MapHandles = std::vector>; -using MapHandlesSpan = v8::MemorySpan>; #include "torque-generated/src/objects/map-tq.inc" @@ -846,7 +844,7 @@ class Map : public TorqueGeneratedMap { // elements_kind that's found in |candidates|, or |nullptr| if no match is // found at all. V8_EXPORT_PRIVATE Tagged FindElementsKindTransitionedMap( - Isolate* isolate, MapHandlesSpan candidates, ConcurrencyMode cmode); + Isolate* isolate, MapHandles const& candidates, ConcurrencyMode cmode); inline bool CanTransition() const; diff --git a/deps/v8/test/cctest/test-field-type-tracking.cc b/deps/v8/test/cctest/test-field-type-tracking.cc index cdd1960acd7..8c79e39ea4f 100644 --- a/deps/v8/test/cctest/test-field-type-tracking.cc +++ b/deps/v8/test/cctest/test-field-type-tracking.cc @@ -1837,7 +1837,8 @@ static void TestReconfigureElementsKind_GeneralizeFieldInPlace( // Ensure Map::FindElementsKindTransitionedMap() is able to find the // transitioned map. { - Handle map_list[1]{updated_map}; + MapHandles map_list; + map_list.push_back(updated_map); Tagged transitioned_map = map2->FindElementsKindTransitionedMap( isolate, map_list, ConcurrencyMode::kSynchronous); CHECK_EQ(*updated_map, transitioned_map);