asm.js needs this.
Created attachment 366211 [details] Patch
Comment on attachment 366211 [details] Patch Attachment 366211 [details] did not pass jsc-ews (mac): Output: https://webkit-queues.webkit.org/results/11695667 New failing tests: microbenchmarks/integer-modulo.js.ftl-eager jsc-layout-tests.yaml/js/script-tests/integer-division-neg2tothe32-by-neg1.js.layout-ftl-eager-no-cjit microbenchmarks/integer-modulo.js.ftl-eager-no-cjit microbenchmarks/integer-modulo.js.ftl-no-cjit-no-inline-validate microbenchmarks/integer-modulo.js.ftl-no-cjit-no-put-stack-validate stress/op_mod-VarConst.js.misc-ftl-no-cjit microbenchmarks/integer-modulo.js.ftl-no-cjit-validate-sampling-profiler
I think I found the bug: I assumed that Div was rounding towards -Infinity, but it appears to round towards 0 (or x % y would not be equal to x - (x / y ) * y). I am not entirely sure how to fix it right now.