Commit Graph
6750 Commits
Author SHA1 Message Date
Chris Tate 82f5aa9608 Keep x86-64-v3 code from running slower than the baseline
- Worker programs run strip-mined typed-array loops in blocks of 128
  iterations when the program's code is compiled for x86-64-v3 or above,
  or with --cpu-dispatch. At that level the vectorized loop over bytes
  takes 128 iterations a step, so in blocks of 64 its vector code never
  ran.
- In --cpu-dispatch builds, the LLVM helper gives an x86-64-v3 copy the
  optimized code of its baseline copy when the v3 code has vectors of at
  most 128 bits, none wider, and no rounding or bit-count intrinsic in a
  loop. Its direct calls go to the callees' x86-64-v3 copies. The text
  partitioner places each x86-64-v3 copy with its baseline copy, so the
  two are optimized in one partition.
2026-10-29 20:21:41 -05:00
Chris Tate d4c6aee135 Merge main 2026-10-29 20:04:10 -05:00
Chris Tate 794ede51db Read the callee before the arguments in calls through untyped receivers (#2510) 2026-10-29 19:53:04 -05:00
Chris Tate 0af135108b Emit each loop once in the body a parameter version leaves 2026-10-29 19:52:06 -05:00
Chris Tate 7943812231 Keep omitted optional fields in the partial view's layout; save the receiver
A partial record assertion's literal now keeps the asserted type's
optional fields it omits, in their absent state, as an ordinary record
of that type does: a read yields undefined, in answers false and a write
adds the property, with no guard. Only an omitted required field is
missing from the view, and only its writes are guarded, so a write to an
absent optional field of an ordinary record of the same type no longer
throws. The receiver of a guarded write is saved whenever its value is,
so a right side that reassigns the receiver's variable no longer
redirects the check and the store.
2026-10-29 19:47:53 -05:00
Chris Tate 93e44369ea Call untyped write completion callbacks with the error argument (#2585) 2026-10-29 19:39:05 -05:00
Chris Tate 48dd898db6 Support non-Error 'error' payloads and checked-dynamic listeners in listeners() and meta events 2026-10-29 19:16:06 -05:00
Chris Tate 02ff0eb16b Read the getter first for classes that a later lowering wave reaches
A call rewritten for a getter-only name records the classes it tests. When a later wave reaches another class with the same getter, the fallback call is rewritten again for that class, instead of being skipped, so its instances also read the getter before the arguments. Before, `target.step(arg)` on such an instance threw "target.step is not a function".
2026-10-29 19:02:23 -05:00
Chris Tate d8f3565ac4 Call untyped write completion callbacks with the error argument
A write completion callback that a JavaScript module returned reaches
the stream lowering as an untyped value. Since the error-argument form
of write callbacks, the lowering refused it with SC2020, so
tests/corpus/8532-stream-saved-callback-receiver failed to compile.

Such a callback is now converted to a function of the error argument.
The stream calls it unbound with null after a successful write or with
the write's error, and ignores what it returns, as Node does.
2026-10-29 18:55:44 -05:00
Chris Tate 0f684ad25f Copy record sources field by field in Object.assign onto a live record (#2582) 2026-10-29 16:50:39 -05:00
Chris Tate e62348d849 Copy record sources field by field in Object.assign onto a live record 2026-10-29 16:46:35 -05:00
Chris Tate 7b27410698 Intl over ICU 78.3: Segmenter (grapheme, word) and default-locale toLocaleString (linux-x64-gnu) (#2504) 2026-10-29 16:42:38 -05:00
Chris Tate 78dbd98b1a Merge main 2026-10-29 16:39:31 -05:00
Chris Tate 5a48c8f1a2 Infer types for the program's own JavaScript behind SCRIPTC_INFER_JS
With SCRIPTC_INFER_JS=1, shape inference writes its overlay for the program's own JavaScript files, with or without npm-static packages, and leaves package files as they are. The analysis and overlay keep a value untyped where an inferred type would be narrower than what the program holds: awaited values of for await, iterable object literals with computed keys, matchAll and other builtin results, fields an instance may lack, overridden methods and getters, class instances reached by reflection, constructor parameters stored into wider fields, and results the analysis cannot type. A computed member name no longer folds a read that runs before its binding is initialized. In every build, a JavaScript binding written with a value that may be a string, or with a union, keeps the dynamic representation.
2026-10-29 16:31:50 -05:00
Chris Tate 2cbdc9207f Read and write record fields through keys whose literal type names fields of one type 2026-10-29 16:20:02 -05:00
Chris Tate 5bddeb9e2e Keep timer deadlines on macOS and re-arm intervals as Node does (#2579) 2026-10-29 16:14:16 -05:00
Chris Tate fb9499c846 Keep timer deadlines on macOS and re-arm intervals as Node does
The event loop slept to its next timer with nanosleep. macOS applies the
timer slack of the thread's QoS class to nanosleep: a 5 ms sleep takes
about 38 ms at utility QoS and 180 ms at background QoS, where launchd
services such as CI jobs run. Timers then fired out of order against
Node, whose libuv loop waits with a kevent timeout that keeps its
deadline at every QoS. On macOS the loop now sleeps with a kevent timeout
on a kqueue with no events, shared by every thread's loop.

Intervals also re-arm from the time their callback started, as Node's
listOnTimeout does, instead of from the clock after the callback: a
callback that takes 30 ms of a 50 ms interval keeps the ticks 50 ms
apart, and one slower than the interval makes the next tick due on the
next turn. interval-slow-callback.ts checks both against Node.
2026-10-29 16:11:17 -05:00
Chris Tate 3cd2f97c7c Ignore SIGPIPE and SIGXFSZ in executables, as Node does (#2578) 2026-10-29 16:05:14 -05:00
Chris Tate 21b919cad7 Use SSE2 and string-instruction memory routines in x86_64 musl executables (#2576) 2026-10-29 16:02:07 -05:00
Chris Tate 016ee41146 Check untyped destructuring sources in JavaScript files before reading keys (#2577) 2026-10-29 16:01:39 -05:00
Chris Tate e3a42c52a8 Ignore SIGPIPE and SIGXFSZ in executables, as Node does
Node sets SIGPIPE and SIGXFSZ to SIG_IGN at startup, so a write to a
closed pipe or past RLIMIT_FSIZE fails with EPIPE or EFBIG, and libuv's
spawns start children with every signal at its default action. The
runtime instead blocked both signals in the writing thread. On Linux the
signal a write raises goes to that thread, but on macOS it goes to the
process, so a write to a closed pipe from the fs pool's threads ended the
program with SIGPIPE.

- scr_init ignores SIGPIPE and SIGXFSZ. A process.on listener replaces the
  disposition while it is registered, as before.
- scr_fs_write_once writes directly in executables, and the fs pool's
  threads no longer block the two signals. Library builds keep the
  per-thread blocking, since their host owns the dispositions.
- scr_spawn_command starts children with SIGPIPE and SIGXFSZ at their
  default actions (POSIX_SPAWN_SETSIGDEF), for spawnSync, execFileSync
  and spawn alike.

write-signals-ignored.ts and write-signals-listener.mjs check the ignored
signals, a listener, and each spawn path's child against Node.
2026-10-29 16:00:39 -05:00
Chris Tate 4e67c5ce2c Host stdio: typed process.stdout.write slot, write-callback errors, drain, run-time-typed chunks (#2546) 2026-10-29 15:59:21 -05:00
Chris Tate 0725682c87 Check untyped destructuring sources in JavaScript files before reading keys
A JavaScript object pattern over an untyped source (the result of an untyped function, a parameter, a property of an untyped object) now checks the source first when V8 can spell it, as the `any` path in TypeScript files does: a null or undefined source throws "Cannot destructure property 'size' of 'lookup(...)' as it is null." instead of "Cannot read properties of null (reading 'size')". When the first element has a default and a static key (`{ size = 0 }`), the source is not checked first and the read throws, as in V8; this also applies to `any` sources in TypeScript files and to nullable union sources.
2026-10-29 15:58:44 -05:00
Chris Tate 7f10ed6d90 Use SSE2 and string-instruction memory routines in x86_64 musl executables
The musl lane links zig's libc, whose memset, memcmp, bcmp and strlen are
byte loops, and whose memcpy and memmove copy without string
instructions. An x86_64 musl executable now defines these six routines
(scr_musl_mem.h): SSE2 for short and medium lengths, and rep stosb or rep
movsb from 2 KiB for memset, memcpy and forward memmove. zig's
definitions are weak, so these replace them. Library artifacts keep the
routines of the program they link into.

Adds a test that checks every length up to 600 and longer ones, every
alignment in a 32-byte window, overlapping moves in both directions,
memcmp's sign at each position, and strlen up to the end of a readable
page, optimized and under ASan and UBSan.
2026-10-29 15:58:15 -05:00
Chris Tate 3b1a2c41b6 Merge main 2026-10-29 15:55:05 -05:00
Chris Tate b507472888 Take from a Readable's buffered queue by moving its head index (#2573) 2026-10-29 15:50:34 -05:00
Chris Tate 609d1c5d5b Keep partition placement stable when an edit adds a small helper (#2561) 2026-10-29 15:50:13 -05:00
Chris Tate 8d73a84baf Test only the exponent of a masked value's shift and sum in speculative integers (#2575) 2026-10-29 15:49:54 -05:00
Chris Tate 6f019151b7 Test only the exponent of a masked value's shift and sum in speculative integers 2026-10-29 15:45:58 -05:00
Chris Tate f1825611fb Collect garbage cycles across the scriptc and V8 heaps (NI-8) (#1908) 2026-10-29 15:33:24 -05:00
Chris Tate 0e6dec51d4 Test262: private static members with brand checks (#2549) 2026-10-29 15:31:06 -05:00
Chris Tate 714385609e Call private static fields through the general value-call lowering
A call through a function-valued private static field (this.#fn(...))
completed its arguments against the field's fixed parameter list, so a
rest-parameter function lost the arguments for its rest parameter, and a
function that reads arguments was refused. The call now takes the
ordinary call-through-value lanes (typed rests, runtime-arity closures,
checked-dynamic values) and binds this to the checked receiver.
2026-10-29 15:27:36 -05:00
Chris Tate b8a6d3805a Islands: CommonJS island requires, builtin-class handles, JavaScript widened bindings (#1907) 2026-10-29 15:27:09 -05:00
Chris Tate 0117f39da0 pi wave 5: union layouts and reads, provider and tool records (#2547) 2026-10-29 15:25:45 -05:00
Chris Tate 87c8d14510 Test262: String/Number/Boolean wrapper objects in JavaScript sources (#2550) 2026-10-29 15:24:04 -05:00
Chris Tate 97fc2a9ac1 Avoid call-stack overflow from spread pushes over large compiler lists (#2553) 2026-10-29 15:22:36 -05:00
Chris Tate d972a6bc13 Defer island modules whose recorded load is deterministic (NI-7b/7d/7e/7f) (#1906) 2026-10-29 15:18:28 -05:00
Chris Tate 43bafa67d1 Test262 group C: early errors, undeclared reads, async-iterator relaxation, compareArray harness (#2500) 2026-10-29 15:17:08 -05:00
Chris Tate ffa0753a82 Generic arrows: enclosing-frame captures (incl. mutable, boxed), optional-call arity, declared-arity refusal (#2506) 2026-10-29 15:14:11 -05:00
Chris Tate 145f8fcd5e fs.watch names the changed entry; fs.watchFile polls in its own gated unit (#2507) 2026-10-29 15:13:12 -05:00
Chris Tate 2de17f95df Pass every argument to emitter listeners that read arguments, and deliver the leak warning at exit (#2544) 2026-10-29 15:12:50 -05:00
Chris Tate 03b26a7e8e Stdio write hook: console lines pass (line, errorHandler), byte chunks pass a Buffer (#2511) 2026-10-29 15:12:31 -05:00
Chris Tate dfa940a82d Return freed memory sooner: chunked shared writes, a bounded string spare, idle trims (#2518) 2026-10-29 15:12:10 -05:00
Chris Tate b9587f361d Reuse lowered units across builds behind SCRIPTC_INCR_LOWERING=1 (#2521) 2026-10-29 15:11:51 -05:00
Chris Tate f2e82c68e1 Pack jammed saturating loops one copy per lane and test their exit every fourth iteration (#2522) 2026-10-29 15:11:29 -05:00
Chris Tate 4458e11a75 Read /proc/self/maps once per glibc thread heap (#2527) 2026-10-29 15:11:09 -05:00
Chris Tate 16f3c16752 Match Node's node:path behavior from Node 24's path tests (#2495) 2026-10-29 15:10:50 -05:00
Chris Tate 6b2af671e5 Weigh program profile matches by the profile's counts (#2528) 2026-10-29 15:10:28 -05:00
Chris Tate 2d2cd25d26 Count the arguments a replaced stdio write receives (#2530) 2026-10-29 15:10:03 -05:00
Chris Tate 3c9d162a99 Test the direct index once in number-key lookups, and inline the probe in loops (#2525) 2026-10-29 15:09:43 -05:00