Skip to content

Commit 754d28e

Browse files
targosnodejs-github-bot
authored andcommitted
deps: V8: revert 6d6c1e680c7b
It depends on `std::atomic_ref`, which is not available in Xcode 16.1. Refs: v8/v8@6d6c1e6 PR-URL: #58064 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent 8c508b9 commit 754d28e

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
@@ -883,14 +883,14 @@ BUILTIN(Uint8ArrayFromHex) {
883883
base::Vector<const uint8_t> input_vector =
884884
input_content.ToOneByteVector();
885885
result = ArrayBufferFromHex(
886-
input_vector, /*is_shared*/ false,
887-
static_cast<uint8_t*>(buffer->backing_store()), output_length);
886+
input_vector, static_cast<uint8_t*>(buffer->backing_store()),
887+
output_length);
888888
} else {
889889
base::Vector<const base::uc16> input_vector =
890890
input_content.ToUC16Vector();
891891
result = ArrayBufferFromHex(
892-
input_vector, /*is_shared*/ false,
893-
static_cast<uint8_t*>(buffer->backing_store()), output_length);
892+
input_vector, static_cast<uint8_t*>(buffer->backing_store()),
893+
output_length);
894894
}
895895
}
896896

@@ -959,6 +959,11 @@ BUILTIN(Uint8ArrayPrototypeSetFromHex) {
959959
size_t output_length = (input_length / 2);
960960
output_length = std::min(output_length, array_length);
961961

962+
// TODO(rezvan): Add path for typed arrays backed by SharedArrayBuffer
963+
if (uint8array->buffer()->is_shared()) {
964+
UNIMPLEMENTED();
965+
}
966+
962967
// 7. Let result be FromHex(string, byteLength).
963968
// 8. Let bytes be result.[[Bytes]].
964969
// 9. Let written be the length of bytes.
@@ -974,15 +979,15 @@ BUILTIN(Uint8ArrayPrototypeSetFromHex) {
974979
if (input_content.IsOneByte()) {
975980
base::Vector<const uint8_t> input_vector =
976981
input_content.ToOneByteVector();
977-
result = ArrayBufferFromHex(
978-
input_vector, uint8array->buffer()->is_shared(),
979-
static_cast<uint8_t*>(uint8array->DataPtr()), output_length);
982+
result = ArrayBufferFromHex(input_vector,
983+
static_cast<uint8_t*>(uint8array->DataPtr()),
984+
output_length);
980985
} else {
981986
base::Vector<const base::uc16> input_vector =
982987
input_content.ToUC16Vector();
983-
result = ArrayBufferFromHex(
984-
input_vector, uint8array->buffer()->is_shared(),
985-
static_cast<uint8_t*>(uint8array->DataPtr()), output_length);
988+
result = ArrayBufferFromHex(input_vector,
989+
static_cast<uint8_t*>(uint8array->DataPtr()),
990+
output_length);
986991
}
987992
}
988993

@@ -1052,8 +1057,7 @@ BUILTIN(Uint8ArrayPrototypeToHex) {
10521057
// b. Set hex to StringPad(hex, 2, "0", start).
10531058
// c. Set out to the string-concatenation of out and hex.
10541059
// 6. Return out.
1055-
return Uint8ArrayToHex(bytes, length, uint8array->buffer()->is_shared(),
1056-
output);
1060+
return Uint8ArrayToHex(bytes, length, output);
10571061
}
10581062

10591063
} // 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,23 +1026,20 @@ 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
DCHECK_LE(output_length, input_length / 2);
10621033

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

10731041
#ifdef NEON64
1074-
if (!is_shared && get_vectorization_kind() == SimdKinds::kNeon) {
1042+
if (get_vectorization_kind() == SimdKinds::kNeon) {
10751043
return Uint8ArrayFromHexWithNeon(input_vector, buffer, output_length);
10761044
}
10771045
#endif
@@ -1081,12 +1049,7 @@ bool ArrayBufferFromHex(const base::Vector<T>& input_vector, bool is_shared,
10811049
for (uint32_t i = 0; i < input_length; i += 2) {
10821050
result = HandleRemainingHexValues(input_vector, i);
10831051
if (result.has_value()) {
1084-
if (is_shared) {
1085-
std::atomic_ref<uint8_t>(buffer[index++])
1086-
.store(result.value(), std::memory_order_relaxed);
1087-
} else {
1088-
buffer[index++] = result.value();
1089-
}
1052+
buffer[index++] = result.value();
10901053
} else {
10911054
return false;
10921055
}
@@ -1095,11 +1058,11 @@ bool ArrayBufferFromHex(const base::Vector<T>& input_vector, bool is_shared,
10951058
}
10961059

10971060
template bool ArrayBufferFromHex(
1098-
const base::Vector<const uint8_t>& input_vector, bool is_shared,
1099-
uint8_t* buffer, size_t output_length);
1061+
const base::Vector<const uint8_t>& input_vector, uint8_t* buffer,
1062+
size_t output_length);
11001063
template bool ArrayBufferFromHex(
1101-
const base::Vector<const base::uc16>& input_vector, bool is_shared,
1102-
uint8_t* buffer, size_t output_length);
1064+
const base::Vector<const base::uc16>& input_vector, uint8_t* buffer,
1065+
size_t output_length);
11031066

11041067
#ifdef NEON64
11051068
#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)