Changeset 197688 in webkit
- Timestamp:
- Mar 7, 2016 10:30:31 AM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r197687 r197688 1 2016-03-07 Benjamin Poulain <benjamin@webkit.org> 2 3 [JSC] Simplify the overflow check of ArithAbs 4 https://bugs.webkit.org/show_bug.cgi?id=155063 5 6 Reviewed by Geoffrey Garen. 7 8 The only integer that overflow abs(int32) is INT_MIN. 9 For some reason, our code testing for that case 10 was checking the top bit of the result specifically. 11 12 The code required a large immediate on x86 and an extra 13 register on ARM64. 14 15 This patch turns the overflow check into a branch on 16 the sign of the result. 17 18 * dfg/DFGSpeculativeJIT32_64.cpp: 19 (JSC::DFG::SpeculativeJIT::compile): 20 * dfg/DFGSpeculativeJIT64.cpp: 21 (JSC::DFG::SpeculativeJIT::compile): 22 * ftl/FTLLowerDFGToB3.cpp: 23 (JSC::FTL::DFG::LowerDFGToB3::compileArithAbs): 24 * jit/ThunkGenerators.cpp: 25 (JSC::absThunkGenerator): 26 * tests/stress/arith-abs-overflow.js: Added. 27 (opaqueAbs): 28 1 29 2016-03-07 Benjamin Poulain <bpoulain@apple.com> 2 30 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r197649 r197688 2188 2188 m_jit.add32(scratch.gpr(), result.gpr()); 2189 2189 m_jit.xor32(scratch.gpr(), result.gpr()); 2190 speculationCheck(Overflow, JSValueRegs(), 0, m_jit.branch 32(MacroAssembler::Equal, result.gpr(), MacroAssembler::TrustedImm32(1 << 31)));2190 speculationCheck(Overflow, JSValueRegs(), 0, m_jit.branchTest32(MacroAssembler::Signed, result.gpr())); 2191 2191 int32Result(result.gpr(), node); 2192 2192 break; -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r197687 r197688 2336 2336 m_jit.xor32(scratch.gpr(), result.gpr()); 2337 2337 if (shouldCheckOverflow(node->arithMode())) 2338 speculationCheck(Overflow, JSValueRegs(), 0, m_jit.branch 32(MacroAssembler::Equal, result.gpr(), MacroAssembler::TrustedImm32(1 << 31)));2338 speculationCheck(Overflow, JSValueRegs(), 0, m_jit.branchTest32(MacroAssembler::Signed, result.gpr())); 2339 2339 int32Result(result.gpr(), node); 2340 2340 break; -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r197650 r197688 1775 1775 1776 1776 if (shouldCheckOverflow(m_node->arithMode())) 1777 speculate(Overflow, noValue(), 0, m_out. equal(result, m_out.constInt32(1 << 31)));1777 speculate(Overflow, noValue(), 0, m_out.lessThan(result, m_out.int32Zero)); 1778 1778 1779 1779 setInt32(result); -
trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp
r197687 r197688 911 911 jit.add32(SpecializedThunkJIT::regT1, SpecializedThunkJIT::regT0); 912 912 jit.xor32(SpecializedThunkJIT::regT1, SpecializedThunkJIT::regT0); 913 jit.appendFailure(jit.branch 32(MacroAssembler::Equal, SpecializedThunkJIT::regT0, MacroAssembler::TrustedImm32(1 << 31)));913 jit.appendFailure(jit.branchTest32(MacroAssembler::Signed, SpecializedThunkJIT::regT0)); 914 914 jit.returnInt32(SpecializedThunkJIT::regT0); 915 915 nonIntJump.link(&jit);
Note: See TracChangeset
for help on using the changeset viewer.