diff options
-rw-r--r-- | common.gypi | 2 | ||||
-rw-r--r-- | deps/v8/src/objects/objects.cc | 16 | ||||
-rw-r--r-- | deps/v8/src/objects/prototype-info.h | 2 |
3 files changed, 18 insertions, 2 deletions
diff --git a/common.gypi b/common.gypi index 210e86eeb2..008ac88929 100644 --- a/common.gypi +++ b/common.gypi @@ -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 ##### diff --git a/deps/v8/src/objects/objects.cc b/deps/v8/src/objects/objects.cc index 227cff8da4..723023b707 100644 --- a/deps/v8/src/objects/objects.cc +++ b/deps/v8/src/objects/objects.cc @@ -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()); @@ -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) { diff --git a/deps/v8/src/objects/prototype-info.h b/deps/v8/src/objects/prototype-info.h index 94d86d2e19..6f777eda89 100644 --- a/deps/v8/src/objects/prototype-info.h +++ b/deps/v8/src/objects/prototype-info.h @@ -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); }; |