Ignore:
Timestamp:
Sep 14, 2008, 7:18:13 PM (17 years ago)
Author:
[email protected]
Message:

2008-09-14 Maciej Stachowiak <[email protected]>

Reviewed by Cameron Zwarich.


  • split the "prototype" lookup for hasInstance into opcode stream so it can be cached


~5% speedup on v8 earley-boyer test

  • API/JSCallbackObject.h: Add a parameter for the pre-looked-up prototype.
  • API/JSCallbackObjectFunctions.h: (JSC::::hasInstance): Ditto.
  • API/JSValueRef.cpp: (JSValueIsInstanceOfConstructor): Look up and pass in prototype.
  • JavaScriptCore.exp:
  • VM/CTI.cpp: (JSC::CTI::privateCompileMainPass): Pass along prototype.
  • VM/CodeBlock.cpp: (JSC::CodeBlock::dump): Print third arg.
  • VM/CodeGenerator.cpp: (JSC::CodeGenerator::emitInstanceOf): Implement this, now that there is a third argument.
  • VM/CodeGenerator.h:
  • VM/Machine.cpp: (JSC::Machine::privateExecute): Pass along the prototype. (JSC::Machine::cti_op_instanceof): ditto
  • kjs/JSObject.cpp: (JSC::JSObject::hasInstance): Expect to get a pre-looked-up prototype.
  • kjs/JSObject.h:
  • kjs/nodes.cpp: (JSC::InstanceOfNode::emitCode): Emit a get_by_id of the prototype property and pass that register to instanceof.
  • kjs/nodes.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/masm/X86Assembler.h

    r36401 r36418  
    210210        OP2_JNE_rel32   = 0x85,
    211211        OP2_JBE_rel32   = 0x86,
     212        OP2_JA_rel32    = 0x87,
    212213        OP2_JL_rel32    = 0x8C,
    213214        OP2_JGE_rel32   = 0x8D,
     
    370371        emitModRm_opm(GROUP1_OP_CMP, addr);
    371372        m_buffer->putInt(imm);
     373    }
     374
     375    void cmpl_i8m(int imm, int offset, RegisterID base, RegisterID index, int scale)
     376    {
     377        m_buffer->putByte(OP_GROUP1_EvIb);
     378        emitModRm_opmsib(GROUP1_OP_CMP, base, index, scale, offset);
     379        m_buffer->putByte(imm);
    372380    }
    373381
     
    742750    }
    743751   
     752    JmpSrc emitUnlinkedJa()
     753    {
     754        m_buffer->putByte(OP_2BYTE_ESCAPE);
     755        m_buffer->putByte(OP2_JA_rel32);
     756        m_buffer->putInt(0);
     757        return JmpSrc(m_buffer->getOffset());
     758    }
     759   
    744760    JmpSrc emitUnlinkedJae()
    745761    {
     
    786802    }
    787803   
    788     void* getRelocatedAddress(void* code, JmpSrc jump)
     804    static void* getRelocatedAddress(void* code, JmpSrc jump)
    789805    {
    790806        return reinterpret_cast<void*>((ptrdiff_t)code + jump.m_offset);
    791807    }
    792808   
    793     void* getRelocatedAddress(void* code, JmpDst jump)
     809    static void* getRelocatedAddress(void* code, JmpDst jump)
    794810    {
    795811        return reinterpret_cast<void*>((ptrdiff_t)code + jump.m_offset);
     812    }
     813   
     814    static int getDifferenceBetweenLabels(JmpDst src, JmpDst dst)
     815    {
     816        return dst.m_offset - src.m_offset;
     817    }
     818   
     819    static int getDifferenceBetweenLabels(JmpDst src, JmpSrc dst)
     820    {
     821        return dst.m_offset - src.m_offset;
     822    }
     823   
     824    static void repatchImmediate(intptr_t where, int32_t value)
     825    {
     826        reinterpret_cast<int32_t*>(where)[-1] = value;
     827    }
     828   
     829    static void repatchDisplacement(intptr_t where, intptr_t value)
     830    {
     831        reinterpret_cast<intptr_t*>(where)[-1] = value;
     832    }
     833   
     834    static void repatchBranchOffset(intptr_t where, void* destination)
     835    {
     836        reinterpret_cast<intptr_t*>(where)[-1] = (reinterpret_cast<intptr_t>(destination) - where);
    796837    }
    797838   
     
    932973    }
    933974
     975    void emitModRm_opmsib(OpcodeID opcode, RegisterID base, RegisterID index, int scale, int offset)
     976    {
     977        emitModRm_rmsib(static_cast<RegisterID>(opcode), base, index, scale, offset);
     978    }
     979
    934980    JITCodeBuffer* m_buffer;
    935981};
Note: See TracChangeset for help on using the changeset viewer.