Skip to content

Support named properties and Symbol.species on typed arrays held as untyped values - #2068

Merged
ctate merged 10 commits into
mainfrom
ctate/support-named-properties-b5ca97
Oct 25, 2026
Merged

ctate merged 10 commits into
mainfrom
ctate/support-named-properties-b5ca97

Conversation

@ctate

@ctate ctate commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator
  • Typed arrays, Buffers and DataViews keep the properties a program adds, and reflection, for-in, spread, JSON and console.log see them, as in Node.
  • map, filter, slice and subarray construct through constructor[Symbol.species]; Test262's speciesctor tests go from 0 to 44 passing, and TypedArrayConstructors/internals from 12 to 34.
  • Performance neutral: bench:runtime geomean +0.4% against Run TypedArray methods on typed arrays held as untyped values #2043, at 0.26x Node; the two single-layout "slower" verdicts are neutral with --layouts=4.

@vercel

vercel Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
scriptc Ready Ready Preview, v0 Oct 25, 2026 9:17am UTC

Comment thread packages/runtime/src/scr_json.c Outdated
Comment thread packages/runtime/src/scr_json.c
Comment thread packages/runtime/src/scr_json.c
…compiler

- The native toolchain test's fixture runtime pack hard-coded ABI v37, so
  with this branch's marker (v40) the toolchain refused the pack and the
  test saw exit status 1. It now takes RUNTIME_ABI_VERSION and
  RUNTIME_ABI_MARKER from runtime-abi.ts, as the native driver test does.
… and read element descriptors

- A built-in typed-array constructor set as a view's `constructor` is its
  own species, as the getter it inherits from %TypedArray% returns it:
  `u8.constructor = Float64Array; u8.map(f)` makes a Float64Array. An own
  Symbol.species on the constructor still wins.
- TypedArray.prototype.slice with a species constructor creates the
  result first and then copies the source's current elements, up to its
  current length: a constructor that changes the source is seen.
- Object.defineProperty on a typed-array element reads the descriptor as
  ToPropertyDescriptor does, through its getters and in its order, and
  throws a TypeError for a primitive descriptor or an accessor with a
  value. The generic object path shares the same reader.
Object.defineProperty on a typed-array index reads its descriptor with
ToPropertyDescriptor (scr_dyn_descriptor_fields_read): every field once,
in specification order, through its getter, and a primitive descriptor
throws a TypeError. 7753 now also checks that the stored value is the
value getter's result, read once; that a getter-produced writable: false
is refused after the fields are read in order; and that null, booleans,
BigInts and symbols are refused as descriptors.
…species symbol exists

A typed array whose constructor property is set to another built-in
typed-array constructor now creates that kind from map, filter, slice
and subarray when the program has not evaluated Symbol.species.
Comment thread tests/corpus/8321-typed-array-constructor-kind.js
@ctate
ctate merged commit edae637 into main Oct 25, 2026
80 checks passed
@ctate
ctate deleted the ctate/support-named-properties-b5ca97 branch October 25, 2026 10:48

This branch was successfully deployed

1 active deployment
Preview — 080fe5e5 Deployed Oct 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant