Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 275011@main (3ee7e4f). https://bugs.webkit.org/show_bug.c…
…gi?id=269729 Emit logical right-shift for unsigned div in BBQ JIT https://bugs.webkit.org/show_bug.cgi?id=269729 rdar://120840889 Reviewed by Justin Michaud. Previously, the function BBQ::emitModOrDiv would unconditionally emit an arithmetic right-shift in cases where the lhs was a power of two. This produces the correct result when the sign bit is 0 (i.e. the lhs, interpreted as a signed 64-bit integer, is positive) but an incorrect one when the sign bit is 1: specifically, it would compute a signed division instead. By checking the sign of the division taking place and emitting a logical shift when the operation is unsigned, we get the correct result. * JSTests/wasm/stress/i64divu-sign-maintanance.js: Added. (async test): * Source/JavaScriptCore/wasm/WasmBBQJIT64.h: (JSC::Wasm::BBQJITImpl::BBQJIT::emitModOrDiv): Canonical link: https://commits.webkit.org/275011@main Canonical link: https://commits.webkit.org/274313.42@webkitglib/2.44
- Loading branch information