Changeset 36324 in webkit for trunk/JavaScriptCore
- Timestamp:
- Sep 10, 2008, 7:10:47 PM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r36318 r36324 1 2008-09-10 Oliver Hunt <[email protected]> 2 3 Reviewed by Geoff Garen. 4 5 Inline immediate number version of op_mul. 6 7 Renamed mull_rr to imull_rr as that's what it's 8 actually doing, and added imull_i32r for the constant 9 case immediate multiply. 10 11 1.1% improvement to SunSpider. 12 13 * VM/CTI.cpp: 14 (JSC::CTI::privateCompileMainPass): 15 (JSC::CTI::privateCompileSlowCases): 16 * masm/X86Assembler.h: 17 (JSC::X86Assembler::): 18 (JSC::X86Assembler::imull_rr): 19 (JSC::X86Assembler::imull_i32r): 20 1 21 2008-09-10 Cameron Zwarich <[email protected]> 2 22 -
trunk/JavaScriptCore/VM/CTI.cpp
r36317 r36324 615 615 break; 616 616 } 617 CTI_COMPILE_BINARY_OP(op_mul); 617 case op_mul: { 618 unsigned dst = instruction[i + 1].u.operand; 619 unsigned src1 = instruction[i + 2].u.operand; 620 unsigned src2 = instruction[i + 3].u.operand; 621 if (src1 < m_codeBlock->constantRegisters.size() || src2 < m_codeBlock->constantRegisters.size()) { 622 unsigned constant = src1; 623 unsigned nonconstant = src2; 624 if (!(src1 < m_codeBlock->constantRegisters.size())) { 625 constant = src2; 626 nonconstant = src1; 627 } 628 JSValue* value = m_codeBlock->constantRegisters[constant].jsValue(m_exec); 629 if (JSImmediate::isNumber(value)) { 630 emitGetArg(nonconstant, X86::eax); 631 emitJumpSlowCaseIfNotImm(X86::eax, i); 632 emitFastArithImmToInt(X86::eax); 633 m_jit.imull_i32r( X86::eax, getDeTaggedConstantImmediate(value), X86::eax); 634 m_slowCases.append(SlowCaseEntry(m_jit.emitUnlinkedJo(), i)); 635 emitFastArithPotentiallyReTagImmediate(X86::eax); 636 emitPutResult(dst); 637 i += 4; 638 break; 639 } 640 } 641 642 emitGetArg(src1, X86::eax); 643 emitGetArg(src2, X86::edx); 644 emitJumpSlowCaseIfNotImms(X86::eax, X86::edx, i); 645 emitFastArithDeTagImmediate(X86::eax); 646 emitFastArithImmToInt(X86::edx); 647 m_jit.imull_rr(X86::edx, X86::eax); 648 m_slowCases.append(SlowCaseEntry(m_jit.emitUnlinkedJo(), i)); 649 emitFastArithPotentiallyReTagImmediate(X86::eax); 650 emitPutResult(dst); 651 i += 4; 652 break; 653 } 618 654 case op_new_func: { 619 655 FuncDeclNode* func = (m_codeBlock->functions[instruction[i + 2].u.operand]).get(); … … 1283 1319 } 1284 1320 1321 #define CTI_COMPILE_BINARY_OP_SLOW_CASE(name) \ 1322 case name: { \ 1323 m_jit.link(iter->from, m_jit.label()); \ 1324 emitGetPutArg(instruction[i + 2].u.operand, 0, X86::ecx); \ 1325 emitGetPutArg(instruction[i + 3].u.operand, 4, X86::ecx); \ 1326 emitCall(i, Machine::cti_##name); \ 1327 emitPutResult(instruction[i + 1].u.operand); \ 1328 i += 4; \ 1329 break; \ 1330 } 1331 1285 1332 void CTI::privateCompileSlowCases() 1286 1333 { … … 1288 1335 for (Vector<SlowCaseEntry>::iterator iter = m_slowCases.begin(); iter != m_slowCases.end(); ++iter) { 1289 1336 int i = iter->to; 1290 m_jit.emitRestoreArgumentReference();1337 m_jit.emitRestoreArgumentReference(); 1291 1338 switch (m_machine->getOpcodeID(instruction[i].u.opcode)) { 1292 1339 case op_add: { … … 1590 1637 break; 1591 1638 } 1639 CTI_COMPILE_BINARY_OP_SLOW_CASE(op_mul); 1592 1640 default: 1593 1641 ASSERT_NOT_REACHED(); -
trunk/JavaScriptCore/masm/X86Assembler.h
r36311 r36324 183 183 OP_POP_EAX = 0x58, 184 184 PRE_OPERAND_SIZE = 0x66, 185 OP_IMUL_GvEvIz = 0x69, 185 186 OP_GROUP1_EvIz = 0x81, 186 187 OP_GROUP1_EvIb = 0x83, … … 212 213 OP2_JGE_rel32 = 0x8D, 213 214 OP2_JLE_rel32 = 0x8E, 214 OP2_ MUL_GvEv= 0xAF,215 OP2_IMUL_GvEv = 0xAF, 215 216 OP2_MOVZX_GvEw = 0xB7, 216 217 … … 473 474 } 474 475 475 void mull_rr(RegisterID src, RegisterID dst)476 { 477 m_buffer->putByte(OP_2BYTE_ESCAPE); 478 m_buffer->putByte(OP2_ MUL_GvEv);476 void imull_rr(RegisterID src, RegisterID dst) 477 { 478 m_buffer->putByte(OP_2BYTE_ESCAPE); 479 m_buffer->putByte(OP2_IMUL_GvEv); 479 480 emitModRm_rr(dst, src); 481 } 482 483 void imull_i32r(RegisterID src, int32_t value, RegisterID dst) 484 { 485 m_buffer->putByte(OP_IMUL_GvEvIz); 486 emitModRm_rr(dst, src); 487 m_buffer->putInt(value); 480 488 } 481 489
Note:
See TracChangeset
for help on using the changeset viewer.