Changeset 38917 in webkit for trunk/JavaScriptCore/jit/JIT.cpp
- Timestamp:
- Dec 2, 2008, 1:52:24 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jit/JIT.cpp
r38916 r38917 362 362 #endif 363 363 364 extern "C" {365 static JSValue* FASTCALL allocateNumber(JSGlobalData* globalData) {366 JSValue* result = new (globalData) JSNumberCell(globalData);367 ASSERT(result);368 return result;369 }370 }371 372 ALWAYS_INLINE void JIT::emitAllocateNumber(JSGlobalData* globalData, unsigned bytecodeIndex)373 {374 __ movl_i32r(reinterpret_cast<intptr_t>(globalData), X86::ecx);375 emitNakedFastCall(bytecodeIndex, (void*)allocateNumber);376 }377 378 364 ALWAYS_INLINE JmpSrc JIT::emitNakedCall(unsigned bytecodeIndex, X86::RegisterID r) 379 365 { … … 385 371 386 372 ALWAYS_INLINE JmpSrc JIT::emitNakedCall(unsigned bytecodeIndex, void* function) 387 {388 JmpSrc call = __ call();389 m_calls.append(CallRecord(call, reinterpret_cast<CTIHelper_v>(function), bytecodeIndex));390 return call;391 }392 393 ALWAYS_INLINE JmpSrc JIT::emitNakedFastCall(unsigned bytecodeIndex, void* function)394 373 { 395 374 JmpSrc call = __ call(); … … 602 581 __ addl_rr(reg, reg); 603 582 emitFastArithReTagImmediate(reg); 604 }605 606 ALWAYS_INLINE JmpSrc JIT::emitArithIntToImmWithJump(RegisterID reg)607 {608 __ addl_rr(reg, reg);609 JmpSrc jmp = __ jo();610 emitFastArithReTagImmediate(reg);611 return jmp;612 583 } 613 584 … … 1597 1568 } 1598 1569 case op_negate: { 1599 int srcVReg = instruction[i + 2].u.operand; 1600 emitGetVirtualRegister(srcVReg, X86::eax, i); 1601 1602 __ testl_i32r(JSImmediate::TagBitTypeInteger, X86::eax); 1603 JmpSrc notImmediate = __ je(); 1604 1605 __ cmpl_i32r(JSImmediate::TagBitTypeInteger, X86::eax); 1606 JmpSrc zeroImmediate = __ je(); 1607 emitFastArithImmToInt(X86::eax); 1608 __ negl_r(X86::eax); // This can't overflow as we only have a 31bit int at this point 1609 JmpSrc overflow = emitArithIntToImmWithJump(X86::eax); 1610 emitPutVirtualRegister(instruction[i + 1].u.operand); 1611 JmpSrc immediateNegateSuccess = __ jmp(); 1612 1613 if (!isSSE2Present()) { 1614 __ link(zeroImmediate, __ label()); 1615 __ link(overflow, __ label()); 1616 __ link(notImmediate, __ label()); 1617 emitPutCTIArgFromVirtualRegister(instruction[i + 2].u.operand, 0, X86::ecx); 1618 emitCTICall(i, Interpreter::cti_op_negate); 1619 emitPutVirtualRegister(instruction[i + 1].u.operand); 1620 } else { 1621 // Slow case immediates 1622 m_slowCases.append(SlowCaseEntry(zeroImmediate, i)); 1623 m_slowCases.append(SlowCaseEntry(overflow, i)); 1624 __ link(notImmediate, __ label()); 1625 ResultType resultType(instruction[i + 3].u.resultType); 1626 if (!resultType.definitelyIsNumber()) { 1627 emitJumpSlowCaseIfNotJSCell(X86::eax, i, srcVReg); 1628 Structure* numberStructure = m_globalData->numberStructure.get(); 1629 __ cmpl_i32m(reinterpret_cast<unsigned>(numberStructure), FIELD_OFFSET(JSCell, m_structure), X86::eax); 1630 m_slowCases.append(SlowCaseEntry(__ jne(), i)); 1631 } 1632 __ movsd_mr(FIELD_OFFSET(JSNumberCell, m_value), X86::eax, X86::xmm0); 1633 // We need 3 copies of the sign bit mask so we can assure alignment and pad for the 128bit load 1634 static double doubleSignBit[] = { -0.0, -0.0, -0.0 }; 1635 __ xorpd_mr((void*)((((uintptr_t)doubleSignBit)+15)&~15), X86::xmm0); 1636 JmpSrc wasCell; 1637 if (!resultType.isReusableNumber()) 1638 emitAllocateNumber(m_globalData, i); 1639 1640 putDoubleResultToJSNumberCellOrJSImmediate(X86::xmm0, X86::eax, instruction[i + 1].u.operand, &wasCell, 1641 X86::xmm1, X86::ecx, X86::edx); 1642 __ link(wasCell, __ label()); 1643 } 1644 __ link(immediateNegateSuccess, __ label()); 1645 i += 4; 1570 emitPutCTIArgFromVirtualRegister(instruction[i + 2].u.operand, 0, X86::ecx); 1571 emitCTICall(i, Interpreter::cti_op_negate); 1572 emitPutVirtualRegister(instruction[i + 1].u.operand); 1573 i += 3; 1646 1574 break; 1647 1575 } … … 2486 2414 break; 2487 2415 } 2488 case op_negate: {2489 __ link(iter->from, __ label());2490 __ link((++iter)->from, __ label());2491 ResultType resultType(instruction[i + 3].u.resultType);2492 if (!resultType.definitelyIsNumber()) {2493 if (linkSlowCaseIfNotJSCell(++iter, instruction[i + 2].u.operand))2494 ++iter;2495 __ link(iter->from, __ label());2496 }2497 2498 emitPutCTIArgFromVirtualRegister(instruction[i + 2].u.operand, 0, X86::ecx);2499 emitCTICall(i, Interpreter::cti_op_negate);2500 emitPutVirtualRegister(instruction[i + 1].u.operand);2501 i += 4;2502 break;2503 }2504 2416 case op_rshift: { 2505 2417 __ link(iter->from, __ label());
Note:
See TracChangeset
for help on using the changeset viewer.