Skip to content

Commit 7dd68ac

Browse files
committed
deps: V8: cherry-pick 8ebd894186ed
Original commit message: [LTS-M86][builtins] Fix Array.prototype.concat with @@species (cherry picked from commit 7989e04979c3195e60a6814e8263063eb91f7b47) No-Try: true No-Presubmit: true No-Tree-Checks: true Bug: chromium:1195977 Change-Id: I16843bce2e9f776abca0f2b943b898ab5e597e42 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2810787 Reviewed-by: Camillo Bruni <cbruni@chromium.org> Commit-Queue: Igor Sheludko <ishell@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#73842} Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2823829 Commit-Queue: Jana Grill <janagrill@chromium.org> Reviewed-by: Igor Sheludko <ishell@chromium.org> Reviewed-by: Victor-Gabriel Savu <vsavu@google.com> Cr-Commit-Position: refs/branch-heads/8.6@{#77} Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1} Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472} Refs: v8/v8@8ebd894 PR-URL: #38275 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>
1 parent a4a9246 commit 7dd68ac

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Reset this number to 0 on major V8 upgrades.
3838
# Increment by one for each non-official patch applied to deps/v8.
39-
'v8_embedder_string': '-node.51',
39+
'v8_embedder_string': '-node.52',
4040

4141
##### V8 defaults for Node.js #####
4242

deps/v8/src/builtins/builtins-array.cc

+9-6
Original file line numberDiff line numberDiff line change
@@ -649,11 +649,14 @@ class ArrayConcatVisitor {
649649
index_offset_(0u),
650650
bit_field_(FastElementsField::encode(fast_elements) |
651651
ExceedsLimitField::encode(false) |
652-
IsFixedArrayField::encode(storage->IsFixedArray()) |
652+
IsFixedArrayField::encode(storage->IsFixedArray(isolate)) |
653653
HasSimpleElementsField::encode(
654-
storage->IsFixedArray() ||
655-
!storage->map().IsCustomElementsReceiverMap())) {
656-
DCHECK(!(this->fast_elements() && !is_fixed_array()));
654+
storage->IsFixedArray(isolate) ||
655+
// Don't take fast path for storages that might have
656+
// side effects when storing to them.
657+
(!storage->map(isolate).IsCustomElementsReceiverMap() &&
658+
!storage->IsJSTypedArray(isolate)))) {
659+
DCHECK_IMPLIES(this->fast_elements(), is_fixed_array());
657660
}
658661

659662
~ArrayConcatVisitor() { clear_storage(); }
@@ -1063,8 +1066,8 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
10631066
return IterateElementsSlow(isolate, receiver, length, visitor);
10641067
}
10651068

1066-
if (!HasOnlySimpleElements(isolate, *receiver) ||
1067-
!visitor->has_simple_elements()) {
1069+
if (!visitor->has_simple_elements() ||
1070+
!HasOnlySimpleElements(isolate, *receiver)) {
10681071
return IterateElementsSlow(isolate, receiver, length, visitor);
10691072
}
10701073
Handle<JSObject> array = Handle<JSObject>::cast(receiver);

deps/v8/src/objects/fixed-array-inl.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -309,15 +309,15 @@ int Search(T* array, Name name, int valid_entries, int* out_insertion_index) {
309309
double FixedDoubleArray::get_scalar(int index) {
310310
DCHECK(map() != GetReadOnlyRoots().fixed_cow_array_map() &&
311311
map() != GetReadOnlyRoots().fixed_array_map());
312-
DCHECK(index >= 0 && index < this->length());
312+
DCHECK_LT(static_cast<unsigned>(index), static_cast<unsigned>(length()));
313313
DCHECK(!is_the_hole(index));
314314
return ReadField<double>(kHeaderSize + index * kDoubleSize);
315315
}
316316

317317
uint64_t FixedDoubleArray::get_representation(int index) {
318318
DCHECK(map() != GetReadOnlyRoots().fixed_cow_array_map() &&
319319
map() != GetReadOnlyRoots().fixed_array_map());
320-
DCHECK(index >= 0 && index < this->length());
320+
DCHECK_LT(static_cast<unsigned>(index), static_cast<unsigned>(length()));
321321
int offset = kHeaderSize + index * kDoubleSize;
322322
// Bug(v8:8875): Doubles may be unaligned.
323323
return base::ReadUnalignedValue<uint64_t>(field_address(offset));
@@ -335,6 +335,7 @@ Handle<Object> FixedDoubleArray::get(FixedDoubleArray array, int index,
335335
void FixedDoubleArray::set(int index, double value) {
336336
DCHECK(map() != GetReadOnlyRoots().fixed_cow_array_map() &&
337337
map() != GetReadOnlyRoots().fixed_array_map());
338+
DCHECK_LT(static_cast<unsigned>(index), static_cast<unsigned>(length()));
338339
int offset = kHeaderSize + index * kDoubleSize;
339340
if (std::isnan(value)) {
340341
WriteField<double>(offset, std::numeric_limits<double>::quiet_NaN());
@@ -351,6 +352,7 @@ void FixedDoubleArray::set_the_hole(Isolate* isolate, int index) {
351352
void FixedDoubleArray::set_the_hole(int index) {
352353
DCHECK(map() != GetReadOnlyRoots().fixed_cow_array_map() &&
353354
map() != GetReadOnlyRoots().fixed_array_map());
355+
DCHECK_LT(static_cast<unsigned>(index), static_cast<unsigned>(length()));
354356
int offset = kHeaderSize + index * kDoubleSize;
355357
base::WriteUnalignedValue<uint64_t>(field_address(offset), kHoleNanInt64);
356358
}

0 commit comments

Comments
 (0)