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


Ignore:
Timestamp:
Apr 8, 2009, 4:08:28 PM (16 years ago)
Author:
[email protected]
Message:

Improve function.apply performance

Reviewed by Geoff Garen.

Jump through a few hoops to improve performance of function.apply in the general case.

In the case of zero or one arguments, or if there are only two arguments and the
second is an array literal we treat function.apply as function.call.

Otherwise we use the new opcodes op_load_varargs and op_call_varargs to do the .apply call
without re-entering the virtual machine.

File:
1 edited

Legend:

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

    r42065 r42337  
    497497            NEXT_OPCODE(op_call_eval);
    498498        }
     499        case op_load_varargs: {
     500            emitPutJITStubArgConstant(currentInstruction[2].u.operand, 1);
     501            emitCTICall(JITStubs::cti_op_load_varargs);
     502            emitPutVirtualRegister(currentInstruction[1].u.operand);
     503            NEXT_OPCODE(op_load_varargs);
     504        }
     505        case op_call_varargs: {
     506            compileOpCallVarargs(currentInstruction);
     507            NEXT_OPCODE(op_call_varargs);
     508        }
    499509        case op_construct: {
    500510            compileOpCall(opcodeID, currentInstruction, callLinkInfoIndex++);
     
    15971607            NEXT_OPCODE(op_call_eval);
    15981608        }
     1609        case op_call_varargs: {
     1610            compileOpCallVarargsSlowCase(currentInstruction, iter);
     1611            NEXT_OPCODE(op_call_varargs);
     1612        }
    15991613        case op_construct: {
    16001614            compileOpCallSlowCase(currentInstruction, iter, callLinkInfoIndex++, opcodeID);
Note: See TracChangeset for help on using the changeset viewer.