Skip to content

Commit

Permalink
deps: V8: revert CL 5331688
Browse files Browse the repository at this point in the history
On Windows debug builds, it is not allowed to dereference empty
iterators.

Refs: https://chromium-review.googlesource.com/c/v8/v8/+/5331688
PR-URL: nodejs#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: nodejs#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>
  • Loading branch information
targos authored and pull[bot] committed Aug 26, 2024
1 parent 85c5c36 commit 18ea996
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 26 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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 #####

Expand Down
5 changes: 1 addition & 4 deletions deps/v8/src/compiler/js-heap-broker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
20 changes: 7 additions & 13 deletions deps/v8/src/ic/ic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/ic/ic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions deps/v8/src/objects/map.cc
Original file line number Diff line number Diff line change
Expand Up @@ -922,15 +922,16 @@ 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;
}
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;
Expand All @@ -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;

Expand Down
4 changes: 1 addition & 3 deletions deps/v8/src/objects/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion deps/v8/test/cctest/test-field-type-tracking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 18ea996

Please sign in to comment.