Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: V8: cherry-pick d3a1a5b6c491 #31005

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion common.gypi
Expand Up @@ -39,7 +39,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.23',
'v8_embedder_string': '-node.24',

##### V8 defaults for Node.js #####

Expand Down
16 changes: 16 additions & 0 deletions deps/v8/src/objects/objects.cc
Expand Up @@ -4038,6 +4038,13 @@ Handle<WeakArrayList> PrototypeUsers::Add(Isolate* isolate,

// If there are empty slots, use one of them.
int empty_slot = Smi::ToInt(empty_slot_index(*array));

if (empty_slot == kNoEmptySlotsMarker) {
// GCs might have cleared some references, rescan the array for empty slots.
PrototypeUsers::ScanForEmptySlots(*array);
empty_slot = Smi::ToInt(empty_slot_index(*array));
}

if (empty_slot != kNoEmptySlotsMarker) {
DCHECK_GE(empty_slot, kFirstIndex);
CHECK_LT(empty_slot, array->length());
Expand All @@ -4060,6 +4067,15 @@ Handle<WeakArrayList> PrototypeUsers::Add(Isolate* isolate,
return array;
}

// static
void PrototypeUsers::ScanForEmptySlots(WeakArrayList array) {
for (int i = kFirstIndex; i < array.length(); i++) {
if (array.Get(i)->IsCleared()) {
PrototypeUsers::MarkSlotEmpty(array, i);
}
}
}

WeakArrayList PrototypeUsers::Compact(Handle<WeakArrayList> array, Heap* heap,
CompactionCallback callback,
AllocationType allocation) {
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/objects/prototype-info.h
Expand Up @@ -99,7 +99,7 @@ class V8_EXPORT_PRIVATE PrototypeUsers : public WeakArrayList {
static inline Smi empty_slot_index(WeakArrayList array);
static inline void set_empty_slot_index(WeakArrayList array, int index);

static void IsSlotEmpty(WeakArrayList array, int index);
static void ScanForEmptySlots(WeakArrayList array);

DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeUsers);
};
Expand Down