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/bytecode/CodeBlock.cpp

    r42065 r42337  
    966966            break;
    967967        }
     968        case op_call_varargs: {
     969            int dst = (++it)->u.operand;
     970            int func = (++it)->u.operand;
     971            int argCount = (++it)->u.operand;
     972            int registerOffset = (++it)->u.operand;
     973            printf("[%4d] call_varargs\t %s, %s, %s, %d\n", location, registerName(dst).c_str(), registerName(func).c_str(), registerName(argCount).c_str(), registerOffset);
     974            break;
     975        }
     976        case op_load_varargs: {
     977            printUnaryOp(location, it, "load_varargs");
     978            break;
     979        }
    968980        case op_tear_off_activation: {
    969981            int r0 = (++it)->u.operand;
Note: See TracChangeset for help on using the changeset viewer.