Ignore:
Timestamp:
Feb 10, 2015, 3:16:36 PM (10 years ago)
Author:
[email protected]
Message:

op_call_varargs should only load the length once
https://bugs.webkit.org/show_bug.cgi?id=141440
rdar://problem/19761683

Reviewed by Michael Saboff.

Refactors the pair of calls that set up the varargs frame so that the first call returns the
length, and the second call uses the length returned by the first one. It turns out that this
gave me an opportunity to shorten a lot of the code.

  • interpreter/Interpreter.cpp:

(JSC::sizeFrameForVarargs):
(JSC::loadVarargs):
(JSC::setupVarargsFrame):
(JSC::setupVarargsFrameAndSetThis):

  • interpreter/Interpreter.h:

(JSC::calleeFrameForVarargs):

  • jit/CCallHelpers.h:

(JSC::CCallHelpers::setupArgumentsWithExecState):

  • jit/JIT.h:
  • jit/JITCall.cpp:

(JSC::JIT::compileSetupVarargsFrame):

  • jit/JITCall32_64.cpp:

(JSC::JIT::compileSetupVarargsFrame):

  • jit/JITInlines.h:

(JSC::JIT::callOperation):

  • jit/JITOperations.cpp:
  • jit/JITOperations.h:
  • jit/SetupVarargsFrame.cpp:

(JSC::emitSetVarargsFrame):
(JSC::emitSetupVarargsFrameFastCase):

  • jit/SetupVarargsFrame.h:
  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • runtime/Arguments.cpp:

(JSC::Arguments::copyToArguments):

  • runtime/Arguments.h:
  • runtime/JSArray.cpp:

(JSC::JSArray::copyToArguments):

  • runtime/JSArray.h:
  • runtime/VM.h:
  • tests/stress/call-varargs-length-effects.js: Added.

(foo):
(bar):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r179862 r179887  
    11651165    // - Set up a call frame while respecting the variable arguments.
    11661166   
    1167     ExecState* execCallee = sizeFrameForVarargs(exec, &vm.interpreter->stack(),
    1168         LLINT_OP_C(4).jsValue(), -pc[5].u.operand, pc[6].u.operand);
     1167    unsigned numUsedStackSlots = -pc[5].u.operand;
     1168    unsigned length = sizeFrameForVarargs(exec, &vm.interpreter->stack(),
     1169        LLINT_OP_C(4).jsValue(), numUsedStackSlots, pc[6].u.operand);
    11691170    LLINT_CALL_CHECK_EXCEPTION(exec, exec);
    11701171   
     1172    ExecState* execCallee = calleeFrameForVarargs(exec, numUsedStackSlots, length + 1);
     1173    vm.varargsLength = length;
    11711174    vm.newCallFrameReturnValue = execCallee;
    11721175
     
    11851188    ExecState* execCallee = vm.newCallFrameReturnValue;
    11861189
    1187     setupVarargsFrameAndSetThis(exec, execCallee, LLINT_OP_C(3).jsValue(), LLINT_OP_C(4).jsValue(), pc[6].u.operand);
     1190    setupVarargsFrameAndSetThis(exec, execCallee, LLINT_OP_C(3).jsValue(), LLINT_OP_C(4).jsValue(), pc[6].u.operand, vm.varargsLength);
    11881191    LLINT_CALL_CHECK_EXCEPTION(exec, exec);
    11891192   
     
    12061209    ExecState* execCallee = vm.newCallFrameReturnValue;
    12071210   
    1208     setupVarargsFrameAndSetThis(exec, execCallee, LLINT_OP_C(3).jsValue(), LLINT_OP_C(4).jsValue(), pc[6].u.operand);
     1211    setupVarargsFrameAndSetThis(exec, execCallee, LLINT_OP_C(3).jsValue(), LLINT_OP_C(4).jsValue(), pc[6].u.operand, vm.varargsLength);
    12091212    LLINT_CALL_CHECK_EXCEPTION(exec, exec);
    12101213   
Note: See TracChangeset for help on using the changeset viewer.