Changeset 157404 in webkit


Ignore:
Timestamp:
Oct 14, 2013 9:42:22 AM (11 years ago)
Author:
mark.lam@apple.com
Message:

Transition misc cti_op_* JITStubs to JIT operations.
https://bugs.webkit.org/show_bug.cgi?id=122645.

Reviewed by Michael Saboff.

Stubs converted:

cti_op_check_has_instance
cti_op_create_arguments
cti_op_del_by_id
cti_op_instanceof
cti_to_object
cti_op_push_activation
cti_op_get_pnames
cti_op_load_varargs

  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • jit/CCallHelpers.h:

(JSC::CCallHelpers::setupArgumentsWithExecState):

  • jit/JIT.h:

(JSC::JIT::emitStoreCell):

  • jit/JITCall.cpp:

(JSC::JIT::compileLoadVarargs):

  • jit/JITCall32_64.cpp:

(JSC::JIT::compileLoadVarargs):

  • jit/JITInlines.h:

(JSC::JIT::callOperation):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_get_pnames):
(JSC::JIT::emit_op_create_activation):
(JSC::JIT::emit_op_create_arguments):
(JSC::JIT::emitSlow_op_check_has_instance):
(JSC::JIT::emitSlow_op_instanceof):
(JSC::JIT::emitSlow_op_get_argument_by_val):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emitSlow_op_check_has_instance):
(JSC::JIT::emitSlow_op_instanceof):
(JSC::JIT::emit_op_get_pnames):
(JSC::JIT::emit_op_create_activation):
(JSC::JIT::emit_op_create_arguments):
(JSC::JIT::emitSlow_op_get_argument_by_val):

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

(JSC::JIT::emit_op_del_by_id):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::emit_op_del_by_id):

  • jit/JITStubs.cpp:
  • jit/JITStubs.h:
Location:
trunk/Source/JavaScriptCore
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r157382 r157404  
     12013-10-13  Mark Lam  <mark.lam@apple.com>
     2
     3        Transition misc cti_op_* JITStubs to JIT operations.
     4        https://bugs.webkit.org/show_bug.cgi?id=122645.
     5
     6        Reviewed by Michael Saboff.
     7
     8        Stubs converted:
     9            cti_op_check_has_instance
     10            cti_op_create_arguments
     11            cti_op_del_by_id
     12            cti_op_instanceof
     13            cti_to_object
     14            cti_op_push_activation
     15            cti_op_get_pnames
     16            cti_op_load_varargs
     17
     18        * dfg/DFGOperations.cpp:
     19        * dfg/DFGOperations.h:
     20        * jit/CCallHelpers.h:
     21        (JSC::CCallHelpers::setupArgumentsWithExecState):
     22        * jit/JIT.h:
     23        (JSC::JIT::emitStoreCell):
     24        * jit/JITCall.cpp:
     25        (JSC::JIT::compileLoadVarargs):
     26        * jit/JITCall32_64.cpp:
     27        (JSC::JIT::compileLoadVarargs):
     28        * jit/JITInlines.h:
     29        (JSC::JIT::callOperation):
     30        * jit/JITOpcodes.cpp:
     31        (JSC::JIT::emit_op_get_pnames):
     32        (JSC::JIT::emit_op_create_activation):
     33        (JSC::JIT::emit_op_create_arguments):
     34        (JSC::JIT::emitSlow_op_check_has_instance):
     35        (JSC::JIT::emitSlow_op_instanceof):
     36        (JSC::JIT::emitSlow_op_get_argument_by_val):
     37        * jit/JITOpcodes32_64.cpp:
     38        (JSC::JIT::emitSlow_op_check_has_instance):
     39        (JSC::JIT::emitSlow_op_instanceof):
     40        (JSC::JIT::emit_op_get_pnames):
     41        (JSC::JIT::emit_op_create_activation):
     42        (JSC::JIT::emit_op_create_arguments):
     43        (JSC::JIT::emitSlow_op_get_argument_by_val):
     44        * jit/JITOperations.cpp:
     45        * jit/JITOperations.h:
     46        * jit/JITPropertyAccess.cpp:
     47        (JSC::JIT::emit_op_del_by_id):
     48        * jit/JITPropertyAccess32_64.cpp:
     49        (JSC::JIT::emit_op_del_by_id):
     50        * jit/JITStubs.cpp:
     51        * jit/JITStubs.h:
     52
    1532013-10-13  Filip Pizlo  <fpizlo@apple.com>
    254
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp

    r157313 r157404  
    681681}
    682682
    683 JSCell* JIT_OPERATION operationCreateActivation(ExecState* exec, int32_t offset)
    684 {
    685     VM& vm = exec->vm();
    686     NativeCallFrameTracer tracer(&vm, exec);
    687     JSActivation* activation = JSActivation::create(vm, exec, exec->registers() + offset, exec->codeBlock());
    688     exec->setScope(activation);
    689     return activation;
    690 }
    691 
    692 JSCell* JIT_OPERATION operationCreateArguments(ExecState* exec)
    693 {
    694     VM& vm = exec->vm();
    695     NativeCallFrameTracer tracer(&vm, exec);
    696     // NB: This needs to be exceedingly careful with top call frame tracking, since it
    697     // may be called from OSR exit, while the state of the call stack is bizarre.
    698     Arguments* result = Arguments::create(vm, exec);
    699     ASSERT(!vm.exception());
    700     return result;
    701 }
    702 
    703683JSCell* JIT_OPERATION operationCreateInlinedArguments(
    704684    ExecState* exec, InlineCallFrame* inlineCallFrame)
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.h

    r157313 r157404  
    9191size_t JIT_OPERATION operationCompareStrictEqCell(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL;
    9292size_t JIT_OPERATION operationCompareStrictEq(ExecState*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL;
    93 JSCell* JIT_OPERATION operationCreateActivation(ExecState*, int32_t offset) WTF_INTERNAL;
    94 JSCell* JIT_OPERATION operationCreateArguments(ExecState*) WTF_INTERNAL;
    9593JSCell* JIT_OPERATION operationCreateInlinedArguments(ExecState*, InlineCallFrame*) WTF_INTERNAL;
    9694void JIT_OPERATION operationTearOffArguments(ExecState*, JSCell*, JSCell*) WTF_INTERNAL;
  • trunk/Source/JavaScriptCore/jit/CCallHelpers.h

    r157339 r157404  
    374374    }
    375375
     376    ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, TrustedImm32 arg5)
     377    {
     378        resetCallArguments();
     379        addCallArgument(GPRInfo::callFrameRegister);
     380        addCallArgument(arg1);
     381        addCallArgument(arg2);
     382        addCallArgument(arg3);
     383        addCallArgument(arg4);
     384        addCallArgument(arg5);
     385    }
     386
    376387    ALWAYS_INLINE void setupArgumentsWithExecState(FPRReg arg1, GPRReg arg2)
    377388    {
     
    950961    ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, TrustedImm32 arg3)
    951962    {
    952         move(arg2, GPRInfo::argumentGPR2);
     963        move(arg2, GPRInfo::argumentGPR2); // In case arg2 is argumentGPR1.
    953964        move(arg1, GPRInfo::argumentGPR1);
    954965        move(arg3, GPRInfo::argumentGPR3);
     
    10361047
    10371048    ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5)
     1049    {
     1050        poke(arg5, POKE_ARGUMENT_OFFSET + 1);
     1051        poke(arg4, POKE_ARGUMENT_OFFSET);
     1052        setupArgumentsWithExecState(arg1, arg2, arg3);
     1053    }
     1054
     1055    ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, TrustedImm32 arg5)
    10381056    {
    10391057        poke(arg5, POKE_ARGUMENT_OFFSET + 1);
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r157313 r157404  
    5757    class JIT;
    5858    class JSPropertyNameIterator;
     59    class Identifier;
    5960    class Interpreter;
    6061    class JSScope;
     
    616617        void emitPutVirtualRegister(VirtualRegister dst, RegisterID from = regT0);
    617618        void emitStoreCell(int dst, RegisterID payload, bool /* only used in JSValue32_64 */ = false)
     619        {
     620            emitPutVirtualRegister(dst, payload);
     621        }
     622        void emitStoreCell(VirtualRegister dst, RegisterID payload)
    618623        {
    619624            emitPutVirtualRegister(dst, payload);
     
    868873        MacroAssembler::Call appendCallWithCallFrameRollbackOnException(const FunctionPtr&);
    869874        MacroAssembler::Call appendCallWithExceptionCheckSetJSValueResult(const FunctionPtr&, int);
     875        MacroAssembler::Call callOperation(C_JITOperation_E);
     876        MacroAssembler::Call callOperation(C_JITOperation_EO, GPRReg);
    870877        MacroAssembler::Call callOperation(C_JITOperation_ESt, Structure*);
     878        MacroAssembler::Call callOperation(C_JITOperation_EZ, int32_t);
     879        MacroAssembler::Call callOperation(F_JITOperation_EJJZ, GPRReg, GPRReg, int32_t);
    871880        MacroAssembler::Call callOperation(J_JITOperation_E, int);
    872 #if USE(JSVALUE64)
    873881        MacroAssembler::Call callOperation(J_JITOperation_EAapJ, int, ArrayAllocationProfile*, GPRReg);
    874 #else
    875         MacroAssembler::Call callOperation(J_JITOperation_EAapJ, int, ArrayAllocationProfile*, GPRReg, GPRReg);
    876 #endif
    877882        MacroAssembler::Call callOperation(J_JITOperation_EAapJcpZ, int, ArrayAllocationProfile*, GPRReg, int32_t);
    878883        MacroAssembler::Call callOperation(J_JITOperation_EAapJcpZ, int, ArrayAllocationProfile*, const JSValue*, int32_t);
    879884        MacroAssembler::Call callOperation(J_JITOperation_EC, int, JSCell*);
     885        MacroAssembler::Call callOperation(J_JITOperation_EJ, int, GPRReg);
     886        MacroAssembler::Call callOperation(J_JITOperation_EJIdc, int, GPRReg, const Identifier*);
     887        MacroAssembler::Call callOperation(J_JITOperation_EJJ, int, GPRReg, GPRReg);
    880888        MacroAssembler::Call callOperation(J_JITOperation_EP, int, void*);
    881889        MacroAssembler::Call callOperation(S_JITOperation_ECC, RegisterID, RegisterID);
     
    887895        MacroAssembler::Call callOperationWithCallFrameRollbackOnException(Z_JITOperation_E);
    888896#if USE(JSVALUE32_64)
     897        MacroAssembler::Call callOperation(F_JITOperation_EJJZ, GPRReg, GPRReg, GPRReg, GPRReg, int32_t);
     898        MacroAssembler::Call callOperation(J_JITOperation_EAapJ, int, ArrayAllocationProfile*, GPRReg, GPRReg);
     899        MacroAssembler::Call callOperation(J_JITOperation_EJ, int, GPRReg, GPRReg);
     900        MacroAssembler::Call callOperation(J_JITOperation_EJIdc, int, GPRReg, GPRReg, const Identifier*);
     901        MacroAssembler::Call callOperation(J_JITOperation_EJJ, int, GPRReg, GPRReg, GPRReg, GPRReg);
    889902        MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID, RegisterID);
    890903        MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID, RegisterID, RegisterID);
  • trunk/Source/JavaScriptCore/jit/JITCall.cpp

    r157164 r157404  
    120120        slowCase.link(this);
    121121
    122     JITStubCall stubCall(this, cti_op_load_varargs);
    123     stubCall.addArgument(thisValue, regT0);
    124     stubCall.addArgument(arguments, regT0);
    125     stubCall.addArgument(Imm32(firstFreeRegister));
    126     stubCall.call(regT1);
     122    emitGetVirtualRegister(thisValue, regT0);
     123    emitGetVirtualRegister(arguments, regT1);
     124    callOperation(operationLoadVarargs, regT0, regT1, firstFreeRegister);
     125    move(returnValueRegister, regT1);
    127126
    128127    if (canOptimize)
  • trunk/Source/JavaScriptCore/jit/JITCall32_64.cpp

    r157164 r157404  
    191191        slowCase.link(this);
    192192
    193     JITStubCall stubCall(this, cti_op_load_varargs);
    194     stubCall.addArgument(thisValue);
    195     stubCall.addArgument(arguments);
    196     stubCall.addArgument(Imm32(firstFreeRegister));
    197     stubCall.call(regT3);
     193    emitLoad(thisValue, regT1, regT0);
     194    emitLoad(arguments, regT3, regT2);
     195    callOperation(operationLoadVarargs, regT1, regT0, regT3, regT2, firstFreeRegister);
     196    move(returnValueRegister, regT3);
    198197
    199198    if (canOptimize)
  • trunk/Source/JavaScriptCore/jit/JITInlines.h

    r157313 r157404  
    232232}
    233233
     234ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(C_JITOperation_E operation)
     235{
     236    setupArgumentsExecState();
     237    return appendCallWithExceptionCheck(operation);
     238}
     239
     240ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(C_JITOperation_EO operation, GPRReg arg)
     241{
     242    setupArgumentsWithExecState(arg);
     243    return appendCallWithExceptionCheck(operation);
     244}
     245
    234246ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(C_JITOperation_ESt operation, Structure* structure)
    235247{
     
    238250}
    239251
     252ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(C_JITOperation_EZ operation, int32_t arg)
     253{
     254    setupArgumentsWithExecState(TrustedImm32(arg));
     255    return appendCallWithExceptionCheck(operation);
     256}
     257
     258
     259#if USE(JSVALUE64)
     260ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(F_JITOperation_EJJZ operation, GPRReg arg1, GPRReg arg2, int32_t arg3)
     261{
     262    setupArgumentsWithExecState(arg1, arg2, TrustedImm32(arg3));
     263    return appendCallWithExceptionCheck(operation);
     264}
     265#endif
     266
    240267ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_E operation, int dst)
    241268{
     
    244271}
    245272
     273ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EAapJ operation, int dst, ArrayAllocationProfile* arg1, GPRReg arg2)
     274{
     275    setupArgumentsWithExecState(TrustedImmPtr(arg1), arg2);
     276    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
     277}
     278
    246279ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EAapJcpZ operation, int dst, ArrayAllocationProfile* arg1, GPRReg arg2, int32_t arg3)
    247280{
     
    259292{
    260293    setupArgumentsWithExecState(TrustedImmPtr(cell));
     294    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
     295}
     296
     297ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EJ operation, int dst, GPRReg arg1)
     298{
     299    setupArgumentsWithExecState(arg1);
     300    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
     301}
     302
     303ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EJIdc operation, int dst, GPRReg arg1, const Identifier* arg2)
     304{
     305    setupArgumentsWithExecState(arg1, TrustedImmPtr(arg2));
     306    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
     307}
     308
     309ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EJJ operation, int dst, GPRReg arg1, GPRReg arg2)
     310{
     311    setupArgumentsWithExecState(arg1, arg2);
    261312    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
    262313}
     
    328379#endif
    329380
     381ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(F_JITOperation_EJJZ operation, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload, int32_t arg3)
     382{
     383    setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, SH4_32BIT_DUMMY_ARG arg2Payload, arg2Tag, TrustedImm32(arg3));
     384    return appendCallWithExceptionCheck(operation);
     385}
     386
    330387ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EAapJ operation, int dst, ArrayAllocationProfile* arg1, GPRReg arg2Tag, GPRReg arg2Payload)
    331388{
    332389    setupArgumentsWithExecState(TrustedImmPtr(arg1), EABI_32BIT_DUMMY_ARG arg2Payload, arg2Tag);
     390    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
     391}
     392
     393ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EJ operation, int dst, GPRReg arg1Tag, GPRReg arg1Payload)
     394{
     395    setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag);
     396    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
     397}
     398
     399ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EJIdc operation, int dst, GPRReg arg1Tag, GPRReg arg1Payload, const Identifier* arg2)
     400{
     401    setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, TrustedImmPtr(arg2));
     402    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
     403}
     404
     405ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EJJ operation, int dst, GPRReg arg1Tag, GPRReg arg1Payload, GPRReg arg2Tag, GPRReg arg2Payload)
     406{
     407    setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, SH4_32BIT_DUMMY_ARG arg2Payload, arg2Tag);
    333408    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
    334409}
     
    348423#undef EABI_32BIT_DUMMY_ARG
    349424#undef SH4_32BIT_DUMMY_ARG
    350 
    351 #else // USE(JSVALUE32_64)
    352 
    353 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EAapJ operation, int dst, ArrayAllocationProfile* arg1, GPRReg arg2)
    354 {
    355     setupArgumentsWithExecState(TrustedImmPtr(arg1), arg2);
    356     return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
    357 }
    358425
    359426#endif // USE(JSVALUE32_64)
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r157313 r157404  
    518518    // this call doesn't seem to be hot.
    519519    Label isObject(this);
    520     JITStubCall getPnamesStubCall(this, cti_op_get_pnames);
    521     getPnamesStubCall.addArgument(regT0);
    522     getPnamesStubCall.call(dst);
     520    callOperation(operationGetPNames, regT0);
     521    emitStoreCell(dst, returnValueRegister);
    523522    load32(Address(regT0, OBJECT_OFFSETOF(JSPropertyNameIterator, m_jsStringsSize)), regT3);
    524523    store64(tagTypeNumberRegister, addressFor(i));
     
    531530    and32(TrustedImm32(~TagBitUndefined), regT1);
    532531    addJump(branch32(Equal, regT1, TrustedImm32(ValueNull)), breakTarget);
    533 
    534     JITStubCall toObjectStubCall(this, cti_to_object);
    535     toObjectStubCall.addArgument(regT0);
    536     toObjectStubCall.call(base);
     532    callOperation(operationToObject, base, regT0);
    537533    jump().linkTo(isObject, this);
    538534   
     
    841837   
    842838    Jump activationCreated = branchTest64(NonZero, Address(callFrameRegister, sizeof(Register) * dst));
    843     JITStubCall(this, cti_op_push_activation).call(dst);
     839    callOperation(operationCreateActivation, 0);
     840    emitStoreCell(dst, returnValueRegister);
    844841    activationCreated.link(this);
    845842}
     
    850847
    851848    Jump argsCreated = branchTest64(NonZero, Address(callFrameRegister, sizeof(Register) * dst));
    852     JITStubCall(this, cti_op_create_arguments).call();
    853     emitPutVirtualRegister(dst);
    854     emitPutVirtualRegister(unmodifiedArgumentsRegister(VirtualRegister(dst)));
     849
     850    callOperation(operationCreateArguments);
     851    emitStoreCell(dst, returnValueRegister);
     852    emitStoreCell(unmodifiedArgumentsRegister(VirtualRegister(dst)), returnValueRegister);
     853
    855854    argsCreated.link(this);
    856855}
     
    10461045    linkSlowCaseIfNotJSCell(iter, baseVal);
    10471046    linkSlowCase(iter);
    1048     JITStubCall stubCall(this, cti_op_check_has_instance);
    1049     stubCall.addArgument(value, regT2);
    1050     stubCall.addArgument(baseVal, regT2);
    1051     stubCall.call(dst);
     1047    emitGetVirtualRegister(value, regT0);
     1048    emitGetVirtualRegister(baseVal, regT1);
     1049    callOperation(operationCheckHasInstance, dst, regT0, regT1);
    10521050
    10531051    emitJumpSlowToHot(jump(), currentInstruction[4].u.operand);
     
    10631061    linkSlowCaseIfNotJSCell(iter, proto);
    10641062    linkSlowCase(iter);
    1065     JITStubCall stubCall(this, cti_op_instanceof);
    1066     stubCall.addArgument(value, regT2);
    1067     stubCall.addArgument(proto, regT2);
    1068     stubCall.call(dst);
     1063    emitGetVirtualRegister(value, regT0);
     1064    emitGetVirtualRegister(proto, regT1);
     1065    callOperation(operationInstanceOf, dst, regT0, regT1);
    10691066}
    10701067
     
    11331130    linkSlowCase(iter);
    11341131    linkSlowCase(iter);
    1135     JITStubCall(this, cti_op_create_arguments).call();
    1136     emitPutVirtualRegister(arguments);
    1137     emitPutVirtualRegister(unmodifiedArgumentsRegister(VirtualRegister(arguments)));
     1132    callOperation(operationCreateArguments);
     1133    emitStoreCell(arguments, returnValueRegister);
     1134    emitStoreCell(unmodifiedArgumentsRegister(VirtualRegister(arguments)), returnValueRegister);
    11381135   
    11391136    skipArgumentsCreation.link(this);
  • trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp

    r157313 r157404  
    297297    linkSlowCase(iter);
    298298
    299     JITStubCall stubCall(this, cti_op_check_has_instance);
    300     stubCall.addArgument(value);
    301     stubCall.addArgument(baseVal);
    302     stubCall.call(dst);
     299    emitLoad(value, regT1, regT0);
     300    emitLoad(baseVal, regT3, regT2);
     301    callOperation(operationCheckHasInstance, dst, regT1, regT0, regT3, regT2);
    303302
    304303    emitJumpSlowToHot(jump(), currentInstruction[4].u.operand);
     
    315314    linkSlowCase(iter);
    316315
    317     JITStubCall stubCall(this, cti_op_instanceof);
    318     stubCall.addArgument(value);
    319     stubCall.addArgument(proto);
    320     stubCall.call(dst);
     316    emitLoad(value, regT1, regT0);
     317    emitLoad(proto, regT3, regT2);
     318    callOperation(operationInstanceOf, dst, regT1, regT0, regT3, regT2);
    321319}
    322320
     
    850848    // this call doesn't seem to be hot.
    851849    Label isObject(this);
    852     JITStubCall getPnamesStubCall(this, cti_op_get_pnames);
    853     getPnamesStubCall.addArgument(regT0);
    854     getPnamesStubCall.call(dst);
     850    callOperation(operationGetPNames, regT0);
     851    emitStoreCell(dst, returnValueRegister);
    855852    load32(Address(regT0, OBJECT_OFFSETOF(JSPropertyNameIterator, m_jsStringsSize)), regT3);
    856853    store32(TrustedImm32(Int32Tag), intTagFor(i));
     
    863860    addJump(branch32(Equal, regT1, TrustedImm32(JSValue::NullTag)), breakTarget);
    864861    addJump(branch32(Equal, regT1, TrustedImm32(JSValue::UndefinedTag)), breakTarget);
    865     JITStubCall toObjectStubCall(this, cti_to_object);
    866     toObjectStubCall.addArgument(regT1, regT0);
    867     toObjectStubCall.call(base);
     862    callOperation(operationToObject, base, regT1, regT0);
    868863    jump().linkTo(isObject, this);
    869864
     
    10901085   
    10911086    Jump activationCreated = branch32(NotEqual, tagFor(activation), TrustedImm32(JSValue::EmptyValueTag));
    1092     JITStubCall(this, cti_op_push_activation).call(activation);
     1087    callOperation(operationCreateActivation, 0);
     1088    emitStoreCell(activation, returnValueRegister);
    10931089    activationCreated.link(this);
    10941090}
     
    10991095
    11001096    Jump argsCreated = branch32(NotEqual, tagFor(dst), TrustedImm32(JSValue::EmptyValueTag));
    1101 
    1102     JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_create_arguments);
    1103     slowPathCall.call();
    1104 
     1097    callOperation(operationCreateArguments);
     1098    emitStoreCell(dst, returnValueRegister);
     1099    emitStoreCell(unmodifiedArgumentsRegister(VirtualRegister(dst)).offset(), returnValueRegister);
    11051100    argsCreated.link(this);
    11061101}
     
    12571252    linkSlowCase(iter);
    12581253
    1259     JITStubCall(this, cti_op_create_arguments).call();
    1260     emitStore(arguments, regT1, regT0);
    1261     emitStore(unmodifiedArgumentsRegister(VirtualRegister(arguments)).offset(), regT1, regT0);
     1254    callOperation(operationCreateArguments);
     1255    emitStoreCell(arguments, returnValueRegister);
     1256    emitStoreCell(unmodifiedArgumentsRegister(VirtualRegister(arguments)).offset(), returnValueRegister);
    12621257   
    12631258    skipArgumentsCreation.link(this);
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r157313 r157404  
    2828#include "JITOperations.h"
    2929
     30#include "Arguments.h"
    3031#include "ArrayConstructor.h"
    3132#include "CommonSlowPaths.h"
     
    3536#include "JITOperationWrappers.h"
    3637#include "JSGlobalObjectFunctions.h"
     38#include "JSPropertyNameIterator.h"
    3739#include "ObjectConstructor.h"
    3840#include "Operations.h"
     
    797799}
    798800
     801EncodedJSValue JIT_OPERATION operationCheckHasInstance(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedBaseVal)
     802{
     803    VM* vm = &exec->vm();
     804    NativeCallFrameTracer tracer(vm, exec);
     805
     806    JSValue value = JSValue::decode(encodedValue);
     807    JSValue baseVal = JSValue::decode(encodedBaseVal);
     808
     809    if (baseVal.isObject()) {
     810        JSObject* baseObject = asObject(baseVal);
     811        ASSERT(!baseObject->structure()->typeInfo().implementsDefaultHasInstance());
     812        if (baseObject->structure()->typeInfo().implementsHasInstance()) {
     813            bool result = baseObject->methodTable()->customHasInstance(baseObject, exec, value);
     814            return JSValue::encode(jsBoolean(result));
     815        }
     816    }
     817
     818    vm->throwException(exec, createInvalidParameterError(exec, "instanceof", baseVal));
     819    return JSValue::encode(JSValue());
     820}
     821
     822JSCell* JIT_OPERATION operationCreateActivation(ExecState* exec, int32_t offset)
     823{
     824    VM& vm = exec->vm();
     825    NativeCallFrameTracer tracer(&vm, exec);
     826    JSActivation* activation = JSActivation::create(vm, exec, exec->registers() + offset, exec->codeBlock());
     827    exec->setScope(activation);
     828    return activation;
     829}
     830
     831JSCell* JIT_OPERATION operationCreateArguments(ExecState* exec)
     832{
     833    VM& vm = exec->vm();
     834    NativeCallFrameTracer tracer(&vm, exec);
     835    // NB: This needs to be exceedingly careful with top call frame tracking, since it
     836    // may be called from OSR exit, while the state of the call stack is bizarre.
     837    Arguments* result = Arguments::create(vm, exec);
     838    ASSERT(!vm.exception());
     839    return result;
     840}
     841
     842EncodedJSValue JIT_OPERATION operationDeleteById(ExecState* exec, EncodedJSValue encodedBase, const Identifier* identifier)
     843{
     844    VM& vm = exec->vm();
     845    NativeCallFrameTracer tracer(&vm, exec);
     846
     847    JSObject* baseObj = JSValue::decode(encodedBase).toObject(exec);
     848    bool couldDelete = baseObj->methodTable()->deleteProperty(baseObj, exec, *identifier);
     849    JSValue result = jsBoolean(couldDelete);
     850    if (!couldDelete && exec->codeBlock()->isStrictMode())
     851        vm.throwException(exec, createTypeError(exec, "Unable to delete property."));
     852    return JSValue::encode(result);
     853}
     854
     855JSCell* JIT_OPERATION operationGetPNames(ExecState* exec, JSObject* obj)
     856{
     857    VM& vm = exec->vm();
     858    NativeCallFrameTracer tracer(&vm, exec);
     859
     860    Structure* structure = obj->structure();
     861    JSPropertyNameIterator* jsPropertyNameIterator = structure->enumerationCache();
     862    if (!jsPropertyNameIterator || jsPropertyNameIterator->cachedPrototypeChain() != structure->prototypeChain(exec))
     863        jsPropertyNameIterator = JSPropertyNameIterator::create(exec, obj);
     864    return jsPropertyNameIterator;
     865}
     866
     867EncodedJSValue JIT_OPERATION operationInstanceOf(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedProto)
     868{
     869    VM& vm = exec->vm();
     870    NativeCallFrameTracer tracer(&vm, exec);
     871    JSValue value = JSValue::decode(encodedValue);
     872    JSValue proto = JSValue::decode(encodedProto);
     873   
     874    ASSERT(!value.isObject() || !proto.isObject());
     875
     876    bool result = JSObject::defaultHasInstance(exec, value, proto);
     877    return JSValue::encode(jsBoolean(result));
     878}
     879
     880CallFrame* JIT_OPERATION operationLoadVarargs(ExecState* exec, EncodedJSValue encodedThis, EncodedJSValue encodedArguments, int32_t firstFreeRegister)
     881{
     882    VM& vm = exec->vm();
     883    NativeCallFrameTracer tracer(&vm, exec);
     884    JSStack* stack = &exec->interpreter()->stack();
     885    JSValue thisValue = JSValue::decode(encodedThis);
     886    JSValue arguments = JSValue::decode(encodedArguments);
     887    CallFrame* newCallFrame = loadVarargs(exec, stack, thisValue, arguments, firstFreeRegister);
     888    return newCallFrame;
     889}
     890
     891EncodedJSValue JIT_OPERATION operationToObject(ExecState* exec, EncodedJSValue value)
     892{
     893    VM& vm = exec->vm();
     894    NativeCallFrameTracer tracer(&vm, exec);
     895    return JSValue::encode(JSValue::decode(value).toObject(exec));
     896}
     897
    799898JITHandlerEncoded JIT_OPERATION lookupExceptionHandler(ExecState* exec)
    800899{
  • trunk/Source/JavaScriptCore/jit/JITOperations.h

    r157313 r157404  
    5353    D: double
    5454    E: ExecState*
     55    F: CallFrame*
    5556    I: StringImpl*
    5657    Icf: InlineCalLFrame*
     58    Idc: const Identifier*
    5759    J: EncodedJSValue
    5860    Jcp: const JSValue*
    5961    Jss: JSString*
    6062    O: JSObject*
    61     P: pointer (void*)
     63    P: pointer (char*)
    6264    R: Register
    6365    S: size_t
     
    6769    Z: int32_t
    6870*/
     71typedef CallFrame* JIT_OPERATION (*F_JITOperation_EJJZ)(ExecState*, EncodedJSValue, EncodedJSValue, int32_t);
    6972typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_E)(ExecState*);
    7073typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EA)(ExecState*, JSArray*);
    7174typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EAZ)(ExecState*, JSArray*, int32_t);
     75typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EAapJ)(ExecState*, ArrayAllocationProfile*, EncodedJSValue);
     76typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EAapJcpZ)(ExecState*, ArrayAllocationProfile*, const JSValue*, int32_t);
    7277typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EC)(ExecState*, JSCell*);
    7378typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_ECC)(ExecState*, JSCell*, JSCell*);
     
    7984typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJA)(ExecState*, EncodedJSValue, JSArray*);
    8085typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJI)(ExecState*, EncodedJSValue, StringImpl*);
     86typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJIdc)(ExecState*, EncodedJSValue, const Identifier*);
    8187typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJJ)(ExecState*, EncodedJSValue, EncodedJSValue);
    8288typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJssZ)(ExecState*, JSString*, int32_t);
    8389typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EJP)(ExecState*, EncodedJSValue, void*);
    8490typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EP)(ExecState*, void*);
    85 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EAapJ)(ExecState*, ArrayAllocationProfile*, EncodedJSValue);
    86 typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EAapJcpZ)(ExecState*, ArrayAllocationProfile*, const JSValue*, int32_t);
    8791typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EPP)(ExecState*, void*, void*);
    8892typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EPS)(ExecState*, void*, size_t);
     
    100104typedef JSCell* JIT_OPERATION (*C_JITOperation_EJssJss)(ExecState*, JSString*, JSString*);
    101105typedef JSCell* JIT_OPERATION (*C_JITOperation_EJssJssJss)(ExecState*, JSString*, JSString*, JSString*);
     106typedef JSCell* JIT_OPERATION (*C_JITOperation_EO)(ExecState*, JSObject*);
    102107typedef JSCell* JIT_OPERATION (*C_JITOperation_EOZ)(ExecState*, JSObject*, int32_t);
    103108typedef JSCell* JIT_OPERATION (*C_JITOperation_ESt)(ExecState*, Structure*);
     
    237242EncodedJSValue JIT_OPERATION operationNewRegexp(ExecState*, void*) WTF_INTERNAL;
    238243
    239 }
     244EncodedJSValue JIT_OPERATION operationCheckHasInstance(ExecState*, EncodedJSValue, EncodedJSValue baseVal) WTF_INTERNAL;
     245JSCell* JIT_OPERATION operationCreateActivation(ExecState*, int32_t offset) WTF_INTERNAL;
     246JSCell* JIT_OPERATION operationCreateArguments(ExecState*) WTF_INTERNAL;
     247EncodedJSValue JIT_OPERATION operationDeleteById(ExecState*, EncodedJSValue base, const Identifier*) WTF_INTERNAL;
     248JSCell* JIT_OPERATION operationGetPNames(ExecState*, JSObject*) WTF_INTERNAL;
     249EncodedJSValue JIT_OPERATION operationInstanceOf(ExecState*, EncodedJSValue, EncodedJSValue proto) WTF_INTERNAL;
     250CallFrame* JIT_OPERATION operationLoadVarargs(ExecState*, EncodedJSValue thisValue, EncodedJSValue arguments, int32_t firstFreeRegister) WTF_INTERNAL;
     251EncodedJSValue JIT_OPERATION operationToObject(ExecState*, EncodedJSValue) WTF_INTERNAL;
     252
     253} // extern "C"
    240254
    241255} // namespace JSC
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp

    r156184 r157404  
    509509void JIT::emit_op_del_by_id(Instruction* currentInstruction)
    510510{
    511     JITStubCall stubCall(this, cti_op_del_by_id);
    512     stubCall.addArgument(currentInstruction[2].u.operand, regT2);
    513     stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(currentInstruction[3].u.operand)));
    514     stubCall.call(currentInstruction[1].u.operand);
     511    int dst = currentInstruction[1].u.operand;
     512    int base = currentInstruction[2].u.operand;
     513    int property = currentInstruction[3].u.operand;
     514    emitGetVirtualRegister(base, regT0);
     515    callOperation(operationDeleteById, dst, regT0, &m_codeBlock->identifier(property));
    515516}
    516517
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp

    r156511 r157404  
    8686    int base = currentInstruction[2].u.operand;
    8787    int property = currentInstruction[3].u.operand;
    88    
    89     JITStubCall stubCall(this, cti_op_del_by_id);
    90     stubCall.addArgument(base);
    91     stubCall.addArgument(TrustedImmPtr(&m_codeBlock->identifier(property)));
    92     stubCall.call(dst);
     88    emitLoad(base, regT1, regT0);
     89    callOperation(operationDeleteById, dst, regT1, regT0, &m_codeBlock->identifier(property));
    9390}
    9491
  • trunk/Source/JavaScriptCore/jit/JITStubs.cpp

    r157313 r157404  
    842842}
    843843
    844 DEFINE_STUB_FUNCTION(EncodedJSValue, op_check_has_instance)
    845 {
    846     STUB_INIT_STACK_FRAME(stackFrame);
    847 
    848     CallFrame* callFrame = stackFrame.callFrame;
    849     JSValue value = stackFrame.args[0].jsValue();
    850     JSValue baseVal = stackFrame.args[1].jsValue();
    851 
    852     if (baseVal.isObject()) {
    853         JSObject* baseObject = asObject(baseVal);
    854         ASSERT(!baseObject->structure()->typeInfo().implementsDefaultHasInstance());
    855         if (baseObject->structure()->typeInfo().implementsHasInstance()) {
    856             bool result = baseObject->methodTable()->customHasInstance(baseObject, callFrame, value);
    857             CHECK_FOR_EXCEPTION_AT_END();
    858             return JSValue::encode(jsBoolean(result));
    859         }
    860     }
    861 
    862     stackFrame.vm->throwException(callFrame, createInvalidParameterError(callFrame, "instanceof", baseVal));
    863     VM_THROW_EXCEPTION_AT_END();
    864     return JSValue::encode(JSValue());
    865 }
    866 
    867844#if ENABLE(DFG_JIT)
    868845DEFINE_STUB_FUNCTION(void, optimize)
     
    11011078#endif // ENABLE(DFG_JIT)
    11021079
    1103 DEFINE_STUB_FUNCTION(EncodedJSValue, op_instanceof)
    1104 {
    1105     STUB_INIT_STACK_FRAME(stackFrame);
    1106 
    1107     CallFrame* callFrame = stackFrame.callFrame;
    1108     JSValue value = stackFrame.args[0].jsValue();
    1109     JSValue proto = stackFrame.args[1].jsValue();
    1110    
    1111     ASSERT(!value.isObject() || !proto.isObject());
    1112 
    1113     bool result = JSObject::defaultHasInstance(callFrame, value, proto);
    1114     CHECK_FOR_EXCEPTION_AT_END();
    1115     return JSValue::encode(jsBoolean(result));
    1116 }
    1117 
    1118 DEFINE_STUB_FUNCTION(EncodedJSValue, op_del_by_id)
    1119 {
    1120     STUB_INIT_STACK_FRAME(stackFrame);
    1121 
    1122     CallFrame* callFrame = stackFrame.callFrame;
    1123    
    1124     JSObject* baseObj = stackFrame.args[0].jsValue().toObject(callFrame);
    1125 
    1126     bool couldDelete = baseObj->methodTable()->deleteProperty(baseObj, callFrame, stackFrame.args[1].identifier());
    1127     JSValue result = jsBoolean(couldDelete);
    1128     if (!couldDelete && callFrame->codeBlock()->isStrictMode())
    1129         stackFrame.vm->throwException(stackFrame.callFrame, createTypeError(stackFrame.callFrame, "Unable to delete property."));
    1130 
    1131     CHECK_FOR_EXCEPTION_AT_END();
    1132     return JSValue::encode(result);
    1133 }
    1134 
    1135 DEFINE_STUB_FUNCTION(JSObject*, op_push_activation)
    1136 {
    1137     STUB_INIT_STACK_FRAME(stackFrame);
    1138 
    1139     JSActivation* activation = JSActivation::create(stackFrame.callFrame->vm(), stackFrame.callFrame, stackFrame.callFrame->codeBlock());
    1140     stackFrame.callFrame->setScope(activation);
    1141     return activation;
    1142 }
    1143 
    1144 DEFINE_STUB_FUNCTION(EncodedJSValue, op_create_arguments)
    1145 {
    1146     STUB_INIT_STACK_FRAME(stackFrame);
    1147 
    1148     Arguments* arguments = Arguments::create(*stackFrame.vm, stackFrame.callFrame);
    1149     return JSValue::encode(JSValue(arguments));
    1150 }
    1151 
    11521080DEFINE_STUB_FUNCTION(void, op_tear_off_activation)
    11531081{
     
    13931321}
    13941322
    1395 DEFINE_STUB_FUNCTION(void*, op_load_varargs)
    1396 {
    1397     STUB_INIT_STACK_FRAME(stackFrame);
    1398 
    1399     CallFrame* callFrame = stackFrame.callFrame;
    1400     JSStack* stack = stackFrame.stack;
    1401     JSValue thisValue = stackFrame.args[0].jsValue();
    1402     JSValue arguments = stackFrame.args[1].jsValue();
    1403     int firstFreeRegister = stackFrame.args[2].int32();
    1404 
    1405     CallFrame* newCallFrame = loadVarargs(callFrame, stack, thisValue, arguments, firstFreeRegister);
    1406     if (!newCallFrame)
    1407         VM_THROW_EXCEPTION();
    1408     return newCallFrame;
    1409 }
    1410 
    14111323DEFINE_STUB_FUNCTION(void*, op_throw)
    14121324{
     
    14161328    STUB_SET_RETURN_ADDRESS(handler.catchRoutine);
    14171329    return handler.callFrame;
    1418 }
    1419 
    1420 DEFINE_STUB_FUNCTION(JSPropertyNameIterator*, op_get_pnames)
    1421 {
    1422     STUB_INIT_STACK_FRAME(stackFrame);
    1423 
    1424     CallFrame* callFrame = stackFrame.callFrame;
    1425     JSObject* o = stackFrame.args[0].jsObject();
    1426     Structure* structure = o->structure();
    1427     JSPropertyNameIterator* jsPropertyNameIterator = structure->enumerationCache();
    1428     if (!jsPropertyNameIterator || jsPropertyNameIterator->cachedPrototypeChain() != structure->prototypeChain(callFrame))
    1429         jsPropertyNameIterator = JSPropertyNameIterator::create(callFrame, o);
    1430     return jsPropertyNameIterator;
    14311330}
    14321331
     
    16101509}
    16111510#endif
    1612 
    1613 DEFINE_STUB_FUNCTION(EncodedJSValue, to_object)
    1614 {
    1615     STUB_INIT_STACK_FRAME(stackFrame);
    1616 
    1617     CallFrame* callFrame = stackFrame.callFrame;
    1618     return JSValue::encode(stackFrame.args[0].jsValue().toObject(callFrame));
    1619 }
    16201511
    16211512DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_scope)
  • trunk/Source/JavaScriptCore/jit/JITStubs.h

    r157313 r157404  
    331331
    332332extern "C" {
    333 EncodedJSValue JIT_STUB cti_op_check_has_instance(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    334 EncodedJSValue JIT_STUB cti_op_create_arguments(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    335 EncodedJSValue JIT_STUB cti_op_del_by_id(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    336333EncodedJSValue JIT_STUB cti_op_get_by_id(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    337334EncodedJSValue JIT_STUB cti_op_get_by_id_array_fail(STUB_ARGS_DECLARATION) WTF_INTERNAL;
     
    347344EncodedJSValue JIT_STUB cti_op_get_by_val_generic(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    348345EncodedJSValue JIT_STUB cti_op_get_by_val_string(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    349 EncodedJSValue JIT_STUB cti_op_instanceof(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    350 EncodedJSValue JIT_STUB cti_to_object(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    351 JSObject* JIT_STUB cti_op_push_activation(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    352346void JIT_STUB cti_op_push_name_scope(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    353347void JIT_STUB cti_op_push_with_scope(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    354348JSObject* JIT_STUB cti_op_put_by_id_transition_realloc(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    355 JSPropertyNameIterator* JIT_STUB cti_op_get_pnames(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    356 void* JIT_STUB cti_op_load_varargs(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    357349void JIT_STUB cti_handle_watchdog_timer(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    358350void JIT_STUB cti_op_debug(STUB_ARGS_DECLARATION) WTF_INTERNAL;
Note: See TracChangeset for help on using the changeset viewer.