node/deps/v8/test
Joyee Cheung e3f4d6a42e
deps: V8: backport 1361b2a49d02
Original commit message:

    [strings] improve array index hash distribution

    Previously, the hashes stored in a Name's raw_hash_field for decimal
    numeric strings (potential array indices) consist of the literal
    integer value along with the length of the string. This means
    consecutive numeric strings can have consecutive hash values, which
    can lead to O(n^2) probing for insertion in the worst case when e.g.
    a non-numeric string happen to land in the these buckets.

    This patch adds a build-time flag v8_enable_seeded_array_index_hash that
    scrambles the 24-bit array-index value stored in a Name's raw_hash_field
    to improve the distribution.

    x ^= x >> kShift; x = (x * m1) & kMask;    // round 1
    x ^= x >> kShift; x = (x * m2) & kMask;    // round 2
    x ^= x >> kShift;                          // finalize

    To decode, apply the same steps with the modular inverses of m1 and m2
    in reverse order.

    x ^= x >> kShift; x = (x * m2_inv) & kMask;    // round 1
    x ^= x >> kShift; x = (x * m1_inv) & kMask;    // round 2
    x ^= x >> kShift;                              // finalize

    where kShift = kArrayIndexValueBits / 2, kMask = kArrayIndexValueMask,
    m1, m2 (both odd) are the lower bits of the rapidhash secrets, m1_inv,
    m2_inv (modular inverses) are precomputed modular inverse of m1 and m2.
    The pre-computed values are appended to the hash_seed ByteArray in
    ReadOnlyRoots and accessed in generated code to reduce overhead.
    In call sites that don't already have access to the seeds, we read them
    from the current isolate group/isolate's read only roots.

    To consolidate the code that encode/decode these hashes, this patch
    adds MakeArrayIndexHash/DecodeArrayIndexFromHashField in C++ and CSA
    that perform seeding/unseeding if enabled, and updates places where
    encoding/decoding of array index is needed to use them.

    Bug: 477515021
    Change-Id: I350afe511951a54c4378396538152cc56565fd55
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7564330
    Reviewed-by: Leszek Swirski <leszeks@chromium.org>
    Commit-Queue: Joyee Cheung <joyee@igalia.com>
    Cr-Commit-Position: refs/heads/main@{#105596}

Refs: 1361b2a49d
Co-authored-by: Joyee Cheung <joyeec9h3@gmail.com>
Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/833
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs-private/node-private/pull/809
CVE-ID: CVE-2026-21717
2026-03-22 17:04:57 +01:00
..
benchmarks deps: update V8 to 12.4.254.14 2024-04-22 19:10:43 -03:00
bigint deps: update V8 to 11.8.172.13 2023-10-10 08:25:41 +02:00
cctest deps: V8: backport 1361b2a49d02 2026-03-22 17:04:57 +01:00
common deps: update V8 to 12.4.254.14 2024-04-22 19:10:43 -03:00
debugger deps: V8: cherry-pick f915fa4c9f41 2025-05-19 12:14:11 +02:00
debugging deps: update V8 to 12.3.219.16 2024-04-19 17:32:30 +02:00
fuzzer deps: update V8 to 12.4.254.14 2024-04-22 19:10:43 -03:00
fuzzilli deps: update V8 to 11.8.172.13 2023-10-10 08:25:41 +02:00
inspector deps: update V8 to 12.4.254.14 2024-04-22 19:10:43 -03:00
intl deps: update V8 to 12.2.281.27 2024-03-31 15:36:07 +02:00
js-perf-test deps: update V8 to 12.2.281.27 2024-03-31 15:36:07 +02:00
memory deps: update V8 to 11.9.169.7 2024-01-04 09:30:13 +01:00
message deps: update V8 to 12.3.219.16 2024-04-19 17:32:30 +02:00
mjsunit deps: V8: backport 0d5d6e71bbb0 2024-10-08 12:17:07 +02:00
mkgrokdump deps: update V8 to 12.4.254.14 2024-04-22 19:10:43 -03:00
mozilla deps: update V8 to 12.2.281.27 2024-03-31 15:36:07 +02:00
test262 deps: V8: backport 0d5d6e71bbb0 2024-10-08 12:17:07 +02:00
torque deps: update V8 to 11.9.169.7 2024-01-04 09:30:13 +01:00
unittests deps: V8: cherry-pick e3df60f3f5ab 2025-09-22 12:41:01 +00:00
wasm-api-tests deps: update V8 to 12.2.281.27 2024-03-31 15:36:07 +02:00
wasm-js deps: update V8 to 12.4.254.14 2024-04-22 19:10:43 -03:00
wasm-spec-tests deps: update V8 to 12.4.254.14 2024-04-22 19:10:43 -03:00
webkit deps: update V8 to 11.8.172.13 2023-10-10 08:25:41 +02:00
BUILD.gn deps: update V8 to 12.2.281.27 2024-03-31 15:36:07 +02:00
OWNERS deps: update V8 to 11.3.244.4 2023-03-31 14:15:23 +00:00