mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
## Summary This PR adds 78 stress tests that exercise JSC's JIT compilation tiers. The tests are ported from WebKit's `JSTests/stress/` and `JSTests/wasm/stress/` directories, covering all five JIT tiers: - **FTL** (41 tests): math intrinsics, string ops, regexp, arguments, exceptions, try-catch, property access, OSR, tail calls - **DFG** (14 tests): SSA, type conversion, strength reduction, arguments, internal functions, try-catch, class constructors - **Allocation sinking / OSR / LICM** (6 tests): varargs, loop unrolling, LICM - **Wasm BBQ** (11 tests): fused-if register alloc, OSR with exceptions, ipint-bbq OSR, tail calls - **Wasm OMG** (6 tests): recompile, OSR stack slots, tail call clobber Each test exercises hot loops that trigger JIT tier-up, verifying correctness of JIT-compiled code. ## Motivation The goal is to improve stability on platforms that Bun supports but are not covered by WebKit's EWS (Early Warning System). By running these JIT stress tests across all CI platforms, we can catch JIT-related regressions that would otherwise go unnoticed. ## Licensing Since the test fixtures are derived from WebKit's `JSTests/`, a `LICENSE` file is included in the test directory with the BSD 2-Clause license per WebKit's contribution policy. ## Next Steps As a follow-up, we are considering running these tests specifically under CPU emulation (without AVX) on baseline builds, to verify that JIT-generated code does not emit AVX instructions on platforms that do not support them. --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
19 lines
619 B
JavaScript
19 lines
619 B
JavaScript
// JSC test harness polyfills for Bun
|
|
// These globals are used by JSC stress tests but are not available in Bun.
|
|
|
|
// noInline: hints JSC to not inline the function. No-op in Bun.
|
|
globalThis.noInline = require("bun:jsc").noInline;
|
|
|
|
// testLoopCount: iteration count to trigger JIT tier-up (Baseline -> DFG -> FTL).
|
|
globalThis.testLoopCount = 10000;
|
|
|
|
// print: JSC's output function, mapped to console.log.
|
|
globalThis.print = console.log;
|
|
|
|
// Wasm test polyfills
|
|
globalThis.callerIsBBQOrOMGCompiled = function () {
|
|
return 1;
|
|
};
|
|
if (!globalThis.$) globalThis.$ = {};
|
|
if (!$.agent) $.agent = { report: function () {} };
|