node/benchmark/misc
Filip Skokan ff101999ed
lib: refactor internal webidl converters
Rework lib/internal/webidl.js into a documented shared converter module
that follows the Web IDL conversion algorithms more closely.

Improvements:
- Add documented converters and helper factories for primitive values,
  dictionaries, enums, sequences, interfaces, required arguments,
  integers, `Uint8Array`, and `BufferSource`.
- Move WebCrypto onto the shared converters, while keeping compatibility
  wrappers for its existing `BufferSource` and `BigInteger` behavior.
- Use shared converters from Blob, Performance, Web Locks, and
  structured clone option handling.
- Add benchmarks for `ConvertToInt` and WebCrypto Web IDL converter hot
  paths.
- Add focused tests for core converters, WebCrypto converters, integer
  conversion, and buffer source behavior.

Fixes:
- Make the shared `BufferSource` and `Uint8Array` converters reject
  resizable `ArrayBuffer` and growable `SharedArrayBuffer` backing
  stores unless explicitly allowed. WebCrypto preserves its legacy
  resizable backing-store behavior through compatibility wrappers until
  a semver-major follow-up can opt in to the stricter behavior.
- Use Web IDL `ToNumber` and `ToString` behavior for BigInt, Symbol, and
  object primitive conversion.
- Use exact BigInt modulo for 64-bit `ConvertToInt` wrapping and
  document the final Number approximation behavior.
- Normalize mathematical modulo results to `+0` where Web IDL requires
  it.
- Process inherited dictionaries in least-derived to most-derived order,
  sorting members only within each dictionary level.
- Use `IteratorComplete` truthiness for sequence conversion.
- Cover detached buffers, resizable-backed views, growable-backed views,
  cross-realm buffer sources, mutation-after-call behavior, inherited
  dictionary member order, and sequence iterator completion behavior.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/62979
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-05-04 15:21:45 +00:00
..
arguments.js
freelist.js
getstringwidth.js
object-property-bench.js
print.js
startup-cli-version.js benchmark: rename count to n 2024-08-10 20:07:54 +00:00
startup-core.js benchmark: add startup benchmark for ESM entrypoint 2026-02-19 12:52:25 +00:00
structured-clone.js src: implement structuredClone in native 2023-10-25 17:45:11 +00:00
trace.js
util-extend-vs-object-assign.js Revert "util: move util._extend to eol" 2024-06-14 13:07:58 +00:00
webcrypto-webidl.js lib: refactor internal webidl converters 2026-05-04 15:21:45 +00:00
webidl-buffer-source.js lib: short-circuit WebIDL BufferSource SAB check 2026-04-22 07:37:54 +00:00
webidl-convert-to-int.js lib: refactor internal webidl converters 2026-05-04 15:21:45 +00:00