Source/JavaScriptCore: Fix problems with processing negative zero on DFG.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Apr 2013 22:52:34 +0000 (22:52 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Apr 2013 22:52:34 +0000 (22:52 +0000)
commit135855ca9e455580bf11d4d7e704280e6d7816d8
tree36da3a08f996d0a57a5ee6da9427aaad61a22dd2
parent26b6d6d319a60ecb51a4aaf70e07e7cd5b1840ae
Source/JavaScriptCore: Fix problems with processing negative zero on DFG.
https://bugs.webkit.org/show_bug.cgi?id=113862

Patch by Roman Zhuykov <zhroma@ispras.ru> on 2013-04-25
Reviewed by Filip Pizlo.

Fix NodeNeedsNegZero flag propagation in BackwardPropagationPhase.
Function arithNodeFlags should not mask NodeNeedsNegZero flag for ArithNegate and DoubleAsInt32
nodes and this flag should be always used to decide where we need to generate nezative-zero checks.
Remove unnecessary negative-zero checks from integer ArithDiv on ARM.
Also remove such checks from integer ArithMod on ARM and X86, and make them always to
check not only "modulo_result == 0" but also "dividend < 0".
Generate faster code for case when ArithMod operation divisor is constant power of 2 on ARMv7
in the same way as on ARMv7s, and add negative-zero checks into this code when needed.
Change speculationCheck ExitKind from Overflow to NegativeZero where applicable.

This shows 30% speedup of math-spectral-norm, and 5% speedup
on SunSpider overall on ARMv7 Linux.

* assembler/MacroAssemblerARM.h:
(JSC::MacroAssemblerARM::branchConvertDoubleToInt32):
* assembler/MacroAssemblerARMv7.h:
(JSC::MacroAssemblerARMv7::branchConvertDoubleToInt32):
* assembler/MacroAssemblerMIPS.h:
(JSC::MacroAssemblerMIPS::branchConvertDoubleToInt32):
* assembler/MacroAssemblerSH4.h:
(JSC::MacroAssemblerSH4::branchConvertDoubleToInt32):
* assembler/MacroAssemblerX86Common.h:
(JSC::MacroAssemblerX86Common::branchConvertDoubleToInt32):
* dfg/DFGBackwardsPropagationPhase.cpp:
(JSC::DFG::BackwardsPropagationPhase::isNotNegZero):
(JSC::DFG::BackwardsPropagationPhase::isNotPosZero):
(JSC::DFG::BackwardsPropagationPhase::propagate):
* dfg/DFGNode.h:
(JSC::DFG::Node::arithNodeFlags):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileDoubleAsInt32):
(JSC::DFG::SpeculativeJIT::compileSoftModulo):
(JSC::DFG::SpeculativeJIT::compileArithNegate):

LayoutTests: Arithmetic operations with negative zero should be optimized correclty.
https://bugs.webkit.org/show_bug.cgi?id=113862

Patch by Roman Zhuykov <zhroma@ispras.ru> on 2013-04-25
Reviewed by Filip Pizlo.
* fast/js/regress/negative-zero-divide-expected.txt: Added.
* fast/js/regress/negative-zero-divide.html: Added.
* fast/js/regress/negative-zero-modulo-expected.txt: Added.
* fast/js/regress/negative-zero-modulo.html: Added.
* fast/js/regress/negative-zero-negate-expected.txt: Added.
* fast/js/regress/negative-zero-negate.html: Added.
* fast/js/regress/script-tests/negative-zero-divide.js: Added.
(foo):
* fast/js/regress/script-tests/negative-zero-modulo.js: Added.
(foo):
* fast/js/regress/script-tests/negative-zero-negate.js: Added.
(foo):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@149152 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/js/regress/negative-zero-divide-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/regress/negative-zero-divide.html [new file with mode: 0644]
LayoutTests/fast/js/regress/negative-zero-modulo-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/regress/negative-zero-modulo.html [new file with mode: 0644]
LayoutTests/fast/js/regress/negative-zero-negate-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/regress/negative-zero-negate.html [new file with mode: 0644]
LayoutTests/fast/js/regress/script-tests/negative-zero-divide.js [new file with mode: 0644]
LayoutTests/fast/js/regress/script-tests/negative-zero-modulo.js [new file with mode: 0644]
LayoutTests/fast/js/regress/script-tests/negative-zero-negate.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/assembler/MacroAssemblerARM.h
Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h
Source/JavaScriptCore/assembler/MacroAssemblerSH4.h
Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h
Source/JavaScriptCore/dfg/DFGBackwardsPropagationPhase.cpp
Source/JavaScriptCore/dfg/DFGNode.h
Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp