op_mod fails on many interesting corner cases
https://bugs.webkit.org/show_bug.cgi?id=81648
Source/JavaScriptCore:
Reviewed by Oliver Hunt.
Removed most strength reduction for op_mod, and fixed the integer handling
to do the right thing for corner cases. Oddly, this revealed bugs in OSR,
which this patch also fixes.
This patch is performance neutral on all of the major benchmarks we track.
- dfg/DFGOperations.cpp:
- dfg/DFGOperations.h:
- dfg/DFGSpeculativeJIT.cpp:
(DFG):
(JSC::DFG::SpeculativeJIT::compileSoftModulo):
(JSC::DFG::SpeculativeJIT::compileArithMod):
(JIT):
(JSC):
(JSC::JIT::emit_op_mod):
(JSC::JIT::emitSlow_op_mod):
- jit/JITArithmetic32_64.cpp:
(JSC::JIT::emit_op_mod):
(JSC::JIT::emitSlow_op_mod):
(JSC::JIT::privateCompileCTIMachineTrampolines):
(JSC):
(TrampolineStructure):
(JSC::JITThunks::ctiNativeConstruct):
- llint/LowLevelInterpreter64.asm:
- wtf/Platform.h:
- wtf/SimpleStats.h:
(WTF::SimpleStats::variance):
LayoutTests:
Reviewed by Oliver Hunt.
- fast/js/integer-division-neg2tothe32-by-neg1-expected.txt: Added.
- fast/js/integer-division-neg2tothe32-by-neg1.html: Added.
- fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: Added.
(myDiv):
(myDivByNeg1):
(myDivNeg2ToThe31):
(myMod):
(myModByNeg1):
(myModNeg2ToThe31):
(myOtherDiv):
(myOtherDivByNeg1):
(myOtherDivNeg2ToThe31):
(myOtherMod):
(myOtherModByNeg1):
(myOtherModNeg2ToThe31):