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


Ignore:
Timestamp:
Dec 5, 2008, 3:57:43 PM (16 years ago)
Author:
[email protected]
Message:

2008-12-05 Gavin Barraclough <[email protected]>

Reviewed by Geoff Garen.

Move JIT::compileOpStrictEq to MacroAssembler interface.

The rewrite also looks like a small (<1%) performance progression.

https://bugs.webkit.org/show_bug.cgi?id=22697

  • jit/JIT.cpp: (JSC::JIT::compileOpStrictEq): (JSC::JIT::privateCompileSlowCases):
  • jit/JIT.h:
  • jit/JITInlineMethods.h: (JSC::JIT::emitJumpIfJSCell): (JSC::JIT::emitJumpSlowCaseIfJSCell):
File:
1 edited

Legend:

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

    r39039 r39053  
    222222    emitGetVirtualRegisters(src1, X86::eax, src2, X86::edx, i);
    223223
    224     __ testl_i32r(JSImmediate::TagMask, X86::eax);
    225     JmpSrc firstNotImmediate = __ je();
    226     __ testl_i32r(JSImmediate::TagMask, X86::edx);
    227     JmpSrc secondNotImmediate = __ je();
    228 
    229     __ cmpl_rr(X86::edx, X86::eax);
    230     if (negated)
    231         __ setne_r(X86::eax);
    232     else
    233         __ sete_r(X86::eax);
    234     __ movzbl_rr(X86::eax, X86::eax);
    235     emitTagAsBoolImmediate(X86::eax);
    236            
    237     JmpSrc bothWereImmediates = __ jmp();
    238 
    239     __ link(firstNotImmediate, __ label());
    240 
    241     // check that edx is immediate but not the zero immediate
    242     __ testl_i32r(JSImmediate::TagMask, X86::edx);
    243     __ setz_r(X86::ecx);
    244     __ movzbl_rr(X86::ecx, X86::ecx); // ecx is now 1 if edx was nonimmediate
    245     __ cmpl_i32r(asInteger(JSImmediate::zeroImmediate()), X86::edx);
    246     __ sete_r(X86::edx);
    247     __ movzbl_rr(X86::edx, X86::edx); // edx is now 1 if edx was the 0 immediate
    248     __ orl_rr(X86::ecx, X86::edx);
    249 
    250     m_slowCases.append(SlowCaseEntry(__ jnz(), i));
    251 
    252     __ movl_i32r(asInteger(jsBoolean(negated)), X86::eax);
    253 
    254     JmpSrc firstWasNotImmediate = __ jmp();
    255 
    256     __ link(secondNotImmediate, __ label());
    257     // check that eax is not the zero immediate (we know it must be immediate)
    258     __ cmpl_i32r(asInteger(JSImmediate::zeroImmediate()), X86::eax);
    259     m_slowCases.append(SlowCaseEntry(__ je(), i));
    260 
    261     __ movl_i32r(asInteger(jsBoolean(negated)), X86::eax);
    262 
    263     __ link(bothWereImmediates, __ label());
    264     __ link(firstWasNotImmediate, __ label());
    265 
     224    // Check that bot are immediates, if so check if they're equal
     225    Jump firstNotImmediate = emitJumpIfJSCell(X86::eax);
     226    Jump secondNotImmediate = emitJumpIfJSCell(X86::edx);
     227    Jump bothWereImmediatesButNotEqual = jne32(X86::edx, X86::eax);
     228
     229    // They are equal - set the result to true. (Or false, if negated).
     230    move(Imm32(asInteger(jsBoolean(!negated))), X86::eax);
     231    Jump bothWereImmediatesAndEqual = jump();
     232
     233    // eax was not an immediate, we haven't yet checked edx.
     234    // If edx is also a JSCell, or is 0, then jump to a slow case,
     235    // otherwise these values are not equal.
     236    firstNotImmediate.link(this);
     237    emitJumpSlowCaseIfJSCell(X86::edx, i);
     238    m_slowCases.append(SlowCaseEntry(je32(Imm32(asInteger(JSImmediate::zeroImmediate())), X86::edx), i));
     239    Jump firstWasNotImmediate = jump();
     240
     241    // eax was an immediate, but edx wasn't.
     242    // If eax is 0 jump to a slow case, otherwise these values are not equal.
     243    secondNotImmediate.link(this);
     244    m_slowCases.append(SlowCaseEntry(je32(Imm32(asInteger(JSImmediate::zeroImmediate())), X86::eax), i));
     245
     246    // We get here if the two values are different immediates, or one is 0 and the other is a JSCell.
     247    // Vaelues are not equal, set the result to false.
     248    bothWereImmediatesButNotEqual.link(this);
     249    firstWasNotImmediate.link(this);
     250    move(Imm32(asInteger(jsBoolean(negated))), X86::eax);
     251   
     252    bothWereImmediatesAndEqual.link(this);
    266253    emitPutVirtualRegister(dst);
    267254}
     
    14851472    case name: { \
    14861473        __ link(iter->from, __ label()); \
    1487         emitPutCTIArgFromVirtualRegister(instruction[i + 2].u.operand, 0, X86::ecx); \
    1488         emitPutCTIArgFromVirtualRegister(instruction[i + 3].u.operand, 4, X86::ecx); \
    1489         emitCTICall(i, Interpreter::cti_##name); \
    1490         emitPutVirtualRegister(instruction[i + 1].u.operand); \
    1491         i += 4; \
    1492         break; \
    1493     }
    1494 
    1495 #define CTI_COMPILE_BINARY_OP_SLOW_CASE_DOUBLE_ENTRY(name) \
    1496     case name: { \
    1497         __ link(iter->from, __ label()); \
    1498         __ link((++iter)->from, __ label());                \
    14991474        emitPutCTIArgFromVirtualRegister(instruction[i + 2].u.operand, 0, X86::ecx); \
    15001475        emitPutCTIArgFromVirtualRegister(instruction[i + 3].u.operand, 4, X86::ecx); \
     
    18931868            break;
    18941869        }
    1895         CTI_COMPILE_BINARY_OP_SLOW_CASE_DOUBLE_ENTRY(op_stricteq);
    1896         CTI_COMPILE_BINARY_OP_SLOW_CASE_DOUBLE_ENTRY(op_nstricteq);
     1870        case op_stricteq: {
     1871            __ link(iter->from, __ label());
     1872            __ link((++iter)->from, __ label());
     1873            __ link((++iter)->from, __ label());
     1874            emitPutCTIArg(X86::eax, 0);
     1875            emitPutCTIArg(X86::edx, 4);
     1876            emitCTICall(i, Interpreter::cti_op_stricteq);
     1877            emitPutVirtualRegister(instruction[i + 1].u.operand);
     1878            i += 4;
     1879            break;
     1880        }
     1881        case op_nstricteq: {
     1882            __ link(iter->from, __ label());
     1883            __ link((++iter)->from, __ label());
     1884            __ link((++iter)->from, __ label());
     1885            emitPutCTIArg(X86::eax, 0);
     1886            emitPutCTIArg(X86::edx, 4);
     1887            emitCTICall(i, Interpreter::cti_op_nstricteq);
     1888            emitPutVirtualRegister(instruction[i + 1].u.operand);
     1889            i += 4;
     1890            break;
     1891        }
    18971892        case op_instanceof: {
    18981893            __ link(iter->from, __ label());
Note: See TracChangeset for help on using the changeset viewer.