Changeset 157439 in webkit


Ignore:
Timestamp:
Oct 14, 2013 8:03:45 PM (11 years ago)
Author:
mark.lam@apple.com
Message:

Transition *switch* and *scope* JITStubs to JIT operations.
https://bugs.webkit.org/show_bug.cgi?id=122757.

Reviewed by Geoffrey Garen.

Transitioning:

cti_op_switch_char
cti_op_switch_imm
cti_op_switch_string
cti_op_resolve_scope
cti_op_get_from_scope
cti_op_put_to_scope

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

(JSC::JIT::callOperation):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_switch_imm):
(JSC::JIT::emit_op_switch_char):
(JSC::JIT::emit_op_switch_string):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_switch_imm):
(JSC::JIT::emit_op_switch_char):
(JSC::JIT::emit_op_switch_string):

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

(JSC::JIT::emitSlow_op_resolve_scope):
(JSC::JIT::emitSlow_op_get_from_scope):
(JSC::JIT::emitSlow_op_put_to_scope):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::emitSlow_op_resolve_scope):
(JSC::JIT::emitSlow_op_get_from_scope):
(JSC::JIT::emitSlow_op_put_to_scope):

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

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r157433 r157439  
     12013-10-14  Mark Lam  <mark.lam@apple.com>
     2
     3        Transition *switch* and *scope* JITStubs to JIT operations.
     4        https://bugs.webkit.org/show_bug.cgi?id=122757.
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Transitioning:
     9            cti_op_switch_char
     10            cti_op_switch_imm
     11            cti_op_switch_string
     12            cti_op_resolve_scope
     13            cti_op_get_from_scope
     14            cti_op_put_to_scope
     15
     16        * jit/JIT.h:
     17        * jit/JITInlines.h:
     18        (JSC::JIT::callOperation):
     19        * jit/JITOpcodes.cpp:
     20        (JSC::JIT::emit_op_switch_imm):
     21        (JSC::JIT::emit_op_switch_char):
     22        (JSC::JIT::emit_op_switch_string):
     23        * jit/JITOpcodes32_64.cpp:
     24        (JSC::JIT::emit_op_switch_imm):
     25        (JSC::JIT::emit_op_switch_char):
     26        (JSC::JIT::emit_op_switch_string):
     27        * jit/JITOperations.cpp:
     28        * jit/JITOperations.h:
     29        * jit/JITPropertyAccess.cpp:
     30        (JSC::JIT::emitSlow_op_resolve_scope):
     31        (JSC::JIT::emitSlow_op_get_from_scope):
     32        (JSC::JIT::emitSlow_op_put_to_scope):
     33        * jit/JITPropertyAccess32_64.cpp:
     34        (JSC::JIT::emitSlow_op_resolve_scope):
     35        (JSC::JIT::emitSlow_op_get_from_scope):
     36        (JSC::JIT::emitSlow_op_put_to_scope):
     37        * jit/JITStubs.cpp:
     38        * jit/JITStubs.h:
     39
    1402013-10-14  Filip Pizlo  <fpizlo@apple.com>
    241
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r157411 r157439  
    868868        MacroAssembler::Call callOperation(J_JITOperation_EJJ, int, GPRReg, GPRReg);
    869869        MacroAssembler::Call callOperation(J_JITOperation_EP, int, void*);
     870        MacroAssembler::Call callOperation(J_JITOperation_EPc, int, Instruction*);
     871        MacroAssembler::Call callOperation(J_JITOperation_EZ, int, int32_t);
     872        MacroAssembler::Call callOperation(P_JITOperation_EJS, GPRReg, size_t);
    870873        MacroAssembler::Call callOperation(S_JITOperation_ECC, RegisterID, RegisterID);
    871874        MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID);
     
    877880        MacroAssembler::Call callOperation(V_JITOperation_EJJI, RegisterID, RegisterID, RegisterID, RegisterID, StringImpl*);
    878881#endif
     882        MacroAssembler::Call callOperation(V_JITOperation_EPc, Instruction*);
    879883        MacroAssembler::Call callOperationWithCallFrameRollbackOnException(J_JITOperation_E);
    880884        MacroAssembler::Call callOperationWithCallFrameRollbackOnException(V_JITOperation_ECb, CodeBlock*);
     
    886890        MacroAssembler::Call callOperation(J_JITOperation_EJIdc, int, GPRReg, GPRReg, const Identifier*);
    887891        MacroAssembler::Call callOperation(J_JITOperation_EJJ, int, GPRReg, GPRReg, GPRReg, GPRReg);
     892        MacroAssembler::Call callOperation(P_JITOperation_EJS, GPRReg, GPRReg, size_t);
    888893        MacroAssembler::Call callOperation(S_JITOperation_EJ, RegisterID, RegisterID);
    889894        MacroAssembler::Call callOperation(S_JITOperation_EJJ, RegisterID, RegisterID, RegisterID, RegisterID);
  • trunk/Source/JavaScriptCore/jit/JITInlines.h

    r157427 r157439  
    325325}
    326326
     327ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EPc operation, int dst, Instruction* bytecodePC)
     328{
     329    setupArgumentsWithExecState(TrustedImmPtr(bytecodePC));
     330    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
     331}
     332
     333ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_EZ operation, int dst, int32_t arg)
     334{
     335    setupArgumentsWithExecState(TrustedImm32(arg));
     336    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
     337}
     338
     339ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(P_JITOperation_EJS operation, GPRReg arg1, size_t arg2)
     340{
     341    setupArgumentsWithExecState(arg1, TrustedImmPtr(arg2));
     342    return appendCallWithExceptionCheck(operation);
     343}
     344
    327345ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(S_JITOperation_ECC operation, RegisterID regOp1, RegisterID regOp2)
    328346{
     
    346364{
    347365    setupArgumentsWithExecState(regOp1, regOp2);
     366    return appendCallWithExceptionCheck(operation);
     367}
     368
     369ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(V_JITOperation_EPc operation, Instruction* bytecodePC)
     370{
     371    setupArgumentsWithExecState(TrustedImmPtr(bytecodePC));
    348372    return appendCallWithExceptionCheck(operation);
    349373}
     
    413437    setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, SH4_32BIT_DUMMY_ARG arg2Payload, arg2Tag);
    414438    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
     439}
     440
     441ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(P_JITOperation_EJS operation, GPRReg arg1Tag, GPRReg arg1Payload, size_t arg2)
     442{
     443    setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag, TrustedImmPtr(arg2));
     444    return appendCallWithExceptionCheck(operation);
    415445}
    416446
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r157404 r157439  
    683683void JIT::emit_op_switch_imm(Instruction* currentInstruction)
    684684{
    685     unsigned tableIndex = currentInstruction[1].u.operand;
     685    size_t tableIndex = currentInstruction[1].u.operand;
    686686    unsigned defaultOffset = currentInstruction[2].u.operand;
    687687    unsigned scrutinee = currentInstruction[3].u.operand;
     
    692692    jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size());
    693693
    694     JITStubCall stubCall(this, cti_op_switch_imm);
    695     stubCall.addArgument(scrutinee, regT2);
    696     stubCall.addArgument(TrustedImm32(tableIndex));
    697     stubCall.call();
    698     jump(regT0);
     694    emitGetVirtualRegister(scrutinee, regT0);
     695    callOperation(operationSwitchImmWithUnknownKeyType, regT0, tableIndex);
     696    jump(returnValueRegister);
    699697}
    700698
    701699void JIT::emit_op_switch_char(Instruction* currentInstruction)
    702700{
    703     unsigned tableIndex = currentInstruction[1].u.operand;
     701    size_t tableIndex = currentInstruction[1].u.operand;
    704702    unsigned defaultOffset = currentInstruction[2].u.operand;
    705703    unsigned scrutinee = currentInstruction[3].u.operand;
     
    710708    jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size());
    711709
    712     JITStubCall stubCall(this, cti_op_switch_char);
    713     stubCall.addArgument(scrutinee, regT2);
    714     stubCall.addArgument(TrustedImm32(tableIndex));
    715     stubCall.call();
    716     jump(regT0);
     710    emitGetVirtualRegister(scrutinee, regT0);
     711    callOperation(operationSwitchCharWithUnknownKeyType, regT0, tableIndex);
     712    jump(returnValueRegister);
    717713}
    718714
    719715void JIT::emit_op_switch_string(Instruction* currentInstruction)
    720716{
    721     unsigned tableIndex = currentInstruction[1].u.operand;
     717    size_t tableIndex = currentInstruction[1].u.operand;
    722718    unsigned defaultOffset = currentInstruction[2].u.operand;
    723719    unsigned scrutinee = currentInstruction[3].u.operand;
     
    727723    m_switches.append(SwitchRecord(jumpTable, m_bytecodeOffset, defaultOffset));
    728724
    729     JITStubCall stubCall(this, cti_op_switch_string);
    730     stubCall.addArgument(scrutinee, regT2);
    731     stubCall.addArgument(TrustedImm32(tableIndex));
    732     stubCall.call();
    733     jump(regT0);
     725    emitGetVirtualRegister(scrutinee, regT0);
     726    callOperation(operationSwitchStringWithUnknownKeyType, regT0, tableIndex);
     727    jump(returnValueRegister);
    734728}
    735729
  • trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp

    r157404 r157439  
    995995void JIT::emit_op_switch_imm(Instruction* currentInstruction)
    996996{
    997     unsigned tableIndex = currentInstruction[1].u.operand;
     997    size_t tableIndex = currentInstruction[1].u.operand;
    998998    unsigned defaultOffset = currentInstruction[2].u.operand;
    999999    unsigned scrutinee = currentInstruction[3].u.operand;
     
    10041004    jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size());
    10051005
    1006     JITStubCall stubCall(this, cti_op_switch_imm);
    1007     stubCall.addArgument(scrutinee);
    1008     stubCall.addArgument(TrustedImm32(tableIndex));
    1009     stubCall.call();
    1010     jump(regT0);
     1006    emitLoad(scrutinee, regT1, regT0);
     1007    callOperation(operationSwitchImmWithUnknownKeyType, regT1, regT0, tableIndex);
     1008    jump(returnValueRegister);
    10111009}
    10121010
    10131011void JIT::emit_op_switch_char(Instruction* currentInstruction)
    10141012{
    1015     unsigned tableIndex = currentInstruction[1].u.operand;
     1013    size_t tableIndex = currentInstruction[1].u.operand;
    10161014    unsigned defaultOffset = currentInstruction[2].u.operand;
    10171015    unsigned scrutinee = currentInstruction[3].u.operand;
     
    10221020    jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size());
    10231021
    1024     JITStubCall stubCall(this, cti_op_switch_char);
    1025     stubCall.addArgument(scrutinee);
    1026     stubCall.addArgument(TrustedImm32(tableIndex));
    1027     stubCall.call();
    1028     jump(regT0);
     1022    emitLoad(scrutinee, regT1, regT0);
     1023    callOperation(operationSwitchCharWithUnknownKeyType, regT1, regT0, tableIndex);
     1024    jump(returnValueRegister);
    10291025}
    10301026
    10311027void JIT::emit_op_switch_string(Instruction* currentInstruction)
    10321028{
    1033     unsigned tableIndex = currentInstruction[1].u.operand;
     1029    size_t tableIndex = currentInstruction[1].u.operand;
    10341030    unsigned defaultOffset = currentInstruction[2].u.operand;
    10351031    unsigned scrutinee = currentInstruction[3].u.operand;
     
    10391035    m_switches.append(SwitchRecord(jumpTable, m_bytecodeOffset, defaultOffset));
    10401036
    1041     JITStubCall stubCall(this, cti_op_switch_string);
    1042     stubCall.addArgument(scrutinee);
    1043     stubCall.addArgument(TrustedImm32(tableIndex));
    1044     stubCall.call();
    1045     jump(regT0);
     1037    emitLoad(scrutinee, regT1, regT0);
     1038    callOperation(operationSwitchStringWithUnknownKeyType, regT1, regT0, tableIndex);
     1039    jump(returnValueRegister);
    10461040}
    10471041
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r157411 r157439  
    894894}
    895895
     896char* JIT_OPERATION operationSwitchCharWithUnknownKeyType(ExecState* exec, EncodedJSValue encodedKey, size_t tableIndex)
     897{
     898    VM& vm = exec->vm();
     899    NativeCallFrameTracer tracer(&vm, exec);
     900    JSValue key = JSValue::decode(encodedKey);
     901    CodeBlock* codeBlock = exec->codeBlock();
     902
     903    SimpleJumpTable& jumpTable = codeBlock->switchJumpTable(tableIndex);
     904    void* result = jumpTable.ctiDefault.executableAddress();
     905
     906    if (key.isString()) {
     907        StringImpl* value = asString(key)->value(exec).impl();
     908        if (value->length() == 1)
     909            result = jumpTable.ctiForValue((*value)[0]).executableAddress();
     910    }
     911
     912    return reinterpret_cast<char*>(result);
     913}
     914
     915char* JIT_OPERATION operationSwitchImmWithUnknownKeyType(ExecState* exec, EncodedJSValue encodedKey, size_t tableIndex)
     916{
     917    VM& vm = exec->vm();
     918    NativeCallFrameTracer tracer(&vm, exec);
     919    JSValue key = JSValue::decode(encodedKey);
     920    CodeBlock* codeBlock = exec->codeBlock();
     921
     922    SimpleJumpTable& jumpTable = codeBlock->switchJumpTable(tableIndex);
     923    void* result;
     924    if (key.isInt32())
     925        result = jumpTable.ctiForValue(key.asInt32()).executableAddress();
     926    else if (key.isDouble() && key.asDouble() == static_cast<int32_t>(key.asDouble()))
     927        result = jumpTable.ctiForValue(static_cast<int32_t>(key.asDouble())).executableAddress();
     928    else
     929        result = jumpTable.ctiDefault.executableAddress();
     930    return reinterpret_cast<char*>(result);
     931}
     932
     933char* JIT_OPERATION operationSwitchStringWithUnknownKeyType(ExecState* exec, EncodedJSValue encodedKey, size_t tableIndex)
     934{
     935    VM& vm = exec->vm();
     936    NativeCallFrameTracer tracer(&vm, exec);
     937    JSValue key = JSValue::decode(encodedKey);
     938    CodeBlock* codeBlock = exec->codeBlock();
     939
     940    void* result;
     941    StringJumpTable& jumpTable = codeBlock->stringSwitchJumpTable(tableIndex);
     942
     943    if (key.isString()) {
     944        StringImpl* value = asString(key)->value(exec).impl();
     945        result = jumpTable.ctiForValue(value).executableAddress();
     946    } else
     947        result = jumpTable.ctiDefault.executableAddress();
     948
     949    return reinterpret_cast<char*>(result);
     950}
     951
     952EncodedJSValue JIT_OPERATION operationResolveScope(ExecState* exec, int32_t identifierIndex)
     953{
     954    VM& vm = exec->vm();
     955    NativeCallFrameTracer tracer(&vm, exec);
     956    const Identifier& ident = exec->codeBlock()->identifier(identifierIndex);
     957    return JSValue::encode(JSScope::resolve(exec, exec->scope(), ident));
     958}
     959
     960EncodedJSValue JIT_OPERATION operationGetFromScope(ExecState* exec, Instruction* bytecodePC)
     961{
     962    VM& vm = exec->vm();
     963    NativeCallFrameTracer tracer(&vm, exec);
     964    CodeBlock* codeBlock = exec->codeBlock();
     965    Instruction* pc = bytecodePC;
     966
     967    const Identifier& ident = codeBlock->identifier(pc[3].u.operand);
     968    JSObject* scope = jsCast<JSObject*>(exec->uncheckedR(pc[2].u.operand).jsValue());
     969    ResolveModeAndType modeAndType(pc[4].u.operand);
     970
     971    PropertySlot slot(scope);
     972    if (!scope->getPropertySlot(exec, ident, slot)) {
     973        if (modeAndType.mode() == ThrowIfNotFound)
     974            vm.throwException(exec, createUndefinedVariableError(exec, ident));
     975        return JSValue::encode(jsUndefined());
     976    }
     977
     978    // Covers implicit globals. Since they don't exist until they first execute, we didn't know how to cache them at compile time.
     979    if (slot.isCacheableValue() && slot.slotBase() == scope && scope->structure()->propertyAccessesAreCacheable()) {
     980        if (modeAndType.type() == GlobalProperty || modeAndType.type() == GlobalPropertyWithVarInjectionChecks) {
     981            ConcurrentJITLocker locker(codeBlock->m_lock);
     982            pc[5].u.structure.set(exec->vm(), codeBlock->ownerExecutable(), scope->structure());
     983            pc[6].u.operand = slot.cachedOffset();
     984        }
     985    }
     986
     987    return JSValue::encode(slot.getValue(exec, ident));
     988}
     989
     990void JIT_OPERATION operationPutToScope(ExecState* exec, Instruction* bytecodePC)
     991{
     992    VM& vm = exec->vm();
     993    NativeCallFrameTracer tracer(&vm, exec);
     994    Instruction* pc = bytecodePC;
     995
     996    CodeBlock* codeBlock = exec->codeBlock();
     997    const Identifier& ident = codeBlock->identifier(pc[2].u.operand);
     998    JSObject* scope = jsCast<JSObject*>(exec->uncheckedR(pc[1].u.operand).jsValue());
     999    JSValue value = exec->r(pc[3].u.operand).jsValue();
     1000    ResolveModeAndType modeAndType = ResolveModeAndType(pc[4].u.operand);
     1001
     1002    if (modeAndType.mode() == ThrowIfNotFound && !scope->hasProperty(exec, ident)) {
     1003        exec->vm().throwException(exec, createUndefinedVariableError(exec, ident));
     1004        return;
     1005    }
     1006
     1007    PutPropertySlot slot(codeBlock->isStrictMode());
     1008    scope->methodTable()->put(scope, exec, ident, value, slot);
     1009   
     1010    if (exec->vm().exception())
     1011        return;
     1012
     1013    // Covers implicit globals. Since they don't exist until they first execute, we didn't know how to cache them at compile time.
     1014    if (modeAndType.type() == GlobalProperty || modeAndType.type() == GlobalPropertyWithVarInjectionChecks) {
     1015        if (slot.isCacheable() && slot.base() == scope && scope->structure()->propertyAccessesAreCacheable()) {
     1016            ConcurrentJITLocker locker(codeBlock->m_lock);
     1017            pc[5].u.structure.set(exec->vm(), codeBlock->ownerExecutable(), scope->structure());
     1018            pc[6].u.operand = slot.cachedOffset();
     1019        }
     1020    }
     1021}
     1022
    8961023JITHandlerEncoded JIT_OPERATION lookupExceptionHandler(ExecState* exec)
    8971024{
  • trunk/Source/JavaScriptCore/jit/JITOperations.h

    r157411 r157439  
    6262    O: JSObject*
    6363    P: pointer (char*)
     64    Pc: Instruction* i.e. bytecode PC
    6465    R: Register
    6566    S: size_t
     
    9192typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EPP)(ExecState*, void*, void*);
    9293typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EPS)(ExecState*, void*, size_t);
     94typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EPc)(ExecState*, Instruction*);
    9395typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_ESS)(ExecState*, size_t, size_t);
    9496typedef EncodedJSValue JIT_OPERATION (*J_JITOperation_EZ)(ExecState*, int32_t);
     
    131133typedef void JIT_OPERATION (*V_JITOperation_EJJJ)(ExecState*, EncodedJSValue, EncodedJSValue, EncodedJSValue);
    132134typedef void JIT_OPERATION (*V_JITOperation_EJPP)(ExecState*, EncodedJSValue, void*, void*);
     135typedef void JIT_OPERATION (*V_JITOperation_EPc)(ExecState*, Instruction*);
    133136typedef void JIT_OPERATION (*V_JITOperation_EPZJ)(ExecState*, void*, int32_t, EncodedJSValue);
    134137typedef void JIT_OPERATION (*V_JITOperation_W)(WatchpointSet*);
     
    251254EncodedJSValue JIT_OPERATION operationToObject(ExecState*, EncodedJSValue) WTF_INTERNAL;
    252255
     256char* JIT_OPERATION operationSwitchCharWithUnknownKeyType(ExecState*, EncodedJSValue key, size_t tableIndex) WTF_INTERNAL;
     257char* JIT_OPERATION operationSwitchImmWithUnknownKeyType(ExecState*, EncodedJSValue key, size_t tableIndex) WTF_INTERNAL;
     258char* JIT_OPERATION operationSwitchStringWithUnknownKeyType(ExecState*, EncodedJSValue key, size_t tableIndex) WTF_INTERNAL;
     259EncodedJSValue JIT_OPERATION operationResolveScope(ExecState*, int32_t identifierIndex) WTF_INTERNAL;
     260EncodedJSValue JIT_OPERATION operationGetFromScope(ExecState*, Instruction* bytecodePC) WTF_INTERNAL;
     261void JIT_OPERATION operationPutToScope(ExecState*, Instruction* bytecodePC) WTF_INTERNAL;
     262
    253263} // extern "C"
    254264
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp

    r157411 r157439  
    11771177
    11781178    linkSlowCase(iter);
    1179 
    1180     JITStubCall stubCall(this, cti_op_resolve_scope);
    1181     stubCall.addArgument(TrustedImmPtr(currentInstruction));
    1182     stubCall.call(dst);
     1179    int32_t indentifierIndex = currentInstruction[2].u.operand;
     1180    callOperation(operationResolveScope, dst, indentifierIndex);
    11831181}
    11841182
     
    12501248
    12511249    linkSlowCase(iter);
    1252 
    1253     JITStubCall stubCall(this, cti_op_get_from_scope);
    1254     stubCall.addArgument(TrustedImmPtr(currentInstruction));
    1255     stubCall.call(dst);
     1250    callOperation(operationGetFromScope, dst, currentInstruction);
    12561251    emitValueProfilingSite(regT4);
    12571252}
     
    13181313
    13191314    linkSlowCase(iter);
    1320 
    1321     JITStubCall stubCall(this, cti_op_put_to_scope);
    1322     stubCall.addArgument(TrustedImmPtr(currentInstruction));
    1323     stubCall.call();
     1315    callOperation(operationPutToScope, currentInstruction);
    13241316}
    13251317
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp

    r157427 r157439  
    12011201
    12021202    linkSlowCase(iter);
    1203 
    1204     JITStubCall stubCall(this, cti_op_resolve_scope);
    1205     stubCall.addArgument(TrustedImmPtr(currentInstruction));
    1206     stubCall.call(dst);
     1203    int32_t indentifierIndex = currentInstruction[2].u.operand;
     1204    callOperation(operationResolveScope, dst, indentifierIndex);
    12071205}
    12081206
     
    12771275
    12781276    linkSlowCase(iter);
    1279 
    1280     JITStubCall stubCall(this, cti_op_get_from_scope);
    1281     stubCall.addArgument(TrustedImmPtr(currentInstruction));
    1282     stubCall.call(dst);
     1277    callOperation(operationGetFromScope, dst, currentInstruction);
    12831278    emitValueProfilingSite(regT4);
    12841279}
     
    13481343
    13491344    linkSlowCase(iter);
    1350 
    1351     JITStubCall stubCall(this, cti_op_put_to_scope);
    1352     stubCall.addArgument(TrustedImmPtr(currentInstruction));
    1353     stubCall.call();
     1345    callOperation(operationPutToScope, currentInstruction);
    13541346}
    13551347
  • trunk/Source/JavaScriptCore/jit/JITStubs.cpp

    r157424 r157439  
    11861186}
    11871187
    1188 DEFINE_STUB_FUNCTION(void*, op_switch_imm)
    1189 {
    1190     STUB_INIT_STACK_FRAME(stackFrame);
    1191 
    1192     JSValue scrutinee = stackFrame.args[0].jsValue();
    1193     unsigned tableIndex = stackFrame.args[1].int32();
    1194     CallFrame* callFrame = stackFrame.callFrame;
    1195     CodeBlock* codeBlock = callFrame->codeBlock();
    1196 
    1197     if (scrutinee.isInt32())
    1198         return codeBlock->switchJumpTable(tableIndex).ctiForValue(scrutinee.asInt32()).executableAddress();
    1199     if (scrutinee.isDouble() && scrutinee.asDouble() == static_cast<int32_t>(scrutinee.asDouble()))
    1200         return codeBlock->switchJumpTable(tableIndex).ctiForValue(static_cast<int32_t>(scrutinee.asDouble())).executableAddress();
    1201     return codeBlock->switchJumpTable(tableIndex).ctiDefault.executableAddress();
    1202 }
    1203 
    1204 DEFINE_STUB_FUNCTION(void*, op_switch_char)
    1205 {
    1206     STUB_INIT_STACK_FRAME(stackFrame);
    1207 
    1208     JSValue scrutinee = stackFrame.args[0].jsValue();
    1209     unsigned tableIndex = stackFrame.args[1].int32();
    1210     CallFrame* callFrame = stackFrame.callFrame;
    1211     CodeBlock* codeBlock = callFrame->codeBlock();
    1212 
    1213     void* result = codeBlock->switchJumpTable(tableIndex).ctiDefault.executableAddress();
    1214 
    1215     if (scrutinee.isString()) {
    1216         StringImpl* value = asString(scrutinee)->value(callFrame).impl();
    1217         if (value->length() == 1)
    1218             result = codeBlock->switchJumpTable(tableIndex).ctiForValue((*value)[0]).executableAddress();
    1219     }
    1220 
    1221     CHECK_FOR_EXCEPTION_AT_END();
    1222     return result;
    1223 }
    1224 
    1225 DEFINE_STUB_FUNCTION(void*, op_switch_string)
    1226 {
    1227     STUB_INIT_STACK_FRAME(stackFrame);
    1228 
    1229     JSValue scrutinee = stackFrame.args[0].jsValue();
    1230     unsigned tableIndex = stackFrame.args[1].int32();
    1231     CallFrame* callFrame = stackFrame.callFrame;
    1232     CodeBlock* codeBlock = callFrame->codeBlock();
    1233 
    1234     void* result = codeBlock->stringSwitchJumpTable(tableIndex).ctiDefault.executableAddress();
    1235 
    1236     if (scrutinee.isString()) {
    1237         StringImpl* value = asString(scrutinee)->value(callFrame).impl();
    1238         result = codeBlock->stringSwitchJumpTable(tableIndex).ctiForValue(value).executableAddress();
    1239     }
    1240 
    1241     CHECK_FOR_EXCEPTION_AT_END();
    1242     return result;
    1243 }
    1244 
    12451188DEFINE_STUB_FUNCTION(void, op_put_getter_setter)
    12461189{
     
    13281271#endif
    13291272
    1330 DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_scope)
    1331 {
    1332     STUB_INIT_STACK_FRAME(stackFrame);
    1333     ExecState* exec = stackFrame.callFrame;
    1334     Instruction* pc = stackFrame.args[0].pc();
    1335 
    1336     const Identifier& ident = exec->codeBlock()->identifier(pc[2].u.operand);
    1337     return JSValue::encode(JSScope::resolve(exec, exec->scope(), ident));
    1338 }
    1339 
    1340 DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_from_scope)
    1341 {
    1342     STUB_INIT_STACK_FRAME(stackFrame);
    1343     ExecState* exec = stackFrame.callFrame;
    1344     Instruction* pc = stackFrame.args[0].pc();
    1345 
    1346     const Identifier& ident = exec->codeBlock()->identifier(pc[3].u.operand);
    1347     JSObject* scope = jsCast<JSObject*>(exec->uncheckedR(pc[2].u.operand).jsValue());
    1348     ResolveModeAndType modeAndType(pc[4].u.operand);
    1349 
    1350     PropertySlot slot(scope);
    1351     if (!scope->getPropertySlot(exec, ident, slot)) {
    1352         if (modeAndType.mode() == ThrowIfNotFound) {
    1353             exec->vm().throwException(exec, createUndefinedVariableError(exec, ident));
    1354             VM_THROW_EXCEPTION();
    1355         }
    1356         return JSValue::encode(jsUndefined());
    1357     }
    1358 
    1359     // Covers implicit globals. Since they don't exist until they first execute, we didn't know how to cache them at compile time.
    1360     if (slot.isCacheableValue() && slot.slotBase() == scope && scope->structure()->propertyAccessesAreCacheable()) {
    1361         if (modeAndType.type() == GlobalProperty || modeAndType.type() == GlobalPropertyWithVarInjectionChecks) {
    1362             CodeBlock* codeBlock = exec->codeBlock();
    1363             ConcurrentJITLocker locker(codeBlock->m_lock);
    1364             pc[5].u.structure.set(exec->vm(), codeBlock->ownerExecutable(), scope->structure());
    1365             pc[6].u.operand = slot.cachedOffset();
    1366         }
    1367     }
    1368 
    1369     return JSValue::encode(slot.getValue(exec, ident));
    1370 }
    1371 
    1372 DEFINE_STUB_FUNCTION(void, op_put_to_scope)
    1373 {
    1374     STUB_INIT_STACK_FRAME(stackFrame);
    1375     ExecState* exec = stackFrame.callFrame;
    1376     Instruction* pc = stackFrame.args[0].pc();
    1377 
    1378     CodeBlock* codeBlock = exec->codeBlock();
    1379     const Identifier& ident = codeBlock->identifier(pc[2].u.operand);
    1380     JSObject* scope = jsCast<JSObject*>(exec->uncheckedR(pc[1].u.operand).jsValue());
    1381     JSValue value = exec->r(pc[3].u.operand).jsValue();
    1382     ResolveModeAndType modeAndType = ResolveModeAndType(pc[4].u.operand);
    1383 
    1384     if (modeAndType.mode() == ThrowIfNotFound && !scope->hasProperty(exec, ident)) {
    1385         exec->vm().throwException(exec, createUndefinedVariableError(exec, ident));
    1386         VM_THROW_EXCEPTION_AT_END();
    1387         return;
    1388     }
    1389 
    1390     PutPropertySlot slot(codeBlock->isStrictMode());
    1391     scope->methodTable()->put(scope, exec, ident, value, slot);
    1392    
    1393     if (exec->vm().exception()) {
    1394         VM_THROW_EXCEPTION_AT_END();
    1395         return;
    1396     }
    1397 
    1398     // Covers implicit globals. Since they don't exist until they first execute, we didn't know how to cache them at compile time.
    1399     if (modeAndType.type() == GlobalProperty || modeAndType.type() == GlobalPropertyWithVarInjectionChecks) {
    1400         if (slot.isCacheable() && slot.base() == scope && scope->structure()->propertyAccessesAreCacheable()) {
    1401             ConcurrentJITLocker locker(codeBlock->m_lock);
    1402             pc[5].u.structure.set(exec->vm(), codeBlock->ownerExecutable(), scope->structure());
    1403             pc[6].u.operand = slot.cachedOffset();
    1404         }
    1405     }
    1406 }
    1407 
    14081273} // namespace JSC
    14091274
  • trunk/Source/JavaScriptCore/jit/JITStubs.h

    r157411 r157439  
    361361void JIT_STUB cti_optimize(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    362362#endif
    363 void* JIT_STUB cti_op_switch_char(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    364 void* JIT_STUB cti_op_switch_imm(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    365 void* JIT_STUB cti_op_switch_string(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    366363void* JIT_STUB cti_op_throw(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    367364void* JIT_STUB cti_vm_throw(STUB_ARGS_DECLARATION) REFERENCED_FROM_ASM WTF_INTERNAL;
    368 
    369 EncodedJSValue JIT_STUB cti_op_resolve_scope(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    370 EncodedJSValue JIT_STUB cti_op_get_from_scope(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    371 void JIT_STUB cti_op_put_to_scope(STUB_ARGS_DECLARATION) WTF_INTERNAL;
    372365
    373366#if USE(JSVALUE32_64)
Note: See TracChangeset for help on using the changeset viewer.