Changeset 38917 in webkit for trunk/JavaScriptCore/jit/JIT.cpp


Ignore:
Timestamp:
Dec 2, 2008, 1:52:24 PM (17 years ago)
Author:
[email protected]
Message:

2008-12-02 Geoffrey Garen <[email protected]>

Reviewed by Geoffrey Garen. (Patch by Cameron Zwarich <[email protected]>.)


Fixed https://bugs.webkit.org/show_bug.cgi?id=22482
REGRESSION (r37991): Occasionally see "Scene rendered incorrectly"
message when running the V8 Raytrace benchmark


Rolled out r37991. It didn't properly save xmm0, which is caller-save,
before calling helper functions.


SunSpider and v8 benchmarks show little change -- possibly a .2%
SunSpider regression, possibly a .2% v8 benchmark speedup.

  • assembler/X86Assembler.h: (JSC::X86Assembler::):
  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump):
  • bytecode/Instruction.h: (JSC::Instruction::):
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitUnaryOp):
  • bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::emitToJSNumber): (JSC::BytecodeGenerator::emitTypeOf): (JSC::BytecodeGenerator::emitGetPropertyNames):
  • interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute):
  • interpreter/Interpreter.h:
  • jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases):
  • jit/JIT.h:
  • parser/Nodes.cpp: (JSC::UnaryOpNode::emitBytecode): (JSC::BinaryOpNode::emitBytecode): (JSC::EqualNode::emitBytecode):
  • parser/ResultType.h: (JSC::ResultType::isReusable): (JSC::ResultType::mightBeNumber):
  • runtime/JSNumberCell.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jit/JIT.cpp

    r38916 r38917  
    362362#endif
    363363
    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 
    378364ALWAYS_INLINE JmpSrc JIT::emitNakedCall(unsigned bytecodeIndex, X86::RegisterID r)
    379365{
     
    385371
    386372ALWAYS_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)
    394373{
    395374    JmpSrc call = __ call();
     
    602581    __ addl_rr(reg, reg);
    603582    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;
    612583}
    613584
     
    15971568        }
    15981569        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;
    16461574            break;
    16471575        }
     
    24862414            break;
    24872415        }
    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         }
    25042416        case op_rshift: {
    25052417            __ link(iter->from, __ label());
Note: See TracChangeset for help on using the changeset viewer.