Skip to content

runtime/binary-data: complete ArrayBuffer/DataView view and prototype semantics (c262) #4033

Description

@andrewtdiz

User outcome

Binary-heavy packages, Fetch bodies, crypto, encoders, and protocol code should be able to rely on ArrayBuffer/DataView shape, brand checks, and byte access semantics.

Current signal

Tested on current origin/main bf9802213 with Test262 pinned to 4249661388e5d3f92a85186213da140a6481490f and Node v25.9.0.

Command:

scripts/test262_subset.py --root vendor/test262 --dir built-ins/ArrayBuffer built-ins/DataView --max 80 --timeout 8 --sample-cap 20 --report target/test262-reports/arraybuffer-dataview.json

Result: pass=40, runtime-fail=40, parity=50.0%.
Per dir: built-ins/ArrayBuffer pass=27/runtime-fail=30; built-ins/DataView pass=13/runtime-fail=10.

Representative failures:

  • built-ins/ArrayBuffer/allocation-limit.js: huge lengths should throw RangeError.
  • built-ins/ArrayBuffer/isView/arg-is-dataview-subclass-instance.js: ArrayBuffer.isView should recognize DataView subclass instances.
  • built-ins/ArrayBuffer/isView/invoked-as-a-fn.js: static method is missing/not callable through the expected surface.
  • built-ins/ArrayBuffer/prototype/byteLength/*: getter/descriptor/brand checks are incomplete.
  • built-ins/ArrayBuffer/prototype/slice/end-default-if-undefined.js: slice default end behavior is wrong.

Shortest useful fix

Cover the binary object model used by app code before broader SharedArrayBuffer work:

  • Reify ArrayBuffer constructor/prototype static surface, including isView, name, length, and descriptors.
  • Implement/align ArrayBuffer.prototype.byteLength getter brand checks and descriptors.
  • Fix ArrayBuffer.prototype.slice bounds/default behavior for ordinary buffers.
  • Ensure DataView instances and subclasses are recognized by view checks.
  • Add focused c262 regression fixtures for the samples above.

Acceptance

  • Representative Test262 cases above pass.
  • The targeted ArrayBuffer/DataView slice improves materially from the current 50.0% baseline.
  • Existing Buffer, Fetch body, and TypedArray smoke tests continue to pass.

JIT product notes

Core: ordinary ArrayBuffer/DataView semantics used by real packages.
Defer: SharedArrayBuffer, Atomics, resizable/growable buffers, and transfer semantics unless already required by these samples.
Future signal: widen when Fetch/crypto/Buffer package fixtures expose deeper binary edge cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions