mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
deps: V8: revert e3cddbedb205
simdutf's `atomic_binary_to_base64` requires `std::atomic_ref`.
`std::atomic_ref` is only available in LLVM 19, which is only available
in Xcode 16.3, which is only available on macOS 15.
Refs: https://github.com/llvm/llvm-project/pull/76647
Refs: e3cddbedb2
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
88ca8287b6
commit
8c508b9399
4 changed files with 6 additions and 73 deletions
|
@ -38,7 +38,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.6',
|
||||
'v8_embedder_string': '-node.7',
|
||||
|
||||
##### V8 defaults for Node.js #####
|
||||
|
||||
|
|
6
deps/v8/BUILD.bazel
vendored
6
deps/v8/BUILD.bazel
vendored
|
@ -4361,12 +4361,6 @@ cc_library(
|
|||
name = "simdutf",
|
||||
srcs = ["third_party/simdutf/simdutf.cpp"],
|
||||
hdrs = ["third_party/simdutf/simdutf.h"],
|
||||
copts = select({
|
||||
"@v8//bazel/config:is_clang": ["-std=c++20"],
|
||||
"@v8//bazel/config:is_gcc": ["-std=gnu++2a"],
|
||||
"@v8//bazel/config:is_windows": ["/std:c++20"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
||||
v8_library(
|
||||
|
|
15
deps/v8/src/builtins/builtins-typed-array.cc
vendored
15
deps/v8/src/builtins/builtins-typed-array.cc
vendored
|
@ -818,16 +818,11 @@ BUILTIN(Uint8ArrayPrototypeToBase64) {
|
|||
// is false.
|
||||
// 11. Return CodePointsToString(outAscii).
|
||||
|
||||
size_t simd_result_size;
|
||||
if (uint8array->buffer()->is_shared()) {
|
||||
simd_result_size = simdutf::atomic_binary_to_base64(
|
||||
std::bit_cast<const char*>(uint8array->GetBuffer()->backing_store()),
|
||||
length, reinterpret_cast<char*>(output->GetChars(no_gc)), alphabet);
|
||||
} else {
|
||||
simd_result_size = simdutf::binary_to_base64(
|
||||
std::bit_cast<const char*>(uint8array->GetBuffer()->backing_store()),
|
||||
length, reinterpret_cast<char*>(output->GetChars(no_gc)), alphabet);
|
||||
}
|
||||
// TODO(rezvan): Make sure to add a path for SharedArrayBuffers when
|
||||
// simdutf library got updated. Also, add a test for it.
|
||||
size_t simd_result_size = simdutf::binary_to_base64(
|
||||
std::bit_cast<const char*>(uint8array->GetBuffer()->backing_store()),
|
||||
length, reinterpret_cast<char*>(output->GetChars(no_gc)), alphabet);
|
||||
DCHECK_EQ(simd_result_size, output_length);
|
||||
USE(simd_result_size);
|
||||
}
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
// Copyright 2025 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --js-base-64 --allow-natives-syntax
|
||||
|
||||
const workerScript = `
|
||||
onmessage = function(event) {
|
||||
const sab = event.data.buffer;
|
||||
const uint8Array = new Uint8Array(sab);
|
||||
|
||||
const dataToWrite = [102, 111, 111, 98, 97, 114];
|
||||
|
||||
for (let i = 0; i < dataToWrite.length; ++i) {
|
||||
uint8Array[i] = dataToWrite[i];
|
||||
}
|
||||
|
||||
postMessage("started");
|
||||
|
||||
while (true) {
|
||||
for (let i = 0; i < dataToWrite.length; ++i) {
|
||||
uint8Array[i] = dataToWrite[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
`;
|
||||
|
||||
function testConcurrentSharedArrayBufferUint8ArrayToBase64() {
|
||||
const sab = new SharedArrayBuffer(6);
|
||||
const uint8ArrayMain = new Uint8Array(sab);
|
||||
|
||||
// Create a worker
|
||||
const worker = new Worker(workerScript, {type: 'string'});
|
||||
|
||||
// Send the SharedArrayBuffer
|
||||
worker.postMessage({buffer: sab});
|
||||
assertEquals('started', worker.getMessage());
|
||||
|
||||
// Give the worker a little time to write
|
||||
for (let i = 0; i < 10000; ++i) {
|
||||
}
|
||||
|
||||
// Call toBase64 on the main thread's view of the SAB
|
||||
for (let i=0; i < 100; i++) {
|
||||
const base64String = uint8ArrayMain.toBase64();
|
||||
assertEquals(
|
||||
'Zm9vYmFy', base64String,
|
||||
'toBase64 result mismatch with concurrent writes');
|
||||
}
|
||||
|
||||
// Terminate the worker (now it should exit its loop)
|
||||
worker.terminate();
|
||||
}
|
||||
|
||||
// Run the test function
|
||||
testConcurrentSharedArrayBufferUint8ArrayToBase64();
|
Loading…
Add table
Add a link
Reference in a new issue