Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a new pull request by comparing changes across two branches #979

Merged
merged 30 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
63391e7
stream: add `new` when constructing `ERR_MULTIPLE_CALLBACK`
haze Mar 18, 2024
80f86e5
src: add C++ ProcessEmitWarningSync()
joyeecheung Mar 5, 2024
5f7fad2
module: support require()ing synchronous ESM graphs
joyeecheung Mar 11, 2024
39f1b89
fs: fix edge case in readFileSync utf8 fast path
richardlau Mar 18, 2024
8a191e4
doc: update pnpm link
SuperchupuDev Mar 18, 2024
6f4d601
test_runner: skip each hooks for skipped tests
cjihrig Mar 18, 2024
4ba9f45
test_runner: ignore todo flag when running suites
cjihrig Mar 18, 2024
a21b15a
tools: update github_reporter to 1.7.0
nodejs-github-bot Mar 19, 2024
be75821
test: add test for using `--print` with promises
aduh95 Mar 19, 2024
978d5a2
test: reduce flakiness of test-runner-output.mjs
cjihrig Mar 19, 2024
4e278f0
build: speed up compilation of some V8 files
targos Mar 14, 2024
8206f6b
fs: runtime deprecate fs.Stats constructor
marco-ippolito Mar 19, 2024
70a0510
deps: update zlib to 1.3.0.1-motley-24342f6
nodejs-github-bot Mar 19, 2024
4e9ce7c
lib: make sure clear the old timer in http server
theanarkh Mar 19, 2024
7071554
doc: optimize the doc about Unix abstract socket
theanarkh Mar 19, 2024
5276c0d
test_runner: add suite()
cjihrig Mar 19, 2024
14de082
lib: emit listening event once when call listen twice
theanarkh Mar 19, 2024
61e5de1
fs: refactor maybeCallback function
anonrig Mar 19, 2024
f9755f6
test_runner: emit diagnostics when watch mode drains
MoLow Mar 19, 2024
f1949ac
doc: add spec for contains module syntax
GeoffreyBooth Mar 20, 2024
8bc7459
module: eliminate performance cost of detection for cjs entry
GeoffreyBooth Mar 20, 2024
d62ab3a
crypto: runtime deprecate hmac constructor
marco-ippolito Mar 20, 2024
7d258db
stream: support typed arrays
IlyasShabi Mar 20, 2024
f69946b
deps: update simdutf to 5.0.0
lemire Mar 20, 2024
c714cda
test: add `spawnSyncAndAssert` util
aduh95 Mar 20, 2024
f05b241
tools: sync ubsan workflow with asan
targos Mar 21, 2024
4fe8735
doc: fix typos in maintaining-dependencies.md
RoboSchmied Mar 21, 2024
0a252c2
lib: fix type error for _refreshLine
JacksonTian Mar 21, 2024
6dd1c75
crypto: fix `input` validation in `crypto.hash`
aduh95 Mar 21, 2024
0b67673
test: add missing cctest/test_path.cc
anonrig Mar 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/test-ubsan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- AUTHORS
- doc/**
- .github/**
- '!.github/workflows/ubsan-asan.yml'
- '!.github/workflows/test-ubsan.yml'
push:
branches:
- main
Expand All @@ -22,7 +22,7 @@ on:
- AUTHORS
- doc/**
- .github/**
- '!.github/workflows/ubsan-asan.yml'
- '!.github/workflows/test-ubsan.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -45,19 +45,19 @@ jobs:
LINK: g++
CONFIG_FLAGS: --enable-ubsan
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
persist-credentials: false
- name: Store suppressions path
run: |
echo "UBSAN_OPTIONS=suppressions=$GITHUB_WORKSPACE/suppressions.supp" >> $GITHUB_ENV
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Environment Information
run: npx envinfo
- name: Build
run: make build-ci -j2 V=1
- name: Test
run: make run-ci -j2 V=1 TEST_CI_ARGS="-p actions -t 300 --measure-flakiness 9"
run: make run-ci -j2 V=1 TEST_CI_ARGS="-p actions --node-args='--test-reporter=spec' --node-args='--test-reporter-destination=stdout' -t 300 --measure-flakiness 9"
1 change: 1 addition & 0 deletions benchmark/misc/startup-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const bench = common.createBenchmark(main, {
script: [
'benchmark/fixtures/require-builtins',
'test/fixtures/semicolon',
'test/fixtures/snapshot/typescript',
],
mode: ['process', 'worker'],
count: [30],
Expand Down
36 changes: 36 additions & 0 deletions benchmark/streams/readable-uint8array.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict';
const common = require('../common.js');
const { Readable } = require('stream');

const bench = common.createBenchmark(main, {
n: [1e6],
kind: ['read', 'encoding'],
});
const ABC = new Uint8Array([0x41, 0x42, 0x43]);

function main({ n, kind }) {
switch (kind) {
case 'read': {
bench.start();
const readable = new Readable({
read() {},
});
for (let i = 0; i < n; ++i) readable.push(ABC);
bench.end(n);
break;
}

case 'encoding': {
bench.start();
const readable = new Readable({
read() {},
});
readable.setEncoding('utf8');
for (let i = 0; i < n; ++i) readable.push(ABC);
bench.end(n);
break;
}
default:
throw new Error('Invalid kind');
}
}
51 changes: 51 additions & 0 deletions benchmark/streams/writable-uint8array.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
'use strict';
const common = require('../common.js');
const { Writable } = require('stream');

const bench = common.createBenchmark(main, {
n: [50e6],
kind: ['write', 'object-mode', 'writev'],
});
const ABC = new Uint8Array([0x41, 0x42, 0x43]);

function main({ n, kind }) {
switch (kind) {
case 'write': {
bench.start();
const wr = new Writable({
write(chunk, encoding, cb) {
cb();
},
});
for (let i = 0; i < n; ++i) wr.write(ABC);
bench.end(n);
break;
}

case 'object-mode': {
bench.start();
const wr = new Writable({
objectMode: true,
write(chunk, encoding, cb) {
cb();
},
});
for (let i = 0; i < n; ++i) wr.write(ABC);
bench.end(n);
break;
}
case 'writev': {
bench.start();
const wr = new Writable({
writev(chunks, cb) {
cb();
},
});
for (let i = 0; i < n; ++i) wr.write(ABC);
bench.end(n);
break;
}
default:
throw new Error('Invalid kind');
}
}
4,532 changes: 4,342 additions & 190 deletions deps/simdutf/simdutf.cpp

Large diffs are not rendered by default.

185 changes: 180 additions & 5 deletions deps/simdutf/simdutf.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* auto-generated on 2024-01-29 10:40:15 -0500. Do not edit! */
/* auto-generated on 2024-03-18 10:58:28 -0400. Do not edit! */
/* begin file include/simdutf.h */
#ifndef SIMDUTF_H
#define SIMDUTF_H
Expand Down Expand Up @@ -142,6 +142,30 @@
// s390 IBM system. Big endian.
#elif (defined(__riscv) || defined(__riscv__)) && __riscv_xlen == 64
// RISC-V 64-bit
#define SIMDUTF_IS_RISCV64 1

#if __clang_major__ >= 19
// Does the compiler support target regions for RISC-V
#define SIMDUTF_HAS_RVV_TARGET_REGION 1
#endif

#if __riscv_v_intrinsic >= 11000 && !(__GNUC__ == 13 && __GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ == 0)
#define SIMDUTF_HAS_RVV_INTRINSICS 1
#endif

#define SIMDUTF_HAS_ZVBB_INTRINSICS 0 // there is currently no way to detect this

#if SIMDUTF_HAS_RVV_INTRINSICS && __riscv_vector && __riscv_v_min_vlen >= 128 && __riscv_v_elen >= 64
// RISC-V V extension
#define SIMDUTF_IS_RVV 1
#if SIMDUTF_HAS_ZVBB_INTRINSICS && __riscv_zvbb >= 1000000
// RISC-V Vector Basic Bit-manipulation
#define SIMDUTF_IS_ZVBB 1
#endif
#endif

#elif defined(__loongarch_lp64)
// LoongArch 64-bit
#else
// The simdutf library is designed
// for 64-bit processors and it seems that you are not
Expand Down Expand Up @@ -540,6 +564,8 @@ enum error_code {
SURROGATE, // The decoded character must be not be in U+D800...DFFF (UTF-8 or UTF-32) OR
// a high surrogate must be followed by a low surrogate and a low surrogate must be preceded by a high surrogate (UTF-16) OR
// there must be no surrogate at all (Latin1)
INVALID_BASE64_CHARACTER, // Found a character that cannot be part of a valid base64 string.
BASE64_INPUT_REMAINDER, // The base64 input terminates with a single character, excluding padding (=).
OTHER // Not related to validation/transcoding.
};

Expand Down Expand Up @@ -567,22 +593,22 @@ SIMDUTF_DISABLE_UNDESIRED_WARNINGS
#define SIMDUTF_SIMDUTF_VERSION_H

/** The version of simdutf being used (major.minor.revision) */
#define SIMDUTF_VERSION "4.0.9"
#define SIMDUTF_VERSION "5.0.0"

namespace simdutf {
enum {
/**
* The major version (MAJOR.minor.revision) of simdutf being used.
*/
SIMDUTF_VERSION_MAJOR = 4,
SIMDUTF_VERSION_MAJOR = 5,
/**
* The minor version (major.MINOR.revision) of simdutf being used.
*/
SIMDUTF_VERSION_MINOR = 0,
/**
* The revision (major.minor.REVISION) of simdutf being used.
*/
SIMDUTF_VERSION_REVISION = 9
SIMDUTF_VERSION_REVISION = 0
};
} // namespace simdutf

Expand Down Expand Up @@ -654,6 +680,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <cpuid.h>
#endif


namespace simdutf {
namespace internal {

Expand All @@ -675,7 +702,9 @@ enum instruction_set {
AVX512BW = 0x4000,
AVX512VL = 0x8000,
AVX512VBMI2 = 0x10000,
AVX512VPOPCNTDQ = 0x2000
AVX512VPOPCNTDQ = 0x2000,
RVV = 0x4000,
ZVBB = 0x8000,
};

#if defined(__PPC64__)
Expand All @@ -684,6 +713,40 @@ static inline uint32_t detect_supported_architectures() {
return instruction_set::ALTIVEC;
}

#elif SIMDUTF_IS_RISCV64

#if defined(__linux__)
#include <unistd.h>
// We define these our selfs, for backwards compatibility
struct simdutf_riscv_hwprobe { int64_t key; uint64_t value; };
#define simdutf_riscv_hwprobe(...) syscall(258, __VA_ARGS__)
#define SIMDUTF_RISCV_HWPROBE_KEY_IMA_EXT_0 4
#define SIMDUTF_RISCV_HWPROBE_IMA_V (1 << 2)
#define SIMDUTF_RISCV_HWPROBE_EXT_ZVBB (1 << 17)
#endif

static inline uint32_t detect_supported_architectures() {
uint32_t host_isa = instruction_set::DEFAULT;
#if SIMDUTF_IS_RVV
host_isa |= instruction_set::RVV;
#endif
#if SIMDUTF_IS_ZVBB
host_isa |= instruction_set::ZVBB;
#endif
#if defined(__linux__)
simdutf_riscv_hwprobe probes[] = { { SIMDUTF_RISCV_HWPROBE_KEY_IMA_EXT_0, 0 } };
long ret = simdutf_riscv_hwprobe(&probes, sizeof probes/sizeof *probes, 0, nullptr, 0);
if (ret == 0) {
uint64_t extensions = probes[0].value;
if (extensions & SIMDUTF_RISCV_HWPROBE_IMA_V)
host_isa |= instruction_set::RVV;
if (extensions & SIMDUTF_RISCV_HWPROBE_EXT_ZVBB)
host_isa |= instruction_set::ZVBB;
}
#endif
return host_isa;
}

#elif defined(__aarch64__) || defined(_M_ARM64)

static inline uint32_t detect_supported_architectures() {
Expand Down Expand Up @@ -2222,6 +2285,63 @@ simdutf_warn_unused size_t trim_partial_utf16le(const char16_t* input, size_t le
*/
simdutf_warn_unused size_t trim_partial_utf16(const char16_t* input, size_t length);


/**
* Provide the maximal binary length in bytes given the base64 input.
* In general, if the input contains ASCII spaces, the result will be less than
* the maximum length.
*
* @param input the base64 input to process
* @param length the length of the base64 input in bytes
* @return number of base64 bytes
*/
simdutf_warn_unused size_t maximal_binary_length_from_base64(const char * input, size_t length) noexcept;

/**
* Convert a base64 input to a binary ouput.
*
* This function follows the WHATWG forgiving-base64 format, which means that it will
* ignore any ASCII spaces in the input. You may provide a padded input (with one or two
* equal signs at the end) or an unpadded input (without any equal signs at the end).
*
* See https://infra.spec.whatwg.org/#forgiving-base64-decode
*
* This function will fail in case of invalid input. There are two possible reasons for
* failure: the input is contains a number of base64 characters that when divided by 4, leaves
* a singler remainder character (BASE64_INPUT_REMAINDER), or the input contains a character
* that is not a valid base64 character (INVALID_BASE64_CHARACTER).
*
* You should call this function with a buffer that is at least maximal_binary_length_from_base64(input, length) bytes long.
* If you fail to provide that much space, the function may cause a buffer overflow.
*
* @param input the base64 string to process
* @param length the length of the string in bytes
* @param output the pointer to buffer that can hold the conversion result (should be at least maximal_binary_length_from_base64(input, length) bytes long).
* @return a result pair struct (of type simdutf::error containing the two fields error and count) with an error code and either position of the error (in the input in bytes) if any, or the number of bytes written if successful.
*/
simdutf_warn_unused result base64_to_binary(const char * input, size_t length, char* output) noexcept;

/**
* Provide the base64 length in bytes given the length of a binary input.
*
* @param length the length of the input in bytes
* @return number of base64 bytes
*/
simdutf_warn_unused size_t base64_length_from_binary(size_t length) noexcept;

/**
* Convert a binary input to a base64 ouput. The output is always padded with equal signs so that it is
* a multiple of 4 bytes long.
*
* This function always succeeds.
*
* @param input the binary to process
* @param length the length of the input in bytes
* @param output the pointer to buffer that can hold the conversion result (should be at least base64_length_from_binary(length) bytes long)
* @return number of written bytes, will be equal to base64_length_from_binary(length)
*/
size_t binary_to_base64(const char * input, size_t length, char* output) noexcept;

/**
* An implementation of simdutf for a particular CPU architecture.
*
Expand Down Expand Up @@ -3282,6 +3402,61 @@ class implementation {
*/
simdutf_warn_unused virtual size_t count_utf8(const char * input, size_t length) const noexcept = 0;

/**
* Provide the maximal binary length in bytes given the base64 input.
* In general, if the input contains ASCII spaces, the result will be less than
* the maximum length.
*
* @param input the base64 input to process
* @param length the length of the base64 input in bytes
* @return number of base64 bytes
*/
simdutf_warn_unused virtual size_t maximal_binary_length_from_base64(const char * input, size_t length) const noexcept = 0;

/**
* Convert a base64 input to a binary ouput.
*
* This function follows the WHATWG forgiving-base64 format, which means that it will
* ignore any ASCII spaces in the input. You may provide a padded input (with one or two
* equal signs at the end) or an unpadded input (without any equal signs at the end).
*
* See https://infra.spec.whatwg.org/#forgiving-base64-decode
*
* This function will fail in case of invalid input. There are two possible reasons for
* failure: the input is contains a number of base64 characters that when divided by 4, leaves
* a singler remainder character (BASE64_INPUT_REMAINDER), or the input contains a character
* that is not a valid base64 character (INVALID_BASE64_CHARACTER).
*
* You should call this function with a buffer that is at least maximal_binary_length_from_base64(input, length) bytes long.
* If you fail to provide that much space, the function may cause a buffer overflow.
*
* @param input the base64 string to process
* @param length the length of the string in bytes
* @param output the pointer to buffer that can hold the conversion result (should be at least maximal_binary_length_from_base64(input, length) bytes long).
* @return a result pair struct (of type simdutf::error containing the two fields error and count) with an error code and either position of the error (in the input in bytes) if any, or the number of bytes written if successful.
*/
simdutf_warn_unused virtual result base64_to_binary(const char * input, size_t length, char* output) const noexcept = 0;

/**
* Provide the base64 length in bytes given the length of a binary input.
*
* @param length the length of the input in bytes
* @return number of base64 bytes
*/
simdutf_warn_unused virtual size_t base64_length_from_binary(size_t length) const noexcept = 0;

/**
* Convert a binary input to a base64 ouput. The output is always padded with equal signs so that it is
* a multiple of 4 bytes long.
*
* This function always succeeds.
*
* @param input the binary to process
* @param length the length of the input in bytes
* @param output the pointer to buffer that can hold the conversion result (should be at least base64_length_from_binary(length) bytes long)
* @return number of written bytes, will be equal to base64_length_from_binary(length)
*/
virtual size_t binary_to_base64(const char * input, size_t length, char* output) const noexcept = 0;


protected:
Expand Down
Loading
Loading