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


Ignore:
Timestamp:
Jun 4, 2009, 4:00:58 AM (16 years ago)
Author:
[email protected]
Message:

2009-06-04 Gavin Barraclough <[email protected]>

Reviewed by Oliver Hunt.

Wrap the code that plants pushes/pops planted by JIT in explanatorily named
methods; move property storage reallocation into a standard stub function.

~No performance impact (possible <1% progression on x86-64, likely just noise).

  • jit/JIT.cpp: (JSC::JIT::privateCompile): (JSC::JIT::privateCompileCTIMachineTrampolines):

Wrap calls to push/pop.

  • jit/JIT.h:

Declare the new wrapper methods.

  • jit/JITInlineMethods.h: (JSC::JIT::preverveReturnAddressAfterCall): (JSC::JIT::restoreReturnAddressBeforeReturn):

Define the new wrapper methods.

  • jit/JITOpcodes.cpp: (JSC::JIT::emit_op_end): (JSC::JIT::emit_op_ret):

Wrap calls to push/pop.

  • jit/JITPropertyAccess.cpp: (JSC::JIT::privateCompilePutByIdTransition):

Move property storage reallocation into a standard stub function.

  • jit/JITStubs.cpp: (JSC::JITStubs::DEFINE_STUB_FUNCTION):
  • jit/JITStubs.h: (JSC::JITStubs::):
File:
1 edited

Legend:

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

    r44076 r44412  
    390390
    391391    // Could use a pop_m, but would need to offset the following instruction if so.
    392     pop(regT2);
     392    preverveReturnAddressAfterCall(regT2);
    393393    emitPutToCallFrameHeader(regT2, RegisterFile::ReturnPC);
    394394
     
    539539#endif
    540540
    541 #if !(PLATFORM(X86) || PLATFORM(X86_64))
    542 #error "This code is less portable than it looks this code assumes that regT3 is callee preserved, which happens to be true on x86/x86-64."
    543 #endif
    544 
    545541    // (3) Trampolines for the slow cases of op_call / op_call_eval / op_construct.
    546542   
     
    554550    loadPtr(Address(regT3, FIELD_OFFSET(FunctionBodyNode, m_jitCode)), regT0);
    555551    Jump isNativeFunc1 = branchTestPtr(NonZero, regT0);
    556     pop(regT3);
     552    preverveReturnAddressAfterCall(regT3);
    557553    restoreArgumentReference();
    558554    Call callJSFunction1 = call();
    559555    emitGetJITStubArg(1, regT2);
    560556    emitGetJITStubArg(3, regT1);
    561     push(regT3);
     557    restoreReturnAddressBeforeReturn(regT3);
    562558    hasCodeBlock1.link(this);
    563559
    564560    // Check argCount matches callee arity.
    565561    Jump arityCheckOkay1 = branch32(Equal, Address(regT0, FIELD_OFFSET(CodeBlock, m_numParameters)), regT1);
    566     pop(regT3);
     562    preverveReturnAddressAfterCall(regT3);
    567563    emitPutJITStubArg(regT3, 2);
    568564    emitPutJITStubArg(regT0, 4);
     
    572568    emitGetJITStubArg(1, regT2);
    573569    emitGetJITStubArg(3, regT1);
    574     push(regT3);
     570    restoreReturnAddressBeforeReturn(regT3);
    575571    arityCheckOkay1.link(this);
    576572    isNativeFunc1.link(this);
     
    578574    compileOpCallInitializeCallFrame();
    579575
    580     pop(regT3);
     576    preverveReturnAddressAfterCall(regT3);
    581577    emitPutJITStubArg(regT3, 2);
    582578    restoreArgumentReference();
    583579    Call callDontLazyLinkCall = call();
    584580    emitGetJITStubArg(1, regT2);
    585     push(regT3);
     581    restoreReturnAddressBeforeReturn(regT3);
    586582
    587583    jump(regT0);
     
    596592    loadPtr(Address(regT3, FIELD_OFFSET(FunctionBodyNode, m_jitCode)), regT0);
    597593    Jump isNativeFunc2 = branchTestPtr(NonZero, regT0);
    598     pop(regT3);
     594    preverveReturnAddressAfterCall(regT3);
    599595    restoreArgumentReference();
    600596    Call callJSFunction2 = call();
    601597    emitGetJITStubArg(1, regT2);
    602598    emitGetJITStubArg(3, regT1);
    603     push(regT3);
     599    restoreReturnAddressBeforeReturn(regT3);
    604600    hasCodeBlock2.link(this);
    605601
    606602    // Check argCount matches callee arity.
    607603    Jump arityCheckOkay2 = branch32(Equal, Address(regT0, FIELD_OFFSET(CodeBlock, m_numParameters)), regT1);
    608     pop(regT3);
     604    preverveReturnAddressAfterCall(regT3);
    609605    emitPutJITStubArg(regT3, 2);
    610606    emitPutJITStubArg(regT0, 4);
     
    614610    emitGetJITStubArg(1, regT2);
    615611    emitGetJITStubArg(3, regT1);
    616     push(regT3);
     612    restoreReturnAddressBeforeReturn(regT3);
    617613    arityCheckOkay2.link(this);
    618614    isNativeFunc2.link(this);
     
    620616    compileOpCallInitializeCallFrame();
    621617
    622     pop(regT3);
     618    preverveReturnAddressAfterCall(regT3);
    623619    emitPutJITStubArg(regT3, 2);
    624620    restoreArgumentReference();
    625621    Call callLazyLinkCall = call();
    626     push(regT3);
     622    restoreReturnAddressBeforeReturn(regT3);
    627623
    628624    jump(regT0);
     
    637633    loadPtr(Address(regT3, FIELD_OFFSET(FunctionBodyNode, m_jitCode)), regT0);
    638634    Jump isNativeFunc3 = branchTestPtr(NonZero, regT0);
    639     pop(regT3);
     635    preverveReturnAddressAfterCall(regT3);
    640636    restoreArgumentReference();
    641637    Call callJSFunction3 = call();
    642638    emitGetJITStubArg(1, regT2);
    643639    emitGetJITStubArg(3, regT1);
    644     push(regT3);
     640    restoreReturnAddressBeforeReturn(regT3);
    645641    loadPtr(Address(regT2, FIELD_OFFSET(JSFunction, m_body)), regT3); // reload the function body nody, so we can reload the code pointer.
    646642    hasCodeBlock3.link(this);
     
    648644    // Check argCount matches callee arity.
    649645    Jump arityCheckOkay3 = branch32(Equal, Address(regT0, FIELD_OFFSET(CodeBlock, m_numParameters)), regT1);
    650     pop(regT3);
     646    preverveReturnAddressAfterCall(regT3);
    651647    emitPutJITStubArg(regT3, 2);
    652648    emitPutJITStubArg(regT0, 4);
     
    656652    emitGetJITStubArg(1, regT2);
    657653    emitGetJITStubArg(3, regT1);
    658     push(regT3);
     654    restoreReturnAddressBeforeReturn(regT3);
    659655    loadPtr(Address(regT2, FIELD_OFFSET(JSFunction, m_body)), regT3); // reload the function body nody, so we can reload the code pointer.
    660656    arityCheckOkay3.link(this);
     
    668664   
    669665    Label nativeCallThunk = align();
    670     pop(regT0);
     666    preverveReturnAddressAfterCall(regT0);
    671667    emitPutToCallFrameHeader(regT0, RegisterFile::ReturnPC); // Push return address
    672668
     
    819815   
    820816    // Return.
    821     push(regT1);
     817    restoreReturnAddressBeforeReturn(regT1);
    822818    ret();
    823819
     
    831827    emitGetFromCallFrameHeaderPtr(RegisterFile::CallerFrame, callFrameRegister);
    832828    poke(callFrameRegister, offsetof(struct JITStackFrame, callFrame) / sizeof (void*));
    833     push(regT2);
     829    restoreReturnAddressBeforeReturn(regT2);
    834830    ret();
    835831   
Note: See TracChangeset for help on using the changeset viewer.