Changeset 70736 in webkit
- Timestamp:
- Oct 27, 2010 6:30:09 PM (14 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r70726 r70736 1 2010-10-27 Chao-ying Fu <fu@mips.com> 2 3 Reviewed by Oliver Hunt. 4 5 Support emit_op_mod() for MIPS on JSVALUE32_64 6 https://bugs.webkit.org/show_bug.cgi?id=46511 7 8 This patch uses MIPS div instructions for op_mod to improve performance. 9 10 * jit/JITArithmetic32_64.cpp: 11 (JSC::JIT::emit_op_mod): 12 1 13 2010-10-27 Brent Fulgham <bfulgham@webkit.org> 2 14 -
trunk/JavaScriptCore/jit/JITArithmetic32_64.cpp
r70496 r70736 1294 1294 /* ------------------------------ BEGIN: OP_MOD ------------------------------ */ 1295 1295 1296 #if CPU(X86) || CPU(X86_64) || CPU(MIPS) 1297 1298 void JIT::emit_op_mod(Instruction* currentInstruction) 1299 { 1300 unsigned dst = currentInstruction[1].u.operand; 1301 unsigned op1 = currentInstruction[2].u.operand; 1302 unsigned op2 = currentInstruction[3].u.operand; 1303 1296 1304 #if CPU(X86) || CPU(X86_64) 1297 1298 void JIT::emit_op_mod(Instruction* currentInstruction) 1299 { 1300 unsigned dst = currentInstruction[1].u.operand;1301 unsigned op1 = currentInstruction[2].u.operand;1302 unsigned op2 = currentInstruction[3].u.operand; 1305 // Make sure registers are correct for x86 IDIV instructions. 1306 ASSERT(regT0 == X86Registers::eax); 1307 ASSERT(regT1 == X86Registers::edx); 1308 ASSERT(regT2 == X86Registers::ecx); 1309 ASSERT(regT3 == X86Registers::ebx); 1310 #endif 1303 1311 1304 1312 if (isOperandConstantImmediateInt(op2) && getConstantOperand(op2).asInt32() != 0) { 1305 emitLoad(op1, X86Registers::edx, X86Registers::eax);1306 move(Imm32(getConstantOperand(op2).asInt32()), X86Registers::ecx);1307 addSlowCase(branch32(NotEqual, X86Registers::edx, Imm32(JSValue::Int32Tag)));1313 emitLoad(op1, regT1, regT0); 1314 move(Imm32(getConstantOperand(op2).asInt32()), regT2); 1315 addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag))); 1308 1316 if (getConstantOperand(op2).asInt32() == -1) 1309 addSlowCase(branch32(Equal, X86Registers::eax, Imm32(0x80000000))); // -2147483648 / -1 => EXC_ARITHMETIC1317 addSlowCase(branch32(Equal, regT0, Imm32(0x80000000))); // -2147483648 / -1 => EXC_ARITHMETIC 1310 1318 } else { 1311 emitLoad2(op1, X86Registers::edx, X86Registers::eax, op2, X86Registers::ebx, X86Registers::ecx); 1312 addSlowCase(branch32(NotEqual, X86Registers::edx, Imm32(JSValue::Int32Tag))); 1313 addSlowCase(branch32(NotEqual, X86Registers::ebx, Imm32(JSValue::Int32Tag))); 1314 1315 addSlowCase(branch32(Equal, X86Registers::eax, Imm32(0x80000000))); // -2147483648 / -1 => EXC_ARITHMETIC 1316 addSlowCase(branch32(Equal, X86Registers::ecx, Imm32(0))); // divide by 0 1317 } 1318 1319 move(X86Registers::eax, X86Registers::ebx); // Save dividend payload, in case of 0. 1319 emitLoad2(op1, regT1, regT0, op2, regT3, regT2); 1320 addSlowCase(branch32(NotEqual, regT1, Imm32(JSValue::Int32Tag))); 1321 addSlowCase(branch32(NotEqual, regT3, Imm32(JSValue::Int32Tag))); 1322 1323 addSlowCase(branch32(Equal, regT0, Imm32(0x80000000))); // -2147483648 / -1 => EXC_ARITHMETIC 1324 addSlowCase(branch32(Equal, regT2, Imm32(0))); // divide by 0 1325 } 1326 1327 move(regT0, regT3); // Save dividend payload, in case of 0. 1328 #if CPU(X86) || CPU(X86_64) 1320 1329 m_assembler.cdq(); 1321 m_assembler.idivl_r(X86Registers::ecx); 1330 m_assembler.idivl_r(regT2); 1331 #elif CPU(MIPS) 1332 m_assembler.div(regT0, regT2); 1333 m_assembler.mfhi(regT1); 1334 #endif 1322 1335 1323 1336 // If the remainder is zero and the dividend is negative, the result is -0. 1324 Jump storeResult1 = branchTest32(NonZero, X86Registers::edx);1325 Jump storeResult2 = branchTest32(Zero, X86Registers::ebx, Imm32(0x80000000)); // not negative1337 Jump storeResult1 = branchTest32(NonZero, regT1); 1338 Jump storeResult2 = branchTest32(Zero, regT3, Imm32(0x80000000)); // not negative 1326 1339 emitStore(dst, jsNumber(-0.0)); 1327 1340 Jump end = jump(); … … 1329 1342 storeResult1.link(this); 1330 1343 storeResult2.link(this); 1331 emitStoreInt32(dst, X86Registers::edx, (op1 == dst || op2 == dst));1344 emitStoreInt32(dst, regT1, (op1 == dst || op2 == dst)); 1332 1345 end.link(this); 1333 1346 } … … 1356 1369 } 1357 1370 1358 #else // CPU(X86) || CPU(X86_64) 1371 #else // CPU(X86) || CPU(X86_64) || CPU(MIPS) 1359 1372 1360 1373 void JIT::emit_op_mod(Instruction* currentInstruction)
Note: See TracChangeset
for help on using the changeset viewer.