haikuwebkit/LayoutTests/js/integer-division-neg2tothe3...

4210 lines
126 KiB
Plaintext
Raw Permalink Normal View History

fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
Tests that -2^31/-1 (and a bunch of other corner cases) does the right thing.
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2
PASS myOtherDivByNeg1(w) is -4
PASS myOtherDivNeg2ToThe31(v) is -1073741824
PASS myOtherMod(w, v) is 0
PASS myOtherModByNeg1(w) is 0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myDiv(x, y) is 2147483648
PASS myDivByNeg1(x) is 2147483648
PASS myDivNeg2ToThe31(y) is 2147483648
PASS myMod(x, y) is -0
PASS myMod(x, z) is -2
PASS myModByNeg1(x) is -0
fourthTier: clean up ArithDiv/ArithMod in the DFG https://bugs.webkit.org/show_bug.cgi?id=116793 Source/JavaScriptCore: Reviewed by Mark Hahnenberg. This makes ArithDiv and ArithMod behave similarly, and moves both of their implementations entirely into DFGSpeculativeJIT.cpp into methods named like the ones for ArithSub/ArithMul. Specifically, ArithMod now uses the wrap-in-conversion-nodes idiom that ArithDiv used for platforms that don't support integer division. Previously ArithMod had its own int-to-double and double-to-int conversions for this purpose. As well, this gets rid of confusing methods like compileSoftModulo() (which did no such thing, there wasn't anything "soft" about it) and compileIntegerArithDivForX86() (which is accurately named but we don't use the platform-specific method convention anywhere else). Finally, this takes the optimized power-of-two modulo operation that was previously only for ARMv7s, and makes it available for all platforms. Well, sort of: I actually rewrote it to do what latest LLVM appears to do, which is a crazy straight-line power-of-2 modulo based on a combination of shifts, ands, additions, and subtractions. I can kind of understand it well enough to see that it complies with both C and JS power-of-2 modulo semantics. I've also confirmed that it does by testing (hence the corresponding improvements to one of the division tests). But, I don't claim to know exactly how this code works other than to observe that it is super leet. Overall, this patch has the effect of killing some code (no more hackish int-to-double conversions in ArithMod), making some optimization work on more platforms, and making the compiler less confusing by doing more things with the same idiom. * dfg/DFGAbstractState.cpp: (JSC::DFG::AbstractState::executeEffects): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGSpeculativeJIT.cpp: (DFG): (JSC::DFG::SpeculativeJIT::compileArithDiv): (JSC::DFG::SpeculativeJIT::compileArithMod): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): LayoutTests: Reviewed by Mark Hahnenberg. * fast/js/script-tests/integer-division-neg2tothe32-by-neg1.js: (myModBy2): (myModBy1073741824): Canonical link: https://commits.webkit.org/136970@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-07-25 04:01:11 +00:00
PASS myModBy2(x) is -0
PASS myModBy1073741824(x) is -0
PASS myModBy2(y) is -1
PASS myModBy1073741824(y) is -1
PASS myModBy2(z) is 1
PASS myModBy1073741824(z) is 3
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS myModNeg2ToThe31(y) is -0
PASS myOtherDiv(w, v) is 2147483648
PASS myOtherDivByNeg1(w) is 2147483648
PASS myOtherDivNeg2ToThe31(v) is 2147483648
PASS myOtherMod(w, v) is -0
PASS myOtherModByNeg1(w) is -0
PASS myOtherModNeg2ToThe31(v) is -0
PASS myOtherModNeg2ToThe31(3) is -2
PASS myDivExpectingInt(x, y) is x
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/JIT.h: (JIT): * jit/JITArithmetic.cpp: (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): * jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC): * jit/JITStubs.h: (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): Canonical link: https://commits.webkit.org/98989@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-03-21 01:29:28 +00:00
PASS successfullyParsed is true
TEST COMPLETE