Changeset 197994 in webkit
- Timestamp:
- Mar 10, 2016 10:04:49 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r197985 r197994 1 2016-03-10 Benjamin Poulain <bpoulain@apple.com> 2 3 [JSC] Add register reuse for ArithAdd of an Int32 and constant in DFG 4 https://bugs.webkit.org/show_bug.cgi?id=155164 5 6 Reviewed by Geoffrey Garen. 7 8 Every "inc" in loop was looking like this: 9 move rX, rY 10 inc rY 11 jo 0x230f4a200580 12 13 This patch add register Reuse to that case to remove 14 the extra "move". 15 16 * dfg/DFGOSRExit.h: 17 (JSC::DFG::SpeculationRecovery::SpeculationRecovery): 18 (JSC::DFG::SpeculationRecovery::immediate): 19 * dfg/DFGOSRExitCompiler32_64.cpp: 20 (JSC::DFG::OSRExitCompiler::compileExit): 21 * dfg/DFGOSRExitCompiler64.cpp: 22 (JSC::DFG::OSRExitCompiler::compileExit): 23 * dfg/DFGSpeculativeJIT.cpp: 24 (JSC::DFG::SpeculativeJIT::compileArithAdd): 25 * tests/stress/arith-add-with-constant-overflow.js: Added. 26 (opaqueAdd): 27 1 28 2016-03-10 Keith Miller <keith_miller@apple.com> 2 29 -
trunk/Source/JavaScriptCore/dfg/DFGOSRExit.h
r195831 r197994 49 49 // This enum describes the types of additional recovery that 50 50 // may need be performed should a speculation check fail. 51 enum SpeculationRecoveryType {51 enum SpeculationRecoveryType : uint8_t { 52 52 SpeculativeAdd, 53 SpeculativeAddImmediate, 53 54 BooleanSpeculationCheck 54 55 }; … … 61 62 public: 62 63 SpeculationRecovery(SpeculationRecoveryType type, GPRReg dest, GPRReg src) 63 : m_ type(type)64 : m_src(src) 64 65 , m_dest(dest) 65 , m_src(src) 66 , m_type(type) 67 { 68 } 69 70 SpeculationRecovery(SpeculationRecoveryType type, GPRReg dest, int32_t immediate) 71 : m_immediate(immediate) 72 , m_dest(dest) 73 , m_type(type) 66 74 { 67 75 } … … 70 78 GPRReg dest() { return m_dest; } 71 79 GPRReg src() { return m_src; } 80 int32_t immediate() { return m_immediate; } 72 81 73 82 private: 83 // different recovery types may required different additional information here. 84 union { 85 GPRReg m_src; 86 int32_t m_immediate; 87 }; 88 GPRReg m_dest; 89 74 90 // Indicates the type of additional recovery to be performed. 75 91 SpeculationRecoveryType m_type; 76 // different recovery types may required different additional information here.77 GPRReg m_dest;78 GPRReg m_src;79 92 }; 80 93 -
trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompiler32_64.cpp
r195831 r197994 56 56 case SpeculativeAdd: 57 57 m_jit.sub32(recovery->src(), recovery->dest()); 58 break; 59 60 case SpeculativeAddImmediate: 61 m_jit.sub32(AssemblyHelpers::Imm32(recovery->immediate()), recovery->dest()); 58 62 break; 59 63 -
trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompiler64.cpp
r195831 r197994 60 60 case SpeculativeAdd: 61 61 m_jit.sub32(recovery->src(), recovery->dest()); 62 m_jit.or64(GPRInfo::tagTypeNumberRegister, recovery->dest()); 63 break; 64 65 case SpeculativeAddImmediate: 66 m_jit.sub32(AssemblyHelpers::Imm32(recovery->immediate()), recovery->dest()); 62 67 m_jit.or64(GPRInfo::tagTypeNumberRegister, recovery->dest()); 63 68 break; -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r197833 r197994 3257 3257 if (node->child2()->isInt32Constant()) { 3258 3258 SpeculateInt32Operand op1(this, node->child1()); 3259 GPRTemporary result(this, Reuse, op1); 3260 3261 GPRReg gpr1 = op1.gpr(); 3259 3262 int32_t imm2 = node->child2()->asInt32(); 3263 GPRReg gprResult = result.gpr(); 3260 3264 3261 3265 if (!shouldCheckOverflow(node->arithMode())) { 3262 GPRTemporary result(this, Reuse, op1); 3263 m_jit.add32(Imm32(imm2), op1.gpr(), result.gpr()); 3264 int32Result(result.gpr(), node); 3266 m_jit.add32(Imm32(imm2), gpr1, gprResult); 3267 int32Result(gprResult, node); 3265 3268 return; 3266 3269 } 3267 3270 3268 GPRTemporary result(this); 3269 speculationCheck(Overflow, JSValueRegs(), 0, m_jit.branchAdd32(MacroAssembler::Overflow, op1.gpr(), Imm32(imm2), result.gpr())); 3270 3271 int32Result(result.gpr(), node); 3271 MacroAssembler::Jump check = m_jit.branchAdd32(MacroAssembler::Overflow, gpr1, Imm32(imm2), gprResult); 3272 if (gpr1 == gprResult) { 3273 speculationCheck(Overflow, JSValueRegs(), 0, check, 3274 SpeculationRecovery(SpeculativeAddImmediate, gpr1, imm2)); 3275 } else 3276 speculationCheck(Overflow, JSValueRegs(), 0, check); 3277 3278 int32Result(gprResult, node); 3272 3279 return; 3273 3280 }
Note: See TracChangeset
for help on using the changeset viewer.