Commit Graph
1504 Commits
Author SHA1 Message Date
Malte Ubl 6ef5317935 Keep read-only class bag reads compact
The read-only bag accessors made each tracked-field read site a nested
ternary with two accessor calls, and each method probe evaluated the bag
twice. Large JavaScript programs have a branch per class and property
(and per-class key tables copy the computed fallback), so three.js grew
from 703 MB to 946 MB of IR and its in-process compile ran out of the
2 GB worker heap in CI.

Move the absent-bag handling into shared helpers instead:
%dyn.class.readPropertiesOrEmpty is rebuilt in finalize like
%dyn.class.readProperties but returns a fresh, unstored empty object for
an instance without a bag, and %dyn.class.bagHas/bagHasComputed test a
key on a possibly undefined bag. Every read site is one call again, and
the three.js IR is back to 719 MB (2.16 GB peak RSS, main 2.15 GB).
2026-10-12 10:21:53 -07:00
Malte Ubl b943dd574f Keep reads through undefined receivers throwing
The read-only bag accessor returns the receiver itself for non-instances,
so an undefined bag can also mean an undefined receiver. Substitute the
empty bag only for instances: a read through undefined must still throw
Node's "Cannot read properties of undefined" TypeError (1544, 2162, 2449,
js-optional-class-fields).
2026-10-12 08:36:15 -07:00
Malte Ubl d5c31a933c Read class property bags without creating them
A class instance keeps its own dynamic properties in a lazily created bag
(`%dynProperties`). Untyped reads went through the bag accessor that
creates and stores the bag on first use: selecting a method checks the bag
for an own property shadowing it, and the named and computed fallbacks,
`in`/own probes, Reflect.get, for-in and accessor reads all looked their key
up there. So a pure read stored into the object. On a published object the
frozen-object guard rejects that store with "Cannot assign to read only
property '%dynProperties'", where Node reads without error.

Read-only bag accessors now never store. The untyped
%dyn.class.readProperties is rebuilt from the settled bag dispatch without
its lazy stores, and typed read helpers return a prototype-backed bag
instead of storing it. Every read path uses the read-only accessor: key
tests treat an absent bag as having no own keys, and lookups that must see
Object.prototype read from a fresh, unstored empty object. Writes keep the
storing accessor.

Found with tsc-ts at --checkers 8 on vercel/eve: a checker thread read
`host.commonSourceDirectory()` through an untyped interface value whose
object is the published Program.
2026-10-12 08:29:56 -07:00
Chris Tate 91bd61f6c9 Merge pull request #888 from vercel-labs/perf/codegen9
Keep runtime throw paths out of line; signed conversions for array counters
2026-10-12 09:27:29 -05:00
Chris Tate bfbe047cbb Read SCR_COLD as an attribute in the runtime ABI guard 2026-10-12 09:21:23 -05:00
Chris Tate 2391b0ebf3 Merge pull request #869 from vercel-labs/perf/parse-round4
Read charCodeAt at proven integer indices without a double round trip
2026-10-12 08:59:12 -05:00
Chris Tate 1f98312881 Merge pull request #880 from vercel-labs/feat/acyclic-contract
Acyclic contract type
2026-10-12 08:58:49 -05:00
Chris Tate bc9a33c9c7 Expect the runtime string-length bound in the bitwise range test 2026-10-12 08:54:54 -05:00
Chris Tate 936e9c5dae Merge main into perf/parse-round4 2026-10-12 08:51:31 -05:00
Chris Tate da309e1655 Identity bitwise forms over proven int32 operands return the operand (#878) 2026-10-12 08:49:35 -05:00
Chris Tate 7cf57f9ed5 Merge main into feat/acyclic-contract 2026-10-12 08:43:05 -05:00
Chris Tate d836ce0b83 try/catch discharges NoThrow (#879) 2026-10-12 08:41:35 -05:00
Malte Ubl e1ccfeeb84 codegen: signed conversions for array counters and lengths
Integer induction counters live in unsigned 64-bit slots, so every read
as a number was a uitofp i64 (a 6-7 instruction sequence on x86-64) and
every nested start an fptoui. The runtime's push path also round-tripped
the array length through a double for its bound check.

The values are at most 2^32 - 1: on 64-bit targets convert counters with
sitofp and loop starts with fptosi, convert array lengths and validated
indices through int64_t in scr_array.c, and test the push bound on the
integer length. 32-bit targets keep the unsigned conversions.

tsc-ts Excalidraw: uitofp i64 sequences 32.5 M -> 4.0 M, -0.66%
instructions on top of the throw-path change.
2026-10-12 06:40:50 -07:00
Malte Ubl b5e4bcb54e runtime: keep throw entry points cold and out of line
With runtime bitcode import, scr_throw_obj, scr_error_new and the other
throw entry points were inlined into the error paths of small compiled
functions. The inlined bodies needed callee-saved registers that every
call then saved and restored, and they made the helpers too large to
inline into their callers (1047 inlined throw bodies in tsc-ts).

Mark the 25 functions that only run while raising a JS exception
cold and noinline. The LLVM helper never imports noinline bodies, so
the throw paths stay calls. tsc-ts Excalidraw: -0.44% instructions.
2026-10-12 06:40:50 -07:00
Chris Tate 0b239089e7 Cover the integer-index charCodeAt helper in the borrowed-input ABI test 2026-10-12 08:25:43 -05:00
Chris Tate 0d2bcf9d97 Merge main into feat/acyclic-contract 2026-10-12 08:10:24 -05:00
Chris Tate 88b4e89e55 Merge main into feat/nothrow-try-catch 2026-10-12 08:07:54 -05:00
Chris Tate 0a4bf78d4a Merge main into perf/int32-or-zero-peephole 2026-10-12 08:05:16 -05:00
Chris Tate 44d22d785c Merge pull request #870 from vercel-labs/feat/contract-types
Contract types: NoThrow, Int32 and Immutable as checked type annotations
2026-10-12 07:57:28 -05:00
Chris Tate 83248651e2 Publish Immutable factory arrays only after provable index writes 2026-10-12 02:33:29 -05:00
Chris Tate f77d68f600 Keep the RC entry points of array elements in one shared descriptor (#882) 2026-10-12 01:59:44 -05:00
Chris Tate 48b5935337 Unshare repeated IR nodes before emission and contract checks 2026-10-12 01:47:05 -05:00
Chris Tate c5c6657c4e Drop guards on private constructor stores and borrow construction-only fields (#838) 2026-10-12 01:20:56 -05:00
Chris Tate 72cc828ab0 Merge main into perf/compact-array-header-2 2026-10-12 01:12:21 -05:00
Chris Tate 2ea30ede5b Merge main into perf/static-immutability 2026-10-12 01:09:18 -05:00
Chris Tate 0dee8207bb Keep self-hosting emission tests from blocking the test worker (#883) 2026-10-12 01:06:52 -05:00
Chris Tate 8ba3de7685 Merge pull request #884 from vercel-labs/ctate/store-order-parity-6abc93
Store order-parity baselines one file per fixture
2026-10-12 00:43:33 -05:00
Chris Tate 5e5ec89c76 Run the emission test's compiler passes off the test worker 2026-10-12 00:32:48 -05:00
Chris Tate 2933ebc985 Store order-parity baselines one file per fixture 2026-10-12 00:08:53 -05:00
Chris Tate 0874739c02 Run the frontend services test's compiler and processes off the test worker 2026-10-12 00:07:55 -05:00
Chris Tate 3be37b4ab3 Merge pull request #873 from vercel-labs/perf/locality
Give glibc's large blocks transparent huge pages
2026-10-11 23:53:50 -05:00
Chris Tate 4184028663 Keep self-hosting emission tests from blocking the test worker 2026-10-11 23:39:43 -05:00
Chris Tate a2a6a52522 Merge pull request #846 from vercel-labs/fix/narrowed-property-calls
Check narrowed member reads that a call can invalidate
2026-10-11 23:00:18 -05:00
Chris Tate b1f3b31546 Order the heap page size before huge page advice 2026-10-11 22:58:10 -05:00
Chris Tate 1c4b34d2da Keep publication guards after self-stores and own borrowed-result call arguments 2026-10-11 22:40:27 -05:00
Chris Tate 063a3c7956 Merge main into fix/narrowed-property-calls 2026-10-11 22:29:21 -05:00
Chris Tate f1fe105f18 Merge pull request #857 from vercel-labs/perf/map-get-inline-retain
Retain string-keyed map reads inline
2026-10-11 22:27:36 -05:00
Malte Ubl fa55ce6b07 Keep the RC entry points of array elements in one shared descriptor
Every SCR_ELEM_REF array stored its element type's retain, release and trace entry points in its own header (24 bytes), so ScrArr was 80 bytes: an 80-byte block for arrays of acyclic elements and a 96-byte block for cycle-capable ones. The three pointers now live in one constant ScrArrOps descriptor per element type, which the compiler emits once per module (@sc_arrops.*) and the runtime keeps static, and the header holds a pointer to it plus a 4-byte `cyc` flag beside `elem` that the inline RC fast paths test. ScrArr is 64 bytes: arrays take 64- and 80-byte blocks.

scr_arr_new_ref(retain, release, trace, cap) becomes scr_arr_new_ops(ops, cap); scr_set_to_arr_ref takes the result's descriptor from its caller instead of building an array from the set's key adapters. The backend names the %ScrArr fields in SCR_ARR_FIELD. The layout change bumps the runtime ABI marker to scr_runtime_abi_v13.
2026-10-11 19:46:48 -07:00
Chris Tate aa4fa790a3 Merge main into fix/narrowed-property-calls 2026-10-11 21:37:45 -05:00
Chris Tate 31aaefb4c6 Merge main into perf/map-get-inline-retain 2026-10-11 21:31:11 -05:00
Chris Tate 6b708b2e3e Merge pull request #876 from vercel-labs/perf/array-growth
Size small arrays exactly and keep map storage on the runtime allocator
2026-10-11 20:14:17 -05:00
Chris Tate 2ca61fea97 Merge pull request #872 from vercel-labs/perf/codegen
Dispatch literal switches without range tests and inline indexed-read helpers
2026-10-11 19:40:47 -05:00
Chris Tate 0755c81a3c Merge pull request #871 from vercel-labs/perf/offthread-prefault
Pre-fault allocator memory on a helper thread (Linux)
2026-10-11 19:40:24 -05:00
Malte Ubl 3c26a85d9c Merge branch 'feat/contract-types' into feat/acyclic-contract 2026-10-11 16:32:31 -07:00
Malte Ubl 3d7e8e731c Merge branch 'feat/contract-types' into feat/nothrow-try-catch 2026-10-11 16:32:27 -07:00
Malte Ubl f00e312d76 Merge branch 'feat/contract-types' into perf/int32-or-zero-peephole 2026-10-11 16:32:24 -07:00
Malte Ubl 5af0c17c39 Merge branch 'main' into perf/array-growth 2026-10-11 16:32:10 -07:00
Malte Ubl 825ff1dcfe Merge branch 'main' into perf/locality 2026-10-11 16:32:06 -07:00
Malte Ubl 448860dc94 Merge branch 'main' into perf/codegen 2026-10-11 16:32:03 -07:00
Malte Ubl 15af413acd Merge branch 'main' into feat/contract-types 2026-10-11 16:32:00 -07:00