mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
A counted for loop converts its limit to an i64 endpoint. A limit that is not a literal went through the double every time: converted to double, clamped to 2^53, rounded with llvm.floor or llvm.ceil and converted back. At the default target CPU the rounding is a libm call, which a loop such as `for (let i = values.length - 1; i > at; i--)` paid on every entry even when `at` was an int32 local. A limit that is an exact integer (an int32 local, an integer view, or a proven range) is its own floor and ceiling and within ±2^53, so it is now the endpoint directly; other limits keep the double path.