Changeset 37789 in webkit for trunk/JavaScriptCore/VM/CTI.cpp


Ignore:
Timestamp:
Oct 22, 2008, 2:06:30 PM (17 years ago)
Author:
[email protected]
Message:

2008-10-22 Cameron Zwarich <[email protected]>

Reviewed by Geoff Garen.

Bug 21803: Fuse op_jfalse with op_eq_null and op_neq_null
<https://bugs.webkit.org/show_bug.cgi?id=21803>

Fuse op_jfalse with op_eq_null and op_neq_null to make the new opcodes
op_jeq_null and op_jneq_null.

This is a 2.6% speedup on the V8 Raytrace benchmark, and strangely also
a 4.7% speedup on the V8 Arguments benchmark, even though it uses
neither of the two new opcodes.

  • VM/CTI.cpp: (JSC::CTI::privateCompileMainPass):
  • VM/CodeBlock.cpp: (JSC::CodeBlock::dump):
  • VM/CodeGenerator.cpp: (JSC::CodeGenerator::emitJumpIfTrue): (JSC::CodeGenerator::emitJumpIfFalse):
  • VM/Machine.cpp: (JSC::Machine::privateExecute):
  • VM/Opcode.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/CTI.cpp

    r37730 r37789  
    15751575            break;
    15761576        };
     1577        case op_jeq_null: {
     1578            unsigned src = instruction[i + 1].u.operand;
     1579            unsigned target = instruction[i + 2].u.operand;
     1580
     1581            emitGetArg(src, X86::eax);
     1582            m_jit.testl_i32r(JSImmediate::TagMask, X86::eax);
     1583            X86Assembler::JmpSrc isImmediate = m_jit.emitUnlinkedJnz();
     1584
     1585            m_jit.movl_mr(OBJECT_OFFSET(JSCell, m_structureID), X86::eax, X86::ecx);
     1586            m_jit.testl_i32m(MasqueradesAsUndefined, OBJECT_OFFSET(StructureID, m_typeInfo.m_flags), X86::ecx);
     1587            m_jit.setnz_r(X86::eax);
     1588
     1589            X86Assembler::JmpSrc wasNotImmediate = m_jit.emitUnlinkedJmp();
     1590
     1591            m_jit.link(isImmediate, m_jit.label());
     1592
     1593            m_jit.movl_i32r(~JSImmediate::ExtendedTagBitUndefined, X86::ecx);
     1594            m_jit.andl_rr(X86::eax, X86::ecx);
     1595            m_jit.cmpl_i32r(JSImmediate::FullTagTypeNull, X86::ecx);
     1596            m_jit.sete_r(X86::eax);
     1597
     1598            m_jit.link(wasNotImmediate, m_jit.label());
     1599
     1600            m_jit.movzbl_rr(X86::eax, X86::eax);
     1601            m_jit.cmpl_i32r(0, X86::eax);
     1602            m_jmpTable.append(JmpTable(m_jit.emitUnlinkedJnz(), i + 2 + target));           
     1603
     1604            i += 3;
     1605            break;
     1606        };
     1607        case op_jneq_null: {
     1608            unsigned src = instruction[i + 1].u.operand;
     1609            unsigned target = instruction[i + 2].u.operand;
     1610
     1611            emitGetArg(src, X86::eax);
     1612            m_jit.testl_i32r(JSImmediate::TagMask, X86::eax);
     1613            X86Assembler::JmpSrc isImmediate = m_jit.emitUnlinkedJnz();
     1614
     1615            m_jit.movl_mr(OBJECT_OFFSET(JSCell, m_structureID), X86::eax, X86::ecx);
     1616            m_jit.testl_i32m(MasqueradesAsUndefined, OBJECT_OFFSET(StructureID, m_typeInfo.m_flags), X86::ecx);
     1617            m_jit.setz_r(X86::eax);
     1618
     1619            X86Assembler::JmpSrc wasNotImmediate = m_jit.emitUnlinkedJmp();
     1620
     1621            m_jit.link(isImmediate, m_jit.label());
     1622
     1623            m_jit.movl_i32r(~JSImmediate::ExtendedTagBitUndefined, X86::ecx);
     1624            m_jit.andl_rr(X86::eax, X86::ecx);
     1625            m_jit.cmpl_i32r(JSImmediate::FullTagTypeNull, X86::ecx);
     1626            m_jit.setne_r(X86::eax);
     1627
     1628            m_jit.link(wasNotImmediate, m_jit.label());
     1629
     1630            m_jit.movzbl_rr(X86::eax, X86::eax);
     1631            m_jit.cmpl_i32r(0, X86::eax);
     1632            m_jmpTable.append(JmpTable(m_jit.emitUnlinkedJnz(), i + 2 + target));           
     1633
     1634            i += 3;
     1635            break;
     1636        }
    15771637        case op_post_inc: {
    15781638            int srcDst = instruction[i + 2].u.operand;
Note: See TracChangeset for help on using the changeset viewer.