Changeset 67990 in webkit for trunk/JavaScriptCore/jit


Ignore:
Timestamp:
Sep 21, 2010, 4:19:53 PM (15 years ago)
Author:
[email protected]
Message:

2010-09-21 Oliver Hunt <[email protected]>

Reviewed by Geoffrey Garen.

Speed up function.apply(..., arguments)
https://bugs.webkit.org/show_bug.cgi?id=46207

Add code to do argument copying inline in the case
where we're using Function.apply to forward our arguments
directly.

  • jit/JIT.cpp: (JSC::JIT::privateCompileSlowCases):

Splitted op_load_varargs into fast and slow paths, so add the call
to the slow path generator.

  • jit/JIT.h:
  • jit/JITCall32_64.cpp: Remove 32bit specific emit_op_load_varargs as the logic is the same for all value representations
  • jit/JITOpcodes.cpp: (JSC::JIT::emit_op_load_varargs): Copy arguments inline (JSC::JIT::emitSlow_op_load_varargs):
Location:
trunk/JavaScriptCore/jit
Files:
4 edited

Legend:

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

    r66150 r67990  
    409409        DEFINE_SLOWCASE_OP(op_jnlesseq)
    410410        DEFINE_SLOWCASE_OP(op_jtrue)
     411        DEFINE_SLOWCASE_OP(op_load_varargs)
    411412        DEFINE_SLOWCASE_OP(op_loop_if_less)
    412413        DEFINE_SLOWCASE_OP(op_loop_if_lesseq)
  • trunk/JavaScriptCore/jit/JIT.h

    r66846 r67990  
    856856        void emitSlow_op_jnlesseq(Instruction*, Vector<SlowCaseEntry>::iterator&);
    857857        void emitSlow_op_jtrue(Instruction*, Vector<SlowCaseEntry>::iterator&);
     858        void emitSlow_op_load_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&);
    858859        void emitSlow_op_loop_if_less(Instruction*, Vector<SlowCaseEntry>::iterator&);
    859860        void emitSlow_op_loop_if_lesseq(Instruction*, Vector<SlowCaseEntry>::iterator&);
  • trunk/JavaScriptCore/jit/JITCall32_64.cpp

    r63404 r67990  
    181181}
    182182
    183 void JIT::emit_op_load_varargs(Instruction* currentInstruction)
    184 {
    185     int argCountDst = currentInstruction[1].u.operand;
    186     int argsOffset = currentInstruction[2].u.operand;
    187 
    188     JITStubCall stubCall(this, cti_op_load_varargs);
    189     stubCall.addArgument(Imm32(argsOffset));
    190     stubCall.call();
    191     // Stores a naked int32 in the register file.
    192     store32(returnValueRegister, Address(callFrameRegister, argCountDst * sizeof(Register)));
    193 }
    194 
    195183void JIT::emit_op_call_varargs(Instruction* currentInstruction)
    196184{
  • trunk/JavaScriptCore/jit/JITOpcodes.cpp

    r66150 r67990  
    2929#include "JIT.h"
    3030
     31#include "Arguments.h"
    3132#include "JITInlineMethods.h"
    3233#include "JITStubCall.h"
     
    437438{
    438439    compileOpCall(op_call_eval, currentInstruction, m_callLinkInfoIndex++);
    439 }
    440 
    441 void JIT::emit_op_load_varargs(Instruction* currentInstruction)
    442 {
    443     int argCountDst = currentInstruction[1].u.operand;
    444     int argsOffset = currentInstruction[2].u.operand;
    445 
    446     JITStubCall stubCall(this, cti_op_load_varargs);
    447     stubCall.addArgument(Imm32(argsOffset));
    448     stubCall.call();
    449     // Stores a naked int32 in the register file.
    450     store32(returnValueRegister, Address(callFrameRegister, argCountDst * sizeof(Register)));
    451440}
    452441
     
    15291518}
    15301519
     1520void JIT::emit_op_load_varargs(Instruction* currentInstruction)
     1521{
     1522    int argCountDst = currentInstruction[1].u.operand;
     1523    int argsOffset = currentInstruction[2].u.operand;
     1524    int expectedParams = m_codeBlock->m_numParameters - 1;
     1525    // Don't do inline copying if we aren't guaranteed to have a single stream
     1526    // of arguments
     1527    if (expectedParams) {
     1528        JITStubCall stubCall(this, cti_op_load_varargs);
     1529        stubCall.addArgument(Imm32(argsOffset));
     1530        stubCall.call();
     1531        // Stores a naked int32 in the register file.
     1532        store32(returnValueRegister, Address(callFrameRegister, argCountDst * sizeof(Register)));
     1533        return;
     1534    }
     1535
     1536#if USE(JSVALUE32_64)
     1537    addSlowCase(branch32(NotEqual, tagFor(argsOffset), Imm32(JSValue::EmptyValueTag)));
     1538#else
     1539    addSlowCase(branchTestPtr(NonZero, addressFor(argsOffset)));
     1540#endif
     1541    // Load arg count into regT0
     1542    emitGetFromCallFrameHeader32(RegisterFile::ArgumentCount, regT0);
     1543    storePtr(regT0, addressFor(argCountDst));
     1544    Jump endBranch = branch32(Equal, regT0, Imm32(1));
     1545
     1546    mul32(Imm32(sizeof(Register)), regT0, regT3);
     1547    addPtr(Imm32(static_cast<unsigned>(sizeof(Register) - RegisterFile::CallFrameHeaderSize * sizeof(Register))), callFrameRegister, regT1);
     1548    subPtr(regT3, regT1); // regT1 is now the start of the out of line arguments
     1549    addPtr(Imm32(argsOffset * sizeof(Register)), callFrameRegister, regT2); // regT2 is the target buffer
     1550   
     1551    // Bounds check the registerfile
     1552    addPtr(regT2, regT3);
     1553    addSlowCase(branchPtr(Below, AbsoluteAddress(&m_globalData->interpreter->registerFile().m_end), regT3));
     1554
     1555    sub32(Imm32(1), regT0);
     1556    Label loopStart = label();
     1557    loadPtr(BaseIndex(regT1, regT0, TimesEight, static_cast<unsigned>(0 - 2 * sizeof(Register))), regT3);
     1558    storePtr(regT3, BaseIndex(regT2, regT0, TimesEight, static_cast<unsigned>(0 - sizeof(Register))));
     1559#if USE(JSVALUE32_64)
     1560    loadPtr(BaseIndex(regT1, regT0, TimesEight, static_cast<unsigned>(sizeof(void*) - 2 * sizeof(Register))), regT3);
     1561    storePtr(regT3, BaseIndex(regT2, regT0, TimesEight, static_cast<unsigned>(sizeof(void*) - sizeof(Register))));
     1562#endif
     1563    branchSubPtr(NonZero, Imm32(1), regT0).linkTo(loopStart, this);
     1564    endBranch.link(this);
     1565}
     1566
     1567void JIT::emitSlow_op_load_varargs(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
     1568{
     1569    int argCountDst = currentInstruction[1].u.operand;
     1570    int argsOffset = currentInstruction[2].u.operand;
     1571    int expectedParams = m_codeBlock->m_numParameters - 1;
     1572    if (expectedParams)
     1573        return;
     1574   
     1575    linkSlowCase(iter);
     1576    linkSlowCase(iter);
     1577    JITStubCall stubCall(this, cti_op_load_varargs);
     1578    stubCall.addArgument(Imm32(argsOffset));
     1579    stubCall.call();
     1580    // Stores a naked int32 in the register file.
     1581    store32(returnValueRegister, Address(callFrameRegister, argCountDst * sizeof(Register)));
     1582}
     1583
    15311584// For both JSValue32_64 and JSValue32
    15321585#if ENABLE(JIT_USE_SOFT_MODULO)
Note: See TracChangeset for help on using the changeset viewer.