Changeset 178143 in webkit for trunk/Source/JavaScriptCore/jit


Ignore:
Timestamp:
Jan 8, 2015, 4:10:01 PM (11 years ago)
Author:
[email protected]
Message:

Make the LLINT and Baseline JIT's op_create_arguments and op_get_argument_by_val use their lexicalEnvironment operand.
<https://webkit.org/b/140236>

Reviewed by Geoffrey Garen.

Will change the DFG to use the operand on a subsequent pass. For now,
the DFG uses a temporary thunk (operationCreateArgumentsForDFG()) to
retain the old behavior of getting the lexicalEnviroment from the
ExecState.

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitGetArgumentByVal):
(JSC::BytecodeGenerator::createArgumentsIfNecessary):

  • When the lexicalEnvironment is not available, pass the invalid VirtualRegister instead of an empty JSValue as the lexicalEnvironment operand.
  • dfg/DFGOperations.cpp:
  • Use the lexicalEnvironment from the ExecState for now.
  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • Use the operationCreateArgumentsForDFG() thunk for now.
  • interpreter/CallFrame.cpp:

(JSC::CallFrame::lexicalEnvironmentOrNullptr):

  • interpreter/CallFrame.h:
  • Added this convenience function to return either the lexicalEnvironment or a nullptr so that we don't need to do a conditional check on codeBlock->needsActivation() at multiple sites.
  • interpreter/StackVisitor.cpp:

(JSC::StackVisitor::Frame::createArguments):

  • jit/JIT.h:
  • jit/JITInlines.h:

(JSC::JIT::callOperation):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_create_arguments):
(JSC::JIT::emitSlow_op_get_argument_by_val):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_create_arguments):
(JSC::JIT::emitSlow_op_get_argument_by_val):

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

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • runtime/Arguments.h:

(JSC::Arguments::create):
(JSC::Arguments::finishCreation):

  • runtime/CommonSlowPaths.cpp:

(JSC::SLOW_PATH_DECL):

  • runtime/JSLexicalEnvironment.cpp:

(JSC::JSLexicalEnvironment::argumentsGetter):

Location:
trunk/Source/JavaScriptCore/jit
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r177146 r178143  
    682682        MacroAssembler::Call callOperation(C_JITOperation_E);
    683683        MacroAssembler::Call callOperation(C_JITOperation_EO, GPRReg);
     684        MacroAssembler::Call callOperation(C_JITOperation_EL, GPRReg);
     685        MacroAssembler::Call callOperation(C_JITOperation_EL, TrustedImmPtr);
    684686        MacroAssembler::Call callOperation(C_JITOperation_ESt, Structure*);
    685687        MacroAssembler::Call callOperation(C_JITOperation_EZ, int32_t);
  • trunk/Source/JavaScriptCore/jit/JITInlines.h

    r177146 r178143  
    217217}
    218218
     219ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(C_JITOperation_EL operation, GPRReg arg1)
     220{
     221    setupArgumentsWithExecState(arg1);
     222    return appendCallWithExceptionCheck(operation);
     223}
     224   
     225ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(C_JITOperation_EL operation, TrustedImmPtr arg1)
     226{
     227    setupArgumentsWithExecState(arg1);
     228    return appendCallWithExceptionCheck(operation);
     229}
     230   
    219231ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(C_JITOperation_EO operation, GPRReg arg)
    220232{
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r177871 r178143  
    690690{
    691691    int dst = currentInstruction[1].u.operand;
     692    int lexicalEnvironment = currentInstruction[2].u.operand;
    692693
    693694    Jump argsCreated = branchTest64(NonZero, Address(callFrameRegister, sizeof(Register) * dst));
    694695
    695     callOperation(operationCreateArguments);
     696    if (VirtualRegister(lexicalEnvironment).isValid()) {
     697        emitGetVirtualRegister(lexicalEnvironment, regT0);
     698        callOperation(operationCreateArguments, regT0);
     699    } else
     700        callOperation(operationCreateArguments, TrustedImmPtr(nullptr));
    696701    emitStoreCell(dst, returnValueGPR);
    697702    emitStoreCell(unmodifiedArgumentsRegister(VirtualRegister(dst)), returnValueGPR);
     
    957962    int arguments = currentInstruction[2].u.operand;
    958963    int property = currentInstruction[3].u.operand;
     964    int lexicalEnvironment = currentInstruction[4].u.operand;
    959965   
    960966    linkSlowCase(iter);
     
    963969    linkSlowCase(iter);
    964970    linkSlowCase(iter);
    965     callOperation(operationCreateArguments);
     971    if (VirtualRegister(lexicalEnvironment).isValid()) {
     972        emitGetVirtualRegister(lexicalEnvironment, regT0);
     973        callOperation(operationCreateArguments, regT0);
     974    } else
     975        callOperation(operationCreateArguments, TrustedImmPtr(nullptr));
    966976    emitStoreCell(arguments, returnValueGPR);
    967977    emitStoreCell(unmodifiedArgumentsRegister(VirtualRegister(arguments)), returnValueGPR);
  • trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp

    r177146 r178143  
    919919{
    920920    int dst = currentInstruction[1].u.operand;
     921    int lexicalEnvironment = currentInstruction[2].u.operand;
    921922
    922923    Jump argsCreated = branch32(NotEqual, tagFor(dst), TrustedImm32(JSValue::EmptyValueTag));
    923     callOperation(operationCreateArguments);
     924
     925    if (VirtualRegister(lexicalEnvironment).isValid()) {
     926        emitLoadPayload(lexicalEnvironment, regT0);
     927        callOperation(operationCreateArguments, regT0);
     928    } else
     929        callOperation(operationCreateArguments, TrustedImmPtr(nullptr));
    924930    emitStoreCell(dst, returnValueGPR);
    925931    emitStoreCell(unmodifiedArgumentsRegister(VirtualRegister(dst)).offset(), returnValueGPR);
     932
    926933    argsCreated.link(this);
    927934}
     
    10651072    int arguments = currentInstruction[2].u.operand;
    10661073    int property = currentInstruction[3].u.operand;
     1074    int lexicalEnvironment = currentInstruction[4].u.operand;
    10671075
    10681076    linkSlowCase(iter);
     
    10721080    linkSlowCase(iter);
    10731081
    1074     callOperation(operationCreateArguments);
     1082    if (VirtualRegister(lexicalEnvironment).isValid()) {
     1083        emitLoadPayload(lexicalEnvironment, regT0);
     1084        callOperation(operationCreateArguments, regT0);
     1085    } else
     1086        callOperation(operationCreateArguments, TrustedImmPtr(nullptr));
    10751087    emitStoreCell(arguments, returnValueGPR);
    10761088    emitStoreCell(unmodifiedArgumentsRegister(VirtualRegister(arguments)).offset(), returnValueGPR);
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r177675 r178143  
    14031403}
    14041404
    1405 JSCell* JIT_OPERATION operationCreateArguments(ExecState* exec)
     1405// FIXME: This is a temporary thunk for the DFG until we add the lexicalEnvironment operand to the DFG CreateArguments node.
     1406JSCell* JIT_OPERATION operationCreateArgumentsForDFG(ExecState* exec)
     1407{
     1408    JSLexicalEnvironment* lexicalEnvironment = exec->lexicalEnvironmentOrNullptr();
     1409    return operationCreateArguments(exec, lexicalEnvironment);
     1410}
     1411   
     1412JSCell* JIT_OPERATION operationCreateArguments(ExecState* exec, JSLexicalEnvironment* lexicalEnvironment)
    14061413{
    14071414    VM& vm = exec->vm();
     
    14091416    // NB: This needs to be exceedingly careful with top call frame tracking, since it
    14101417    // may be called from OSR exit, while the state of the call stack is bizarre.
    1411     Arguments* result = Arguments::create(vm, exec);
     1418    Arguments* result = Arguments::create(vm, exec, lexicalEnvironment);
    14121419    ASSERT(!vm.exception());
    14131420    return result;
     
    14171424{
    14181425    DeferGCForAWhile(exec->vm().heap);
    1419     return operationCreateArguments(exec);
     1426    JSLexicalEnvironment* lexicalEnvironment = exec->lexicalEnvironmentOrNullptr();
     1427    return operationCreateArguments(exec, lexicalEnvironment);
    14201428}
    14211429
  • trunk/Source/JavaScriptCore/jit/JITOperations.h

    r177146 r178143  
    7272    Jsc: JSScope*
    7373    Jss: JSString*
     74    L: JSLexicalEnvironment*
    7475    O: JSObject*
    7576    P: pointer (char*)
     
    137138typedef JSCell* JIT_OPERATION (*C_JITOperation_EJssJss)(ExecState*, JSString*, JSString*);
    138139typedef JSCell* JIT_OPERATION (*C_JITOperation_EJssJssJss)(ExecState*, JSString*, JSString*, JSString*);
     140typedef JSCell* JIT_OPERATION (*C_JITOperation_EL)(ExecState*, JSLexicalEnvironment*);
    139141typedef JSCell* JIT_OPERATION (*C_JITOperation_EO)(ExecState*, JSObject*);
    140142typedef JSCell* JIT_OPERATION (*C_JITOperation_EOZ)(ExecState*, JSObject*, int32_t);
     
    295297EncodedJSValue JIT_OPERATION operationCheckHasInstance(ExecState*, EncodedJSValue, EncodedJSValue baseVal) WTF_INTERNAL;
    296298JSCell* JIT_OPERATION operationCreateActivation(ExecState*, JSScope* currentScope, int32_t offset) WTF_INTERNAL;
    297 JSCell* JIT_OPERATION operationCreateArguments(ExecState*) WTF_INTERNAL;
     299JSCell* JIT_OPERATION operationCreateArgumentsForDFG(ExecState*) WTF_INTERNAL; // FIXME: This is a temporary thunk for the DFG until we add the lexicalEnvironment operand to the DFG CreateArguments node.
     300JSCell* JIT_OPERATION operationCreateArguments(ExecState*, JSLexicalEnvironment*) WTF_INTERNAL;
    298301JSCell* JIT_OPERATION operationCreateArgumentsDuringOSRExit(ExecState*) WTF_INTERNAL;
    299302EncodedJSValue JIT_OPERATION operationGetArgumentsLength(ExecState*, int32_t) WTF_INTERNAL;
Note: See TracChangeset for help on using the changeset viewer.