Changeset 43409 in webkit for trunk/JavaScriptCore/jit/JIT.cpp


Ignore:
Timestamp:
May 8, 2009, 1:51:53 PM (16 years ago)
Author:
[email protected]
Message:

2009-05-08 Geoffrey Garen <[email protected]>

Reviewed by Gavin Barraclough.


More abstraction for JITStub calls from JITed code.


Added a JITStubCall class that automatically handles things like assigning
arguments to different stack slots and storing return values. Deployed
the class in about a billion places. A bunch more places remain to be
fixed up, but this is a good stopping point for now.

  • jit/JIT.cpp: (JSC::JIT::emitTimeoutCheck): (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile):
  • jit/JIT.h: (JSC::JIT::JSRInfo::JSRInfo): (JSC::JITStubCall::JITStubCall): (JSC::JITStubCall::addArgument): (JSC::JITStubCall::call): (JSC::JITStubCall::): (JSC::CallEvalJITStub::CallEvalJITStub):
  • jit/JITArithmetic.cpp: (JSC::JIT::compileFastArithSlow_op_lshift): (JSC::JIT::compileFastArithSlow_op_rshift): (JSC::JIT::compileFastArithSlow_op_jnless): (JSC::JIT::compileFastArithSlow_op_bitand): (JSC::JIT::compileFastArithSlow_op_mod): (JSC::JIT::compileFastArith_op_mod): (JSC::JIT::compileFastArithSlow_op_post_inc): (JSC::JIT::compileFastArithSlow_op_post_dec): (JSC::JIT::compileFastArithSlow_op_pre_inc): (JSC::JIT::compileFastArithSlow_op_pre_dec): (JSC::JIT::compileFastArith_op_add): (JSC::JIT::compileFastArith_op_mul): (JSC::JIT::compileFastArith_op_sub): (JSC::JIT::compileBinaryArithOpSlowCase): (JSC::JIT::compileFastArithSlow_op_add): (JSC::JIT::compileFastArithSlow_op_mul):
  • jit/JITCall.cpp: (JSC::JIT::compileOpCall): (JSC::):
  • jit/JITPropertyAccess.cpp: (JSC::JIT::compileGetByIdHotPath): (JSC::JIT::compilePutByIdHotPath): (JSC::JIT::compileGetByIdSlowCase): (JSC::JIT::compilePutByIdSlowCase):
  • jit/JITStubs.cpp: (JSC::JITStubs::cti_op_resolve_func): (JSC::JITStubs::cti_op_resolve_with_base):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jit/JIT.cpp

    r43401 r43409  
    9494{
    9595    Jump skipTimeout = branchSub32(NonZero, Imm32(1), timeoutCheckRegister);
    96     emitCTICall(JITStubs::cti_timeout_check);
    97     move(regT0, timeoutCheckRegister);
     96    JITStubCall(this, JITStubs::cti_timeout_check).call(timeoutCheckRegister);
    9897    skipTimeout.link(this);
    9998
     
    108107#define DEFINE_BINARY_OP(name) \
    109108    case name: { \
    110         emitPutJITStubArgFromVirtualRegister(currentInstruction[2].u.operand, 1, regT2); \
    111         emitPutJITStubArgFromVirtualRegister(currentInstruction[3].u.operand, 2, regT2); \
    112         emitCTICall(JITStubs::cti_##name); \
    113         emitPutVirtualRegister(currentInstruction[1].u.operand); \
     109        JITStubCall stubCall(this, JITStubs::cti_##name); \
     110        stubCall.addArgument(currentInstruction[2].u.operand, regT2); \
     111        stubCall.addArgument(currentInstruction[3].u.operand, regT2); \
     112        stubCall.call(currentInstruction[1].u.operand); \
    114113        NEXT_OPCODE(name); \
    115114    }
     
    117116#define DEFINE_UNARY_OP(name) \
    118117    case name: { \
    119         emitPutJITStubArgFromVirtualRegister(currentInstruction[2].u.operand, 1, regT2); \
    120         emitCTICall(JITStubs::cti_##name); \
    121         emitPutVirtualRegister(currentInstruction[1].u.operand); \
     118        JITStubCall stubCall(this, JITStubs::cti_##name); \
     119        stubCall.addArgument(currentInstruction[2].u.operand, regT2); \
     120        stubCall.call(currentInstruction[1].u.operand); \
    122121        NEXT_OPCODE(name); \
    123122    }
     
    191190        case op_end: {
    192191            if (m_codeBlock->needsFullScopeChain())
    193                 emitCTICall(JITStubs::cti_op_end);
     192                JITStubCall(this, JITStubs::cti_op_end).call();
    194193            ASSERT(returnValueRegister != callFrameRegister);
    195194            emitGetVirtualRegister(currentInstruction[1].u.operand, returnValueRegister);
     
    271270        }
    272271        case op_new_object: {
    273             emitCTICall(JITStubs::cti_op_new_object);
    274             emitPutVirtualRegister(currentInstruction[1].u.operand);
     272            JITStubCall(this, JITStubs::cti_op_new_object).call(currentInstruction[1].u.operand);
    275273            NEXT_OPCODE(op_new_object);
    276274        }
     
    335333        }
    336334        case op_del_by_id: {
    337             emitPutJITStubArgFromVirtualRegister(currentInstruction[2].u.operand, 1, regT2);
    338             Identifier* ident = &(m_codeBlock->identifier(currentInstruction[3].u.operand));
    339             emitPutJITStubArgConstant(ident, 2);
    340             emitCTICall(JITStubs::cti_op_del_by_id);
    341             emitPutVirtualRegister(currentInstruction[1].u.operand);
     335            JITStubCall stubCall(this, JITStubs::cti_op_del_by_id);
     336            stubCall.addArgument(currentInstruction[2].u.operand, regT2);
     337            stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[3].u.operand)));
     338            stubCall.call(currentInstruction[1].u.operand);
    342339            NEXT_OPCODE(op_del_by_id);
    343340        }
     
    347344        }
    348345        case op_new_func: {
    349             FuncDeclNode* func = m_codeBlock->function(currentInstruction[2].u.operand);
    350             emitPutJITStubArgConstant(func, 1);
    351             emitCTICall(JITStubs::cti_op_new_func);
    352             emitPutVirtualRegister(currentInstruction[1].u.operand);
     346            JITStubCall stubCall(this, JITStubs::cti_op_new_func);
     347            stubCall.addArgument(ImmPtr(m_codeBlock->function(currentInstruction[2].u.operand)));
     348            stubCall.call(currentInstruction[1].u.operand);
    353349            NEXT_OPCODE(op_new_func);
    354350        }
     
    362358        }
    363359        case op_load_varargs: {
    364             emitPutJITStubArgConstant(currentInstruction[2].u.operand, 1);
    365             emitCTICall(JITStubs::cti_op_load_varargs);
    366             emitPutVirtualRegister(currentInstruction[1].u.operand);
     360            JITStubCall stubCall(this, JITStubs::cti_op_load_varargs);
     361            stubCall.addArgument(Imm32(currentInstruction[2].u.operand));
     362            stubCall.call(currentInstruction[1].u.operand);
    367363            NEXT_OPCODE(op_load_varargs);
    368364        }
     
    414410        }
    415411        case op_tear_off_activation: {
    416             emitPutJITStubArgFromVirtualRegister(currentInstruction[1].u.operand, 1, regT2);
    417             emitCTICall(JITStubs::cti_op_tear_off_activation);
     412            JITStubCall stubCall(this, JITStubs::cti_op_tear_off_activation);
     413            stubCall.addArgument(currentInstruction[1].u.operand, regT2);
     414            stubCall.call();
    418415            NEXT_OPCODE(op_tear_off_activation);
    419416        }
    420417        case op_tear_off_arguments: {
    421             emitCTICall(JITStubs::cti_op_tear_off_arguments);
     418            JITStubCall(this, JITStubs::cti_op_tear_off_arguments).call();
    422419            NEXT_OPCODE(op_tear_off_arguments);
    423420        }
     
    425422            // We could JIT generate the deref, only calling out to C when the refcount hits zero.
    426423            if (m_codeBlock->needsFullScopeChain())
    427                 emitCTICall(JITStubs::cti_op_ret_scopeChain);
     424                JITStubCall(this, JITStubs::cti_op_ret_scopeChain).call();
    428425
    429426            ASSERT(callFrameRegister != regT1);
     
    447444        }
    448445        case op_new_array: {
    449             emitPutJITStubArgConstant(currentInstruction[2].u.operand, 1);
    450             emitPutJITStubArgConstant(currentInstruction[3].u.operand, 2);
    451             emitCTICall(JITStubs::cti_op_new_array);
    452             emitPutVirtualRegister(currentInstruction[1].u.operand);
     446            JITStubCall stubCall(this, JITStubs::cti_op_new_array);
     447            stubCall.addArgument(Imm32(currentInstruction[2].u.operand));
     448            stubCall.addArgument(Imm32(currentInstruction[3].u.operand));
     449            stubCall.call(currentInstruction[1].u.operand);
    453450            NEXT_OPCODE(op_new_array);
    454451        }
    455452        case op_resolve: {
    456             Identifier* ident = &(m_codeBlock->identifier(currentInstruction[2].u.operand));
    457             emitPutJITStubArgConstant(ident, 1);
    458             emitCTICall(JITStubs::cti_op_resolve);
    459             emitPutVirtualRegister(currentInstruction[1].u.operand);
     453            JITStubCall stubCall(this, JITStubs::cti_op_resolve);
     454            stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
     455            stubCall.call(currentInstruction[1].u.operand);
    460456            NEXT_OPCODE(op_resolve);
    461457        }
     
    485481        }
    486482        case op_strcat: {
    487             emitPutJITStubArgConstant(currentInstruction[2].u.operand, 1);
    488             emitPutJITStubArgConstant(currentInstruction[3].u.operand, 2);
    489             emitCTICall(JITStubs::cti_op_strcat);
    490             emitPutVirtualRegister(currentInstruction[1].u.operand);
    491 
     483            JITStubCall stubCall(this, JITStubs::cti_op_strcat);
     484            stubCall.addArgument(Imm32(currentInstruction[2].u.operand));
     485            stubCall.addArgument(Imm32(currentInstruction[3].u.operand));
     486            stubCall.call(currentInstruction[1].u.operand);
    492487            NEXT_OPCODE(op_strcat);
    493488        }
     
    519514        }
    520515        case op_resolve_func: {
    521             Identifier* ident = &(m_codeBlock->identifier(currentInstruction[3].u.operand));
    522             emitPutJITStubArgConstant(ident, 1);
    523             emitCTICall(JITStubs::cti_op_resolve_func);
    524             emitPutVirtualRegister(currentInstruction[2].u.operand, regT1);
    525             emitPutVirtualRegister(currentInstruction[1].u.operand);
     516            JITStubCall stubCall(this, JITStubs::cti_op_resolve_func);
     517            stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[3].u.operand)));
     518            stubCall.call(currentInstruction[1].u.operand, currentInstruction[2].u.operand);
    526519            NEXT_OPCODE(op_resolve_func);
    527520        }
     
    574567        };
    575568        case op_resolve_base: {
    576             Identifier* ident = &(m_codeBlock->identifier(currentInstruction[2].u.operand));
    577             emitPutJITStubArgConstant(ident, 1);
    578             emitCTICall(JITStubs::cti_op_resolve_base);
    579             emitPutVirtualRegister(currentInstruction[1].u.operand);
     569            JITStubCall stubCall(this, JITStubs::cti_op_resolve_base);
     570            stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
     571            stubCall.call(currentInstruction[1].u.operand);
    580572            NEXT_OPCODE(op_resolve_base);
    581573        }
    582574        case op_resolve_skip: {
    583             Identifier* ident = &(m_codeBlock->identifier(currentInstruction[2].u.operand));
    584             emitPutJITStubArgConstant(ident, 1);
    585             emitPutJITStubArgConstant(currentInstruction[3].u.operand + m_codeBlock->needsFullScopeChain(), 2);
    586             emitCTICall(JITStubs::cti_op_resolve_skip);
    587             emitPutVirtualRegister(currentInstruction[1].u.operand);
     575            JITStubCall stubCall(this, JITStubs::cti_op_resolve_skip);
     576            stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
     577            stubCall.addArgument(Imm32(currentInstruction[3].u.operand + m_codeBlock->needsFullScopeChain()));
     578            stubCall.call(currentInstruction[1].u.operand);
    588579            NEXT_OPCODE(op_resolve_skip);
    589580        }
     
    591582            // Fast case
    592583            void* globalObject = currentInstruction[2].u.jsCell;
    593             Identifier* ident = &(m_codeBlock->identifier(currentInstruction[3].u.operand));
     584            Identifier* ident = &m_codeBlock->identifier(currentInstruction[3].u.operand);
    594585           
    595586            unsigned currentIndex = globalResolveInfoIndex++;
     
    611602            // Slow case
    612603            noMatch.link(this);
    613             emitPutJITStubArgConstant(globalObject, 1);
    614             emitPutJITStubArgConstant(ident, 2);
    615             emitPutJITStubArgConstant(currentIndex, 3);
    616             emitCTICall(JITStubs::cti_op_resolve_global);
    617             emitPutVirtualRegister(currentInstruction[1].u.operand);
     604            JITStubCall stubCall(this, JITStubs::cti_op_resolve_global);
     605            stubCall.addArgument(ImmPtr(globalObject));
     606            stubCall.addArgument(ImmPtr(ident));
     607            stubCall.addArgument(Imm32(currentIndex));
     608            stubCall.call(currentInstruction[1].u.operand);
    618609            end.link(this);
    619610            NEXT_OPCODE(op_resolve_global);
     
    768759        }
    769760        case op_resolve_with_base: {
    770             Identifier* ident = &(m_codeBlock->identifier(currentInstruction[3].u.operand));
    771             emitPutJITStubArgConstant(ident, 1);
    772             emitCTICall(JITStubs::cti_op_resolve_with_base);
    773             emitPutVirtualRegister(currentInstruction[2].u.operand, regT1);
    774             emitPutVirtualRegister(currentInstruction[1].u.operand);
     761            JITStubCall stubCall(this, JITStubs::cti_op_resolve_with_base);
     762            stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[3].u.operand)));
     763            stubCall.call(currentInstruction[1].u.operand, currentInstruction[2].u.operand);
    775764            NEXT_OPCODE(op_resolve_with_base);
    776765        }
    777766        case op_new_func_exp: {
    778             FuncExprNode* func = m_codeBlock->functionExpression(currentInstruction[2].u.operand);
    779             emitPutJITStubArgConstant(func, 1);
    780             emitCTICall(JITStubs::cti_op_new_func_exp);
    781             emitPutVirtualRegister(currentInstruction[1].u.operand);
     767            JITStubCall stubCall(this, JITStubs::cti_op_new_func_exp);
     768            stubCall.addArgument(ImmPtr(m_codeBlock->functionExpression(currentInstruction[2].u.operand)));
     769            stubCall.call(currentInstruction[1].u.operand);
    782770            NEXT_OPCODE(op_new_func_exp);
    783771        }
     
    823811        }
    824812        case op_new_regexp: {
    825             RegExp* regExp = m_codeBlock->regexp(currentInstruction[2].u.operand);
    826             emitPutJITStubArgConstant(regExp, 1);
    827             emitCTICall(JITStubs::cti_op_new_regexp);
    828             emitPutVirtualRegister(currentInstruction[1].u.operand);
     813            JITStubCall stubCall(this, JITStubs::cti_op_new_regexp);
     814            stubCall.addArgument(ImmPtr(m_codeBlock->regexp(currentInstruction[2].u.operand)));
     815            stubCall.call(currentInstruction[1].u.operand);
    829816            NEXT_OPCODE(op_new_regexp);
    830817        }
     
    837824        }
    838825        case op_throw: {
    839             emitPutJITStubArgFromVirtualRegister(currentInstruction[1].u.operand, 1, regT2);
    840             emitCTICall(JITStubs::cti_op_throw);
     826            JITStubCall stubCall(this, JITStubs::cti_op_throw);
     827            stubCall.addArgument(currentInstruction[1].u.operand, regT2);
     828            stubCall.call();
    841829            ASSERT(regT0 == returnValueRegister);
    842830#if PLATFORM(X86_64)
     
    860848        }
    861849        case op_next_pname: {
    862             emitPutJITStubArgFromVirtualRegister(currentInstruction[2].u.operand, 1, regT2);
    863             unsigned target = currentInstruction[3].u.operand;
    864             emitCTICall(JITStubs::cti_op_next_pname);
     850            JITStubCall stubCall(this, JITStubs::cti_op_next_pname);
     851            stubCall.addArgument(currentInstruction[2].u.operand, regT2);
     852            stubCall.call();
    865853            Jump endOfIter = branchTestPtr(Zero, regT0);
    866854            emitPutVirtualRegister(currentInstruction[1].u.operand);
    867             addJump(jump(), target + 3);
     855            addJump(jump(), currentInstruction[3].u.operand + 3);
    868856            endOfIter.link(this);
    869857            NEXT_OPCODE(op_next_pname);
    870858        }
    871859        case op_push_scope: {
    872             emitPutJITStubArgFromVirtualRegister(currentInstruction[1].u.operand, 1, regT2);
    873             emitCTICall(JITStubs::cti_op_push_scope);
    874             emitPutVirtualRegister(currentInstruction[1].u.operand);
     860            JITStubCall stubCall(this, JITStubs::cti_op_push_scope);
     861            stubCall.addArgument(currentInstruction[1].u.operand, regT2);
     862            stubCall.call(currentInstruction[1].u.operand);
    875863            NEXT_OPCODE(op_push_scope);
    876864        }
    877865        case op_pop_scope: {
    878             emitCTICall(JITStubs::cti_op_pop_scope);
     866            JITStubCall(this, JITStubs::cti_op_pop_scope).call();
    879867            NEXT_OPCODE(op_pop_scope);
    880868        }
     
    903891        }
    904892        case op_push_new_scope: {
    905             Identifier* ident = &(m_codeBlock->identifier(currentInstruction[2].u.operand));
    906             emitPutJITStubArgConstant(ident, 1);
    907             emitPutJITStubArgFromVirtualRegister(currentInstruction[3].u.operand, 2, regT2);
    908             emitCTICall(JITStubs::cti_op_push_new_scope);
    909             emitPutVirtualRegister(currentInstruction[1].u.operand);
     893            JITStubCall stubCall(this, JITStubs::cti_op_push_new_scope);
     894            stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
     895            stubCall.addArgument(currentInstruction[3].u.operand, regT2);
     896            stubCall.call(currentInstruction[1].u.operand);
    910897            NEXT_OPCODE(op_push_new_scope);
    911898        }
     
    916903        }
    917904        case op_jmp_scopes: {
    918             unsigned count = currentInstruction[1].u.operand;
    919             emitPutJITStubArgConstant(count, 1);
    920             emitCTICall(JITStubs::cti_op_jmp_scopes);
    921             unsigned target = currentInstruction[2].u.operand;
    922             addJump(jump(), target + 2);
    923             RECORD_JUMP_TARGET(target + 2);
     905            JITStubCall stubCall(this, JITStubs::cti_op_jmp_scopes);
     906            stubCall.addArgument(Imm32(currentInstruction[1].u.operand));
     907            stubCall.call();
     908            addJump(jump(), currentInstruction[2].u.operand + 2);
     909            RECORD_JUMP_TARGET(currentInstruction[2].u.operand + 2);
    924910            NEXT_OPCODE(op_jmp_scopes);
    925911        }
    926912        case op_put_by_index: {
    927             emitPutJITStubArgFromVirtualRegister(currentInstruction[1].u.operand, 1, regT2);
    928             emitPutJITStubArgConstant(currentInstruction[2].u.operand, 2);
    929             emitPutJITStubArgFromVirtualRegister(currentInstruction[3].u.operand, 3, regT2);
    930             emitCTICall(JITStubs::cti_op_put_by_index);
     913            JITStubCall stubCall(this, JITStubs::cti_op_put_by_index);
     914            stubCall.addArgument(currentInstruction[1].u.operand, regT2);
     915            stubCall.addArgument(Imm32(currentInstruction[2].u.operand));
     916            stubCall.addArgument(currentInstruction[3].u.operand, regT2);
     917            stubCall.call();
    931918            NEXT_OPCODE(op_put_by_index);
    932919        }
     
    941928            jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size());
    942929
    943             emitPutJITStubArgFromVirtualRegister(scrutinee, 1, regT2);
    944             emitPutJITStubArgConstant(tableIndex, 2);
    945             emitCTICall(JITStubs::cti_op_switch_imm);
     930            JITStubCall stubCall(this, JITStubs::cti_op_switch_imm);
     931            stubCall.addArgument(scrutinee, regT2);
     932            stubCall.addArgument(Imm32(tableIndex));
     933            stubCall.call();
    946934            jump(regT0);
    947935            NEXT_OPCODE(op_switch_imm);
     
    957945            jumpTable->ctiOffsets.grow(jumpTable->branchOffsets.size());
    958946
    959             emitPutJITStubArgFromVirtualRegister(scrutinee, 1, regT2);
    960             emitPutJITStubArgConstant(tableIndex, 2);
    961             emitCTICall(JITStubs::cti_op_switch_char);
     947            JITStubCall stubCall(this, JITStubs::cti_op_switch_char);
     948            stubCall.addArgument(scrutinee, regT2);
     949            stubCall.addArgument(Imm32(tableIndex));
     950            stubCall.call();
    962951            jump(regT0);
    963952            NEXT_OPCODE(op_switch_char);
     
    972961            m_switches.append(SwitchRecord(jumpTable, m_bytecodeIndex, defaultOffset));
    973962
    974             emitPutJITStubArgFromVirtualRegister(scrutinee, 1, regT2);
    975             emitPutJITStubArgConstant(tableIndex, 2);
    976             emitCTICall(JITStubs::cti_op_switch_string);
     963            JITStubCall stubCall(this, JITStubs::cti_op_switch_string);
     964            stubCall.addArgument(scrutinee, regT2);
     965            stubCall.addArgument(Imm32(tableIndex));
     966            stubCall.call();
    977967            jump(regT0);
    978968            NEXT_OPCODE(op_switch_string);
    979969        }
    980970        case op_put_getter: {
    981             emitPutJITStubArgFromVirtualRegister(currentInstruction[1].u.operand, 1, regT2);
    982             Identifier* ident = &(m_codeBlock->identifier(currentInstruction[2].u.operand));
    983             emitPutJITStubArgConstant(ident, 2);
    984             emitPutJITStubArgFromVirtualRegister(currentInstruction[3].u.operand, 3, regT2);
    985             emitCTICall(JITStubs::cti_op_put_getter);
     971            JITStubCall stubCall(this, JITStubs::cti_op_put_getter);
     972            stubCall.addArgument(currentInstruction[1].u.operand, regT2);
     973            stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
     974            stubCall.addArgument(currentInstruction[3].u.operand, regT2);
     975            stubCall.call();
    986976            NEXT_OPCODE(op_put_getter);
    987977        }
    988978        case op_put_setter: {
    989             emitPutJITStubArgFromVirtualRegister(currentInstruction[1].u.operand, 1, regT2);
    990             Identifier* ident = &(m_codeBlock->identifier(currentInstruction[2].u.operand));
    991             emitPutJITStubArgConstant(ident, 2);
    992             emitPutJITStubArgFromVirtualRegister(currentInstruction[3].u.operand, 3, regT2);
    993             emitCTICall(JITStubs::cti_op_put_setter);
     979            JITStubCall stubCall(this, JITStubs::cti_op_put_setter);
     980            stubCall.addArgument(currentInstruction[1].u.operand, regT2);
     981            stubCall.addArgument(ImmPtr(&m_codeBlock->identifier(currentInstruction[2].u.operand)));
     982            stubCall.addArgument(currentInstruction[3].u.operand, regT2);
     983            stubCall.call();
    994984            NEXT_OPCODE(op_put_setter);
    995985        }
    996986        case op_new_error: {
    997             JSValue message = m_codeBlock->unexpectedConstant(currentInstruction[3].u.operand);
    998             emitPutJITStubArgConstant(currentInstruction[2].u.operand, 1);
    999             emitPutJITStubArgConstant(JSValue::encode(message), 2);
    1000             emitPutJITStubArgConstant(m_bytecodeIndex, 3);
    1001             emitCTICall(JITStubs::cti_op_new_error);
    1002             emitPutVirtualRegister(currentInstruction[1].u.operand);
     987            JITStubCall stubCall(this, JITStubs::cti_op_new_error);
     988            stubCall.addArgument(Imm32(currentInstruction[2].u.operand));
     989            stubCall.addArgument(ImmPtr(JSValue::encode(m_codeBlock->unexpectedConstant(currentInstruction[3].u.operand))));
     990            stubCall.addArgument(Imm32(m_bytecodeIndex));
     991            stubCall.call(currentInstruction[1].u.operand);
    1003992            NEXT_OPCODE(op_new_error);
    1004993        }
    1005994        case op_debug: {
    1006             emitPutJITStubArgConstant(currentInstruction[1].u.operand, 1);
    1007             emitPutJITStubArgConstant(currentInstruction[2].u.operand, 2);
    1008             emitPutJITStubArgConstant(currentInstruction[3].u.operand, 3);
    1009             emitCTICall(JITStubs::cti_op_debug);
     995            JITStubCall stubCall(this, JITStubs::cti_op_debug);
     996            stubCall.addArgument(Imm32(currentInstruction[1].u.operand));
     997            stubCall.addArgument(Imm32(currentInstruction[2].u.operand));
     998            stubCall.addArgument(Imm32(currentInstruction[3].u.operand));
     999            stubCall.call();
    10101000            NEXT_OPCODE(op_debug);
    10111001        }
     
    10761066                emitInitRegister(j);
    10771067
    1078             emitCTICall(JITStubs::cti_op_push_activation);
    1079             emitPutVirtualRegister(currentInstruction[1].u.operand);
    1080 
     1068            JITStubCall(this, JITStubs::cti_op_push_activation).call(currentInstruction[1].u.operand);
    10811069            NEXT_OPCODE(op_enter_with_activation);
    10821070        }
    10831071        case op_create_arguments: {
    10841072            if (m_codeBlock->m_numParameters == 1)
    1085                 emitCTICall(JITStubs::cti_op_create_arguments_no_params);
     1073                JITStubCall(this, JITStubs::cti_op_create_arguments_no_params).call();
    10861074            else
    1087                 emitCTICall(JITStubs::cti_op_create_arguments);
     1075                JITStubCall(this, JITStubs::cti_op_create_arguments).call();
    10881076            NEXT_OPCODE(op_create_arguments);
    10891077        }
     
    11001088            emitGetCTIParam(FIELD_OFFSET(JITStackFrame, enabledProfilerReference) / sizeof (void*), regT0);
    11011089            Jump noProfiler = branchTestPtr(Zero, Address(regT0));
    1102             emitPutJITStubArgFromVirtualRegister(currentInstruction[1].u.operand, 1, regT0);
    1103             emitCTICall(JITStubs::cti_op_profile_will_call);
     1090
     1091            JITStubCall stubCall(this, JITStubs::cti_op_profile_will_call);
     1092            stubCall.addArgument(currentInstruction[1].u.operand, regT0);
     1093            stubCall.call();
    11041094            noProfiler.link(this);
    11051095
     
    11091099            emitGetCTIParam(FIELD_OFFSET(JITStackFrame, enabledProfilerReference) / sizeof (void*), regT0);
    11101100            Jump noProfiler = branchTestPtr(Zero, Address(regT0));
    1111             emitPutJITStubArgFromVirtualRegister(currentInstruction[1].u.operand, 1, regT0);
    1112             emitCTICall(JITStubs::cti_op_profile_did_call);
     1101
     1102            JITStubCall stubCall(this, JITStubs::cti_op_profile_did_call);
     1103            stubCall.addArgument(currentInstruction[1].u.operand, regT0);
     1104            stubCall.call();
    11131105            noProfiler.link(this);
    11141106
     
    11341126
    11351127#ifndef NDEBUG
    1136     // reset this, in order to guard it's use with asserts
     1128    // Reset this, in order to guard its use with ASSERTs.
    11371129    m_bytecodeIndex = (unsigned)-1;
    11381130#endif
     
    11681160            linkSlowCase(iter);
    11691161            linkSlowCase(iter);
    1170             emitPutJITStubArg(regT0, 1);
    1171             emitCTICall(JITStubs::cti_op_convert_this);
    1172             emitPutVirtualRegister(currentInstruction[1].u.operand);
     1162            JITStubCall stubCall(this, JITStubs::cti_op_convert_this);
     1163            stubCall.addArgument(regT0);
     1164            stubCall.call(currentInstruction[1].u.operand);
    11731165            NEXT_OPCODE(op_convert_this);
    11741166        }
     
    11881180            linkSlowCase(iter);
    11891181
    1190             emitPutJITStubArg(regT0, 1);
    1191             emitCTICall(JITStubs::cti_op_to_primitive);
    1192             emitPutVirtualRegister(currentInstruction[1].u.operand);
     1182            JITStubCall stubCall(this, JITStubs::cti_op_to_primitive);
     1183            stubCall.addArgument(regT0);
     1184            stubCall.call(currentInstruction[1].u.operand);
    11931185
    11941186            NEXT_OPCODE(op_to_primitive);
     
    12021194            linkSlowCase(iter);
    12031195            emitFastArithIntToImmNoCheck(regT1, regT1);
     1196
    12041197            notImm.link(this);
    1205             emitPutJITStubArg(regT0, 1);
    1206             emitPutJITStubArg(regT1, 2);
    1207             emitCTICall(JITStubs::cti_op_get_by_val);
    1208             emitPutVirtualRegister(currentInstruction[1].u.operand);
     1198            JITStubCall stubCall(this, JITStubs::cti_op_get_by_val);
     1199            stubCall.addArgument(regT0);
     1200            stubCall.addArgument(regT1);
     1201            stubCall.call(currentInstruction[1].u.operand);
    12091202            emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_get_by_val));
    12101203
     
    12411234            if (isOperandConstantImmediateInt(op2)) {
    12421235                linkSlowCase(iter);
    1243                 emitPutJITStubArg(regT0, 1);
    1244                 emitPutJITStubArgFromVirtualRegister(op2, 2, regT2);
    1245                 emitCTICall(JITStubs::cti_op_loop_if_less);
     1236                JITStubCall stubCall(this, JITStubs::cti_op_loop_if_less);
     1237                stubCall.addArgument(regT0);
     1238                stubCall.addArgument(op2, regT2);
     1239                stubCall.call();
    12461240                emitJumpSlowToHot(branchTest32(NonZero, regT0), target + 3);
    12471241            } else if (isOperandConstantImmediateInt(op1)) {
    12481242                linkSlowCase(iter);
    1249                 emitPutJITStubArgFromVirtualRegister(op1, 1, regT1);
    1250                 emitPutJITStubArg(regT0, 2);
    1251                 emitCTICall(JITStubs::cti_op_loop_if_less);
     1243                JITStubCall stubCall(this, JITStubs::cti_op_loop_if_less);
     1244                stubCall.addArgument(op1, regT1);
     1245                stubCall.addArgument(regT0);
     1246                stubCall.call();
    12521247                emitJumpSlowToHot(branchTest32(NonZero, regT0), target + 3);
    12531248            } else {
    12541249                linkSlowCase(iter);
    12551250                linkSlowCase(iter);
    1256                 emitPutJITStubArg(regT0, 1);
    1257                 emitPutJITStubArg(regT1, 2);
    1258                 emitCTICall(JITStubs::cti_op_loop_if_less);
     1251                JITStubCall stubCall(this, JITStubs::cti_op_loop_if_less);
     1252                stubCall.addArgument(regT0);
     1253                stubCall.addArgument(regT1);
     1254                stubCall.call();
    12591255                emitJumpSlowToHot(branchTest32(NonZero, regT0), target + 3);
    12601256            }
     
    12741270            if (isOperandConstantImmediateInt(op2)) {
    12751271                linkSlowCase(iter);
    1276                 emitPutJITStubArg(regT0, 1);
    1277                 emitPutJITStubArgFromVirtualRegister(currentInstruction[2].u.operand, 2, regT2);
    1278                 emitCTICall(JITStubs::cti_op_loop_if_lesseq);
     1272                JITStubCall stubCall(this, JITStubs::cti_op_loop_if_lesseq);
     1273                stubCall.addArgument(regT0);
     1274                stubCall.addArgument(currentInstruction[2].u.operand, regT2);
     1275                stubCall.call();
    12791276                emitJumpSlowToHot(branchTest32(NonZero, regT0), target + 3);
    12801277            } else {
    12811278                linkSlowCase(iter);
    12821279                linkSlowCase(iter);
    1283                 emitPutJITStubArg(regT0, 1);
    1284                 emitPutJITStubArg(regT1, 2);
    1285                 emitCTICall(JITStubs::cti_op_loop_if_lesseq);
     1280                JITStubCall stubCall(this, JITStubs::cti_op_loop_if_lesseq);
     1281                stubCall.addArgument(regT0);
     1282                stubCall.addArgument(regT1);
     1283                stubCall.call();
    12861284                emitJumpSlowToHot(branchTest32(NonZero, regT0), target + 3);
    12871285            }
     
    12981296            linkSlowCase(iter);
    12991297            emitFastArithIntToImmNoCheck(regT1, regT1);
    1300             notImm.link(this);
    1301             emitGetVirtualRegister(currentInstruction[3].u.operand, regT2);
    1302             emitPutJITStubArg(regT0, 1);
    1303             emitPutJITStubArg(regT1, 2);
    1304             emitPutJITStubArg(regT2, 3);
    1305             emitCTICall(JITStubs::cti_op_put_by_val);
    1306             emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_put_by_val));
     1298
     1299            notImm.link(this); {
     1300                JITStubCall stubCall(this, JITStubs::cti_op_put_by_val);
     1301                stubCall.addArgument(regT0);
     1302                stubCall.addArgument(regT1);
     1303                stubCall.addArgument(currentInstruction[3].u.operand, regT2);
     1304                stubCall.call();
     1305                emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_put_by_val));
     1306            }
    13071307
    13081308            // slow cases for immediate int accesses to arrays
    13091309            linkSlowCase(iter);
    1310             linkSlowCase(iter);
    1311             emitGetVirtualRegister(currentInstruction[3].u.operand, regT2);
    1312             emitPutJITStubArg(regT0, 1);
    1313             emitPutJITStubArg(regT1, 2);
    1314             emitPutJITStubArg(regT2, 3);
    1315             emitCTICall(JITStubs::cti_op_put_by_val_array);
    1316 
     1310            linkSlowCase(iter); {
     1311                JITStubCall stubCall(this, JITStubs::cti_op_put_by_val_array);
     1312                stubCall.addArgument(regT0);
     1313                stubCall.addArgument(regT1);
     1314                stubCall.addArgument(currentInstruction[3].u.operand, regT2);
     1315                stubCall.call();
     1316            }
    13171317            NEXT_OPCODE(op_put_by_val);
    13181318        }
    13191319        case op_loop_if_true: {
    13201320            linkSlowCase(iter);
    1321             emitPutJITStubArg(regT0, 1);
    1322             emitCTICall(JITStubs::cti_op_jtrue);
    1323             unsigned target = currentInstruction[2].u.operand;
    1324             emitJumpSlowToHot(branchTest32(NonZero, regT0), target + 2);
     1321            JITStubCall stubCall(this, JITStubs::cti_op_jtrue);
     1322            stubCall.addArgument(regT0);
     1323            stubCall.call();
     1324            emitJumpSlowToHot(branchTest32(NonZero, regT0), currentInstruction[2].u.operand + 2);
    13251325            NEXT_OPCODE(op_loop_if_true);
    13261326        }
     
    13401340            linkSlowCase(iter);
    13411341            xorPtr(Imm32(static_cast<int32_t>(JSImmediate::FullTagTypeBool)), regT0);
    1342             emitPutJITStubArg(regT0, 1);
    1343             emitCTICall(JITStubs::cti_op_not);
    1344             emitPutVirtualRegister(currentInstruction[1].u.operand);
     1342            JITStubCall stubCall(this, JITStubs::cti_op_not);
     1343            stubCall.addArgument(regT0);
     1344            stubCall.call(currentInstruction[1].u.operand);
    13451345            NEXT_OPCODE(op_not);
    13461346        }
    13471347        case op_jfalse: {
    13481348            linkSlowCase(iter);
    1349             emitPutJITStubArg(regT0, 1);
    1350             emitCTICall(JITStubs::cti_op_jtrue);
    1351             unsigned target = currentInstruction[2].u.operand;
    1352             emitJumpSlowToHot(branchTest32(Zero, regT0), target + 2); // inverted!
     1349            JITStubCall stubCall(this, JITStubs::cti_op_jtrue);
     1350            stubCall.addArgument(regT0);
     1351            stubCall.call();
     1352            emitJumpSlowToHot(branchTest32(Zero, regT0), currentInstruction[2].u.operand + 2); // inverted!
    13531353            NEXT_OPCODE(op_jfalse);
    13541354        }
     
    13591359        case op_bitnot: {
    13601360            linkSlowCase(iter);
    1361             emitPutJITStubArg(regT0, 1);
    1362             emitCTICall(JITStubs::cti_op_bitnot);
    1363             emitPutVirtualRegister(currentInstruction[1].u.operand);
     1361            JITStubCall stubCall(this, JITStubs::cti_op_bitnot);
     1362            stubCall.addArgument(regT0);
     1363            stubCall.call(currentInstruction[1].u.operand);
    13641364            NEXT_OPCODE(op_bitnot);
    13651365        }
     
    13701370        case op_jtrue: {
    13711371            linkSlowCase(iter);
    1372             emitPutJITStubArg(regT0, 1);
    1373             emitCTICall(JITStubs::cti_op_jtrue);
    1374             unsigned target = currentInstruction[2].u.operand;
    1375             emitJumpSlowToHot(branchTest32(NonZero, regT0), target + 2);
     1372            JITStubCall stubCall(this, JITStubs::cti_op_jtrue);
     1373            stubCall.addArgument(regT0);
     1374            stubCall.call();
     1375            emitJumpSlowToHot(branchTest32(NonZero, regT0), currentInstruction[2].u.operand + 2);
    13761376            NEXT_OPCODE(op_jtrue);
    13771377        }
     
    13821382        case op_bitxor: {
    13831383            linkSlowCase(iter);
    1384             emitPutJITStubArg(regT0, 1);
    1385             emitPutJITStubArg(regT1, 2);
    1386             emitCTICall(JITStubs::cti_op_bitxor);
    1387             emitPutVirtualRegister(currentInstruction[1].u.operand);
     1384            JITStubCall stubCall(this, JITStubs::cti_op_bitxor);
     1385            stubCall.addArgument(regT0);
     1386            stubCall.addArgument(regT1);
     1387            stubCall.call(currentInstruction[1].u.operand);
    13881388            NEXT_OPCODE(op_bitxor);
    13891389        }
    13901390        case op_bitor: {
    13911391            linkSlowCase(iter);
    1392             emitPutJITStubArg(regT0, 1);
    1393             emitPutJITStubArg(regT1, 2);
    1394             emitCTICall(JITStubs::cti_op_bitor);
    1395             emitPutVirtualRegister(currentInstruction[1].u.operand);
     1392            JITStubCall stubCall(this, JITStubs::cti_op_bitor);
     1393            stubCall.addArgument(regT0);
     1394            stubCall.addArgument(regT1);
     1395            stubCall.call(currentInstruction[1].u.operand);
    13961396            NEXT_OPCODE(op_bitor);
    13971397        }
    13981398        case op_eq: {
    13991399            linkSlowCase(iter);
    1400             emitPutJITStubArg(regT0, 1);
    1401             emitPutJITStubArg(regT1, 2);
    1402             emitCTICall(JITStubs::cti_op_eq);
    1403             emitPutVirtualRegister(currentInstruction[1].u.operand);
     1400            JITStubCall stubCall(this, JITStubs::cti_op_eq);
     1401            stubCall.addArgument(regT0);
     1402            stubCall.addArgument(regT1);
     1403            stubCall.call(currentInstruction[1].u.operand);
    14041404            NEXT_OPCODE(op_eq);
    14051405        }
    14061406        case op_neq: {
    14071407            linkSlowCase(iter);
    1408             emitPutJITStubArg(regT0, 1);
    1409             emitPutJITStubArg(regT1, 2);
    1410             emitCTICall(JITStubs::cti_op_neq);
    1411             emitPutVirtualRegister(currentInstruction[1].u.operand);
     1408            JITStubCall stubCall(this, JITStubs::cti_op_neq);
     1409            stubCall.addArgument(regT0);
     1410            stubCall.addArgument(regT1);
     1411            stubCall.call(currentInstruction[1].u.operand);
    14121412            NEXT_OPCODE(op_neq);
    14131413        }
     
    14151415            linkSlowCase(iter);
    14161416            linkSlowCase(iter);
    1417             emitPutJITStubArg(regT0, 1);
    1418             emitPutJITStubArg(regT1, 2);
    1419             emitCTICall(JITStubs::cti_op_stricteq);
    1420             emitPutVirtualRegister(currentInstruction[1].u.operand);
     1417            JITStubCall stubCall(this, JITStubs::cti_op_stricteq);
     1418            stubCall.addArgument(regT0);
     1419            stubCall.addArgument(regT1);
     1420            stubCall.call(currentInstruction[1].u.operand);
    14211421            NEXT_OPCODE(op_stricteq);
    14221422        }
     
    14241424            linkSlowCase(iter);
    14251425            linkSlowCase(iter);
    1426             emitPutJITStubArg(regT0, 1);
    1427             emitPutJITStubArg(regT1, 2);
    1428             emitCTICall(JITStubs::cti_op_nstricteq);
    1429             emitPutVirtualRegister(currentInstruction[1].u.operand);
     1426            JITStubCall stubCall(this, JITStubs::cti_op_nstricteq);
     1427            stubCall.addArgument(regT0);
     1428            stubCall.addArgument(regT1);
     1429            stubCall.call(currentInstruction[1].u.operand);
    14301430            NEXT_OPCODE(op_nstricteq);
    14311431        }
     
    14341434            linkSlowCase(iter);
    14351435            linkSlowCase(iter);
    1436             emitPutJITStubArgFromVirtualRegister(currentInstruction[2].u.operand, 1, regT2);
    1437             emitPutJITStubArgFromVirtualRegister(currentInstruction[3].u.operand, 2, regT2);
    1438             emitPutJITStubArgFromVirtualRegister(currentInstruction[4].u.operand, 3, regT2);
    1439             emitCTICall(JITStubs::cti_op_instanceof);
    1440             emitPutVirtualRegister(currentInstruction[1].u.operand);
     1436            JITStubCall stubCall(this, JITStubs::cti_op_instanceof);
     1437            stubCall.addArgument(currentInstruction[2].u.operand, regT2);
     1438            stubCall.addArgument(currentInstruction[3].u.operand, regT2);
     1439            stubCall.addArgument(currentInstruction[4].u.operand, regT2);
     1440            stubCall.call(currentInstruction[1].u.operand);
    14411441            NEXT_OPCODE(op_instanceof);
    14421442        }
     
    14701470            linkSlowCase(iter);
    14711471
    1472             emitPutJITStubArg(regT0, 1);
    1473             emitCTICall(JITStubs::cti_op_to_jsnumber);
    1474 
    1475             emitPutVirtualRegister(currentInstruction[1].u.operand);
     1472            JITStubCall stubCall(this, JITStubs::cti_op_to_jsnumber);
     1473            stubCall.addArgument(regT0);
     1474            stubCall.call(currentInstruction[1].u.operand);
    14761475            NEXT_OPCODE(op_to_jsnumber);
    14771476        }
     
    14931492
    14941493#ifndef NDEBUG
    1495     // reset this, in order to guard it's use with asserts
     1494    // Reset this, in order to guard its use with ASSERTs.
    14961495    m_bytecodeIndex = (unsigned)-1;
    14971496#endif
     
    15281527    if (m_codeBlock->codeType() == FunctionCode) {
    15291528        slowRegisterFileCheck.link(this);
    1530         m_bytecodeIndex = 0; // emitCTICall will add to the map, but doesn't actually need this...
    1531         emitCTICall(JITStubs::cti_register_file_check);
     1529        m_bytecodeIndex = 0;
     1530        JITStubCall(this, JITStubs::cti_register_file_check).call();
    15321531#ifndef NDEBUG
    1533         // reset this, in order to guard it's use with asserts
    1534         m_bytecodeIndex = (unsigned)-1;
     1532        m_bytecodeIndex = (unsigned)-1; // Reset this, in order to guard its use with ASSERTs.
    15351533#endif
    15361534        jump(afterRegisterFileCheck);
Note: See TracChangeset for help on using the changeset viewer.