Skip to content

Commit aeefb42

Browse files
committed
deps: V8: revert 6d6c1e680c7b
It depends on `std::atomic_ref`, which is not available in Xcode 16.1. Refs: v8/v8@6d6c1e6 PR-URL: nodejs#58064 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]>
1 parent fda7768 commit aeefb42

File tree

6 files changed

+39
-187
lines changed

6 files changed

+39
-187
lines changed

common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# Reset this number to 0 on major V8 upgrades.
4040
# Increment by one for each non-official patch applied to deps/v8.
41-
'v8_embedder_string': '-node.7',
41+
'v8_embedder_string': '-node.8',
4242

4343
##### V8 defaults for Node.js #####
4444

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

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -898,14 +898,14 @@ BUILTIN(Uint8ArrayFromHex) {
898898
base::Vector<const uint8_t> input_vector =
899899
input_content.ToOneByteVector();
900900
result = ArrayBufferFromHex(
901-
input_vector, /*is_shared*/ false,
902-
static_cast<uint8_t*>(buffer->backing_store()), output_length);
901+
input_vector, static_cast<uint8_t*>(buffer->backing_store()),
902+
output_length);
903903
} else {
904904
base::Vector<const base::uc16> input_vector =
905905
input_content.ToUC16Vector();
906906
result = ArrayBufferFromHex(
907-
input_vector, /*is_shared*/ false,
908-
static_cast<uint8_t*>(buffer->backing_store()), output_length);
907+
input_vector, static_cast<uint8_t*>(buffer->backing_store()),
908+
output_length);
909909
}
910910
}
911911

@@ -982,6 +982,11 @@ BUILTIN(Uint8ArrayPrototypeSetFromHex) {
982982
size_t output_length = (input_length / 2);
983983
output_length = std::min(output_length, array_length);
984984

985+
// TODO(rezvan): Add path for typed arrays backed by SharedArrayBuffer
986+
if (uint8array->buffer()->is_shared()) {
987+
UNIMPLEMENTED();
988+
}
989+
985990
// 7. Let result be FromHex(string, byteLength).
986991
// 8. Let bytes be result.[[Bytes]].
987992
// 9. Let written be the length of bytes.
@@ -997,15 +1002,15 @@ BUILTIN(Uint8ArrayPrototypeSetFromHex) {
9971002
if (input_content.IsOneByte()) {
9981003
base::Vector<const uint8_t> input_vector =
9991004
input_content.ToOneByteVector();
1000-
result = ArrayBufferFromHex(
1001-
input_vector, uint8array->buffer()->is_shared(),
1002-
static_cast<uint8_t*>(uint8array->DataPtr()), output_length);
1005+
result = ArrayBufferFromHex(input_vector,
1006+
static_cast<uint8_t*>(uint8array->DataPtr()),
1007+
output_length);
10031008
} else {
10041009
base::Vector<const base::uc16> input_vector =
10051010
input_content.ToUC16Vector();
1006-
result = ArrayBufferFromHex(
1007-
input_vector, uint8array->buffer()->is_shared(),
1008-
static_cast<uint8_t*>(uint8array->DataPtr()), output_length);
1011+
result = ArrayBufferFromHex(input_vector,
1012+
static_cast<uint8_t*>(uint8array->DataPtr()),
1013+
output_length);
10091014
}
10101015
}
10111016

@@ -1076,8 +1081,7 @@ BUILTIN(Uint8ArrayPrototypeToHex) {
10761081
// b. Set hex to StringPad(hex, 2, "0", start).
10771082
// c. Set out to the string-concatenation of out and hex.
10781083
// 6. Return out.
1079-
return Uint8ArrayToHex(bytes, length, uint8array->buffer()->is_shared(),
1080-
output);
1084+
return Uint8ArrayToHex(bytes, length, output);
10811085
}
10821086

10831087
} // namespace internal

deps/v8/src/objects/simd.cc

Lines changed: 19 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -458,38 +458,16 @@ char NibbleToHex(uint8_t nibble) {
458458
return c + (mask & correction);
459459
}
460460

461-
void PerformNibbleToHexAndWriteIntoStringOutPut(
462-
uint8_t byte, int index, DirectHandle<SeqOneByteString> string_output) {
463-
uint8_t high = byte >> 4;
464-
uint8_t low = byte & 0x0F;
465-
466-
string_output->SeqOneByteStringSet(index++, NibbleToHex(high));
467-
string_output->SeqOneByteStringSet(index, NibbleToHex(low));
468-
}
469-
470461
void Uint8ArrayToHexSlow(const char* bytes, size_t length,
471462
DirectHandle<SeqOneByteString> string_output) {
472463
int index = 0;
473464
for (size_t i = 0; i < length; i++) {
474465
uint8_t byte = bytes[i];
475-
PerformNibbleToHexAndWriteIntoStringOutPut(byte, index, string_output);
476-
index += 2;
477-
}
478-
}
466+
uint8_t high = byte >> 4;
467+
uint8_t low = byte & 0x0F;
479468

480-
void AtomicUint8ArrayToHexSlow(const char* bytes, size_t length,
481-
DirectHandle<SeqOneByteString> string_output) {
482-
int index = 0;
483-
// std::atomic_ref<T> must not have a const T, see
484-
// https://cplusplus.github.io/LWG/issue3508
485-
// we instead provide a mutable input, which is ok since we are only reading
486-
// from it.
487-
char* mutable_bytes = const_cast<char*>(bytes);
488-
for (size_t i = 0; i < length; i++) {
489-
uint8_t byte =
490-
std::atomic_ref<char>(mutable_bytes[i]).load(std::memory_order_relaxed);
491-
PerformNibbleToHexAndWriteIntoStringOutPut(byte, index, string_output);
492-
index += 2;
469+
string_output->SeqOneByteStringSet(index++, NibbleToHex(high));
470+
string_output->SeqOneByteStringSet(index++, NibbleToHex(low));
493471
}
494472
}
495473

@@ -618,14 +596,11 @@ void Uint8ArrayToHexFastWithNeon(const char* bytes, uint8_t* output,
618596
#endif
619597
} // namespace
620598

621-
Tagged<Object> Uint8ArrayToHex(const char* bytes, size_t length, bool is_shared,
599+
Tagged<Object> Uint8ArrayToHex(const char* bytes, size_t length,
622600
DirectHandle<SeqOneByteString> string_output) {
623-
// TODO(rezvan): Add relaxed version for simd methods to handle shared array
624-
// buffers.
625-
626601
#ifdef __SSE3__
627-
if (!is_shared && (get_vectorization_kind() == SimdKinds::kAVX2 ||
628-
get_vectorization_kind() == SimdKinds::kSSE)) {
602+
if (get_vectorization_kind() == SimdKinds::kAVX2 ||
603+
get_vectorization_kind() == SimdKinds::kSSE) {
629604
{
630605
DisallowGarbageCollection no_gc;
631606
Uint8ArrayToHexFastWithSSE(bytes, string_output->GetChars(no_gc), length);
@@ -635,7 +610,7 @@ Tagged<Object> Uint8ArrayToHex(const char* bytes, size_t length, bool is_shared,
635610
#endif
636611

637612
#ifdef NEON64
638-
if (!is_shared && get_vectorization_kind() == SimdKinds::kNeon) {
613+
if (get_vectorization_kind() == SimdKinds::kNeon) {
639614
{
640615
DisallowGarbageCollection no_gc;
641616
Uint8ArrayToHexFastWithNeon(bytes, string_output->GetChars(no_gc),
@@ -645,11 +620,7 @@ Tagged<Object> Uint8ArrayToHex(const char* bytes, size_t length, bool is_shared,
645620
}
646621
#endif
647622

648-
if (is_shared) {
649-
AtomicUint8ArrayToHexSlow(bytes, length, string_output);
650-
} else {
651-
Uint8ArrayToHexSlow(bytes, length, string_output);
652-
}
623+
Uint8ArrayToHexSlow(bytes, length, string_output);
653624
return *string_output;
654625
}
655626

@@ -1055,24 +1026,21 @@ bool Uint8ArrayFromHexWithNeon(const base::Vector<T>& input_vector,
10551026
} // namespace
10561027

10571028
template <typename T>
1058-
bool ArrayBufferFromHex(const base::Vector<T>& input_vector, bool is_shared,
1059-
uint8_t* buffer, size_t output_length) {
1029+
bool ArrayBufferFromHex(const base::Vector<T>& input_vector, uint8_t* buffer,
1030+
size_t output_length) {
10601031
size_t input_length = input_vector.size();
10611032
USE(input_length);
10621033
DCHECK_LE(output_length, input_length / 2);
10631034

1064-
// TODO(rezvan): Add relaxed version for simd methods to handle shared array
1065-
// buffers.
1066-
10671035
#ifdef __SSE3__
1068-
if (!is_shared && (get_vectorization_kind() == SimdKinds::kAVX2 ||
1069-
get_vectorization_kind() == SimdKinds::kSSE)) {
1036+
if (get_vectorization_kind() == SimdKinds::kAVX2 ||
1037+
get_vectorization_kind() == SimdKinds::kSSE) {
10701038
return Uint8ArrayFromHexWithSSE(input_vector, buffer, output_length);
10711039
}
10721040
#endif
10731041

10741042
#ifdef NEON64
1075-
if (!is_shared && get_vectorization_kind() == SimdKinds::kNeon) {
1043+
if (get_vectorization_kind() == SimdKinds::kNeon) {
10761044
return Uint8ArrayFromHexWithNeon(input_vector, buffer, output_length);
10771045
}
10781046
#endif
@@ -1082,12 +1050,7 @@ bool ArrayBufferFromHex(const base::Vector<T>& input_vector, bool is_shared,
10821050
for (uint32_t i = 0; i < output_length * 2; i += 2) {
10831051
result = HandleRemainingHexValues(input_vector, i);
10841052
if (result.has_value()) {
1085-
if (is_shared) {
1086-
std::atomic_ref<uint8_t>(buffer[index++])
1087-
.store(result.value(), std::memory_order_relaxed);
1088-
} else {
1089-
buffer[index++] = result.value();
1090-
}
1053+
buffer[index++] = result.value();
10911054
} else {
10921055
return false;
10931056
}
@@ -1096,11 +1059,11 @@ bool ArrayBufferFromHex(const base::Vector<T>& input_vector, bool is_shared,
10961059
}
10971060

10981061
template bool ArrayBufferFromHex(
1099-
const base::Vector<const uint8_t>& input_vector, bool is_shared,
1100-
uint8_t* buffer, size_t output_length);
1062+
const base::Vector<const uint8_t>& input_vector, uint8_t* buffer,
1063+
size_t output_length);
11011064
template bool ArrayBufferFromHex(
1102-
const base::Vector<const base::uc16>& input_vector, bool is_shared,
1103-
uint8_t* buffer, size_t output_length);
1065+
const base::Vector<const base::uc16>& input_vector, uint8_t* buffer,
1066+
size_t output_length);
11041067

11051068
#ifdef NEON64
11061069
#undef NEON64

deps/v8/src/objects/simd.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ uintptr_t ArrayIndexOfIncludesSmiOrObject(Address array_start,
2020
uintptr_t ArrayIndexOfIncludesDouble(Address array_start, uintptr_t array_len,
2121
uintptr_t from_index,
2222
Address search_element);
23-
Tagged<Object> Uint8ArrayToHex(const char* bytes, size_t length, bool is_shared,
23+
Tagged<Object> Uint8ArrayToHex(const char* bytes, size_t length,
2424
DirectHandle<SeqOneByteString> string_output);
2525
template <typename T>
26-
bool ArrayBufferFromHex(const base::Vector<T>& input_vector, bool is_shared,
27-
uint8_t* buffer, size_t output_length);
26+
bool ArrayBufferFromHex(const base::Vector<T>& input_vector, uint8_t* buffer,
27+
size_t output_length);
2828

2929
} // namespace internal
3030
} // namespace v8

deps/v8/test/mjsunit/harmony/uint8-array-set-from-hex-on-shared-array-buffer.js

Lines changed: 0 additions & 59 deletions
This file was deleted.

deps/v8/test/mjsunit/harmony/uint8-array-to-hex-on-shared-array-buffer.js

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)