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


Ignore:
Timestamp:
Sep 19, 2008, 8:00:43 PM (17 years ago)
Author:
[email protected]
Message:

Improve peformance of local variable initialisation.

Reviewed by Maciej Stachowiak

Pull local and constant initialisation out of slideRegisterWindowForCall
and into its own opcode. This allows the JIT to generate the initialisation
code for a function directly into the instruction stream and so avoids a few
branches on function entry.

Results a 1% progression in SunSpider, particularly in a number of the bitop
tests where the called functions are very fast.

File:
1 edited

Legend:

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

    r36605 r36695  
    178178{
    179179    m_jit.movl_rm(from, dst * sizeof(Register), X86::edi);
     180    // FIXME: #ifndef NDEBUG, Write the correct m_type to the register.
     181}
     182
     183ALWAYS_INLINE void CTI::emitInitialiseRegister(unsigned dst)
     184{
     185    m_jit.movl_i32m(reinterpret_cast<unsigned>(jsUndefined()), dst * sizeof(Register), X86::edi);
    180186    // FIXME: #ifndef NDEBUG, Write the correct m_type to the register.
    181187}
     
    526532void CTI::privateCompileMainPass()
    527533{
     534    if (m_codeBlock->codeType == FunctionCode) {
     535        for (int i = -m_codeBlock->numVars; i < 0; i++)
     536            emitInitialiseRegister(i);
     537    }
     538    for (size_t i = 0; i < m_codeBlock->constantRegisters.size(); ++i)
     539        emitInitialiseRegister(i);
     540
    528541    Instruction* instruction = m_codeBlock->instructions.begin();
    529542    unsigned instructionCount = m_codeBlock->instructions.size();
     
    15221535            break;
    15231536        }
     1537        case op_initialise_locals: {
     1538            i++;
     1539            break;
     1540        }
    15241541        case op_get_array_length:
    15251542        case op_get_by_id_chain:
Note: See TracChangeset for help on using the changeset viewer.