mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-09 16:42:19 +02:00
Replace the pattern of 64-bit arithmetic + sign-extend + compare with dedicated 32-bit overflow instructions that use the hardware overflow flag directly. Before: add t3, t4 / unbox_int32 t5, t3 / branch_ne t3, t5, .overflow After: add32_overflow t3, t4, .overflow On x86_64 this compiles to `add r32, r32; jo label` (the 32-bit register write implicitly zeros the upper 32 bits). On aarch64, `adds w, w, w; b.vs label` for add/sub, `smull + sxtw + cmp + b.ne` for multiply, and `negs + b.vs` for negate. Nine call sites updated: Add, Sub, Mul, Increment, Decrement, PostfixIncrement, PostfixDecrement, UnaryMinus, and CallBuiltin(abs).