Ignore:
Timestamp:
Feb 10, 2009, 8:57:08 PM (16 years ago)
Author:
[email protected]
Message:

2009-02-10 Gavin Barraclough <[email protected]>

Reviewed by Oliver Hunt.

Reduce use of void* / reinterpret_cast in JIT repatching code,
add strong types for Calls and for the various types of pointers
we retain into the JIT generated instruction stream.

No performance impact.

  • assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::ImmPtr::ImmPtr): (JSC::AbstractMacroAssembler::ImmPtr::asIntptr): (JSC::AbstractMacroAssembler::Imm32::Imm32): (JSC::AbstractMacroAssembler::Label::Label): (JSC::AbstractMacroAssembler::DataLabelPtr::DataLabelPtr): (JSC::AbstractMacroAssembler::Call::Call): (JSC::AbstractMacroAssembler::Call::link): (JSC::AbstractMacroAssembler::Call::linkTo): (JSC::AbstractMacroAssembler::Jump::Jump): (JSC::AbstractMacroAssembler::Jump::linkTo): (JSC::AbstractMacroAssembler::CodeLocationCommon::CodeLocationCommon): (JSC::AbstractMacroAssembler::CodeLocationCommon::operator bool): (JSC::AbstractMacroAssembler::CodeLocationCommon::reset): (JSC::AbstractMacroAssembler::CodeLocationLabel::CodeLocationLabel): (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForSwitch): (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForExceptionHandler): (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForJSR): (JSC::AbstractMacroAssembler::CodeLocationLabel::getJumpDestination): (JSC::AbstractMacroAssembler::CodeLocationJump::CodeLocationJump): (JSC::AbstractMacroAssembler::CodeLocationJump::relink): (JSC::AbstractMacroAssembler::CodeLocationCall::CodeLocationCall): (JSC::AbstractMacroAssembler::CodeLocationCall::relink): (JSC::AbstractMacroAssembler::CodeLocationCall::calleeReturnAddressValue): (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::CodeLocationDataLabel32): (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::repatch): (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::CodeLocationDataLabelPtr): (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::repatch): (JSC::AbstractMacroAssembler::ProcessorReturnAddress::ProcessorReturnAddress): (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToFunction): (JSC::AbstractMacroAssembler::ProcessorReturnAddress::operator void*): (JSC::AbstractMacroAssembler::PatchBuffer::entry): (JSC::AbstractMacroAssembler::PatchBuffer::trampolineAt): (JSC::AbstractMacroAssembler::PatchBuffer::link): (JSC::AbstractMacroAssembler::PatchBuffer::linkTailRecursive): (JSC::AbstractMacroAssembler::PatchBuffer::patch): (JSC::AbstractMacroAssembler::PatchBuffer::locationOf): (JSC::AbstractMacroAssembler::PatchBuffer::returnAddressOffset): (JSC::AbstractMacroAssembler::differenceBetween): (JSC::::CodeLocationCommon::labelAtOffset): (JSC::::CodeLocationCommon::jumpAtOffset): (JSC::::CodeLocationCommon::callAtOffset): (JSC::::CodeLocationCommon::dataLabelPtrAtOffset): (JSC::::CodeLocationCommon::dataLabel32AtOffset):
  • assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::call):
  • assembler/X86Assembler.h: (JSC::X86Assembler::getCallReturnOffset):
  • bytecode/CodeBlock.h: (JSC::CallLinkInfo::CallLinkInfo): (JSC::getStructureStubInfoReturnLocation): (JSC::getCallLinkInfoReturnLocation):
  • bytecode/Instruction.h: (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set): (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
  • bytecode/JumpTable.h: (JSC::StringJumpTable::ctiForValue): (JSC::SimpleJumpTable::ctiForValue):
  • bytecode/StructureStubInfo.h: (JSC::StructureStubInfo::StructureStubInfo):
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitCatch): (JSC::prepareJumpTableForStringSwitch):
  • interpreter/Interpreter.cpp: (JSC::Interpreter::cti_op_get_by_id_self_fail): (JSC::getPolymorphicAccessStructureListSlot): (JSC::Interpreter::cti_op_throw): (JSC::Interpreter::cti_op_switch_imm): (JSC::Interpreter::cti_op_switch_char): (JSC::Interpreter::cti_op_switch_string): (JSC::Interpreter::cti_vm_throw):
  • jit/JIT.cpp: (JSC::ctiSetReturnAddress): (JSC::ctiPatchCallByReturnAddress): (JSC::JIT::privateCompile): (JSC::JIT::privateCompileCTIMachineTrampolines):
  • jit/JIT.h: (JSC::CallRecord::CallRecord): (JSC::JIT::compileGetByIdSelf): (JSC::JIT::compileGetByIdProto): (JSC::JIT::compileGetByIdChain): (JSC::JIT::compilePutByIdReplace): (JSC::JIT::compilePutByIdTransition): (JSC::JIT::compilePatchGetArrayLength): (JSC::JIT::emitCTICall):
  • jit/JITCall.cpp: (JSC::JIT::unlinkCall): (JSC::JIT::linkCall):
  • jit/JITInlineMethods.h: (JSC::JIT::emitNakedCall): (JSC::JIT::emitCTICall_internal):
  • jit/JITPropertyAccess.cpp: (JSC::JIT::compileGetByIdSlowCase): (JSC::JIT::compilePutByIdSlowCase): (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::patchGetByIdSelf): (JSC::JIT::patchPutByIdReplace): (JSC::JIT::privateCompilePatchGetArrayLength): (JSC::JIT::privateCompileGetByIdSelf): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdSelfList): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain): (JSC::JIT::privateCompilePutByIdReplace):
File:
1 edited

Legend:

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

    r40562 r40846  
    135135    emitPutJITStubArg(X86::eax, 1);
    136136    emitPutJITStubArgConstant(ident, 2);
    137     Jump call = emitCTICall(Interpreter::cti_op_get_by_id);
     137    Call call = emitCTICall(Interpreter::cti_op_get_by_id);
    138138    emitPutVirtualRegister(resultVReg);
    139139
     
    177177    emitPutJITStubArg(X86::eax, 1);
    178178    emitPutJITStubArg(X86::edx, 3);
    179     Jump call = emitCTICall(Interpreter::cti_op_put_by_id);
     179    Call call = emitCTICall(Interpreter::cti_op_put_by_id);
    180180
    181181    // Track the location of the call; this will be used to recover patch information.
     
    194194}
    195195
    196 void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, void* returnAddress)
     196void JIT::privateCompilePutByIdTransition(StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, ProcessorReturnAddress returnAddress)
    197197{
    198198    JumpList failureCases;
     
    224224    successCases.link(this);
    225225
    226     Jump callTarget;
     226    Call callTarget;
    227227
    228228    // emit a call only if storage realloc is needed
     
    270270
    271271    if (plantedFailureJump)
    272         patchBuffer.link(failureJump, reinterpret_cast<void*>(Interpreter::cti_op_put_by_id_fail));
     272        patchBuffer.linkTailRecursive(failureJump, Interpreter::cti_op_put_by_id_fail);
    273273
    274274    if (transitionWillNeedStorageRealloc(oldStructure, newStructure))
    275         patchBuffer.link(callTarget, reinterpret_cast<void*>(resizePropertyStorage));
     275        patchBuffer.link(callTarget, resizePropertyStorage);
    276276   
    277     stubInfo->stubRoutine = code;
    278    
    279     Jump::patch(returnAddress, code);
    280 }
    281 
    282 void JIT::patchGetByIdSelf(StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, void* returnAddress)
     277    stubInfo->stubRoutine = patchBuffer.entry();
     278
     279    returnAddress.relinkCallerToFunction(code);
     280}
     281
     282void JIT::patchGetByIdSelf(StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ProcessorReturnAddress returnAddress)
    283283{
    284284    // We don't want to patch more than once - in future go to cti_op_get_by_id_generic.
    285285    // Should probably go to Interpreter::cti_op_get_by_id_fail, but that doesn't do anything interesting right now.
    286     Jump::patch(returnAddress, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_self_fail));
     286    returnAddress.relinkCallerToFunction(Interpreter::cti_op_get_by_id_self_fail);
    287287
    288288    // Patch the offset into the propoerty map to load from, then patch the Structure to look for.
    289     void* structureAddress = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(stubInfo->hotPathBegin) + patchOffsetGetByIdStructure);
    290     void* displacementAddress = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(stubInfo->hotPathBegin) + patchOffsetGetByIdPropertyMapOffset);
    291     DataLabelPtr::patch(structureAddress, structure);
    292     DataLabel32::patch(displacementAddress, cachedOffset * sizeof(JSValuePtr));
    293 }
    294 
    295 void JIT::patchPutByIdReplace(StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, void* returnAddress)
     289    stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetGetByIdStructure).repatch(structure);
     290    stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetGetByIdPropertyMapOffset).repatch(cachedOffset * sizeof(JSValuePtr));
     291}
     292
     293void JIT::patchPutByIdReplace(StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ProcessorReturnAddress returnAddress)
    296294{
    297295    // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
    298296    // Should probably go to Interpreter::cti_op_put_by_id_fail, but that doesn't do anything interesting right now.
    299     Jump::patch(returnAddress, reinterpret_cast<void*>(Interpreter::cti_op_put_by_id_generic));
     297    returnAddress.relinkCallerToFunction(Interpreter::cti_op_put_by_id_generic);
    300298
    301299    // Patch the offset into the propoerty map to load from, then patch the Structure to look for.
    302     void* structureAddress = reinterpret_cast<char*>(stubInfo->hotPathBegin) + patchOffsetPutByIdStructure;
    303     void* displacementAddress = reinterpret_cast<char*>(stubInfo->hotPathBegin) + patchOffsetPutByIdPropertyMapOffset;
    304     DataLabelPtr::patch(structureAddress, structure);
    305     DataLabel32::patch(displacementAddress, cachedOffset * sizeof(JSValuePtr));
    306 }
    307 
    308 void JIT::privateCompilePatchGetArrayLength(void* returnAddress)
     300    stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetPutByIdStructure).repatch(structure);
     301    stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetPutByIdPropertyMapOffset).repatch(cachedOffset * sizeof(JSValuePtr));
     302}
     303
     304void JIT::privateCompilePatchGetArrayLength(ProcessorReturnAddress returnAddress)
    309305{
    310306    StructureStubInfo* stubInfo = &m_codeBlock->getStubInfo(returnAddress);
    311307
    312308    // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
    313     Jump::patch(returnAddress, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_array_fail));
     309    returnAddress.relinkCallerToFunction(Interpreter::cti_op_get_by_id_array_fail);
    314310
    315311    // Check eax is an array
     
    329325
    330326    // Use the patch information to link the failure cases back to the original slow case routine.
    331     void* slowCaseBegin = reinterpret_cast<char*>(stubInfo->callReturnLocation) - patchOffsetGetByIdSlowCaseCall;
     327    CodeLocationLabel slowCaseBegin = stubInfo->callReturnLocation.labelAtOffset(-patchOffsetGetByIdSlowCaseCall);
    332328    patchBuffer.link(failureCases1, slowCaseBegin);
    333329    patchBuffer.link(failureCases2, slowCaseBegin);
    334330
    335331    // On success return back to the hot patch code, at a point it will perform the store to dest for us.
    336     void* hotPathPutResult = reinterpret_cast<char*>(stubInfo->hotPathBegin) + patchOffsetGetByIdPutResult;
    337     patchBuffer.link(success, hotPathPutResult);
     332    patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
    338333
    339334    // Track the stub we have created so that it will be deleted later.
    340     stubInfo->stubRoutine = code;
    341 
    342     // Finally patch the jump to sow case back in the hot path to jump here instead.
    343     void* jumpLocation = reinterpret_cast<char*>(stubInfo->hotPathBegin) + patchOffsetGetByIdBranchToSlowCase;
    344     Jump::patch(jumpLocation, code);
    345 }
    346 
    347 void JIT::privateCompileGetByIdSelf(StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, void* returnAddress)
     335    CodeLocationLabel entryLabel = patchBuffer.entry();
     336    stubInfo->stubRoutine = entryLabel;
     337
     338    // Finally patch the jump to slow case back in the hot path to jump here instead.
     339    CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
     340    jumpLocation.relink(entryLabel);
     341}
     342
     343void JIT::privateCompileGetByIdSelf(StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ProcessorReturnAddress returnAddress)
    348344{
    349345    // Check eax is an object of the right Structure.
     
    359355    PatchBuffer patchBuffer(code);
    360356
    361     patchBuffer.link(failureCases1, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_self_fail));
    362     patchBuffer.link(failureCases2, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_self_fail));
    363 
    364     stubInfo->stubRoutine = code;
    365 
    366     Jump::patch(returnAddress, code);
    367 }
    368 
    369 void JIT::privateCompileGetByIdProto(StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, size_t cachedOffset, void* returnAddress, CallFrame* callFrame)
     357    patchBuffer.linkTailRecursive(failureCases1, Interpreter::cti_op_get_by_id_self_fail);
     358    patchBuffer.linkTailRecursive(failureCases2, Interpreter::cti_op_get_by_id_self_fail);
     359
     360    stubInfo->stubRoutine = patchBuffer.entry();
     361
     362    returnAddress.relinkCallerToFunction(code);
     363}
     364
     365void JIT::privateCompileGetByIdProto(StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, size_t cachedOffset, ProcessorReturnAddress returnAddress, CallFrame* callFrame)
    370366{
    371367#if USE(CTI_REPATCH_PIC)
    372368    // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
    373     Jump::patch(returnAddress, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_proto_list));
     369    returnAddress.relinkCallerToFunction(Interpreter::cti_op_get_by_id_proto_list);
    374370
    375371    // The prototype object definitely exists (if this stub exists the CodeBlock is referencing a Structure that is
     
    400396
    401397    // Use the patch information to link the failure cases back to the original slow case routine.
    402     void* slowCaseBegin = reinterpret_cast<char*>(stubInfo->callReturnLocation) - patchOffsetGetByIdSlowCaseCall;
     398    CodeLocationLabel slowCaseBegin = stubInfo->callReturnLocation.labelAtOffset(-patchOffsetGetByIdSlowCaseCall);
    403399    patchBuffer.link(failureCases1, slowCaseBegin);
    404400    patchBuffer.link(failureCases2, slowCaseBegin);
    405401
    406402    // On success return back to the hot patch code, at a point it will perform the store to dest for us.
    407     intptr_t successDest = reinterpret_cast<intptr_t>(stubInfo->hotPathBegin) + patchOffsetGetByIdPutResult;
    408     patchBuffer.link(success, reinterpret_cast<void*>(successDest));
     403    patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
    409404
    410405    // Track the stub we have created so that it will be deleted later.
    411     stubInfo->stubRoutine = code;
     406    CodeLocationLabel entryLabel = patchBuffer.entry();
     407    stubInfo->stubRoutine = entryLabel;
    412408
    413409    // Finally patch the jump to slow case back in the hot path to jump here instead.
    414     void* jumpLocation = reinterpret_cast<char*>(stubInfo->hotPathBegin) + patchOffsetGetByIdBranchToSlowCase;
    415     Jump::patch(jumpLocation, code);
     410    CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
     411    jumpLocation.relink(entryLabel);
    416412#else
    417413    // The prototype object definitely exists (if this stub exists the CodeBlock is referencing a Structure that is
     
    437433    PatchBuffer patchBuffer(code);
    438434
    439     patchBuffer.link(failureCases1, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_proto_fail));
    440     patchBuffer.link(failureCases2, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_proto_fail));
    441     patchBuffer.link(failureCases3, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_proto_fail));
    442 
    443     stubInfo->stubRoutine = code;
    444 
    445     Jump::patch(returnAddress, code);
     435    patchBuffer.link(failureCases1, Interpreter::cti_op_get_by_id_proto_fail);
     436    patchBuffer.link(failureCases2, Interpreter::cti_op_get_by_id_proto_fail);
     437    patchBuffer.link(failureCases3, Interpreter::cti_op_get_by_id_proto_fail);
     438
     439    stubInfo->stubRoutine = patchBuffer.entry();
     440
     441    returnAddress.relinkCallerToFunction(code);
    446442#endif
    447443}
     
    460456
    461457    // Use the patch information to link the failure cases back to the original slow case routine.
    462     void* lastProtoBegin = polymorphicStructures->list[currentIndex - 1].stubRoutine;
     458    CodeLocationLabel lastProtoBegin = polymorphicStructures->list[currentIndex - 1].stubRoutine;
    463459    if (!lastProtoBegin)
    464         lastProtoBegin = reinterpret_cast<char*>(stubInfo->callReturnLocation) - patchOffsetGetByIdSlowCaseCall;
     460        lastProtoBegin = stubInfo->callReturnLocation.labelAtOffset(-patchOffsetGetByIdSlowCaseCall);
    465461
    466462    patchBuffer.link(failureCase, lastProtoBegin);
    467463
    468464    // On success return back to the hot patch code, at a point it will perform the store to dest for us.
    469     intptr_t successDest = reinterpret_cast<intptr_t>(stubInfo->hotPathBegin) + patchOffsetGetByIdPutResult;
    470     patchBuffer.link(success, reinterpret_cast<void*>(successDest));
     465    patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
     466
     467    CodeLocationLabel entryLabel = patchBuffer.entry();
    471468
    472469    structure->ref();
    473     polymorphicStructures->list[currentIndex].set(code, structure);
     470    polymorphicStructures->list[currentIndex].set(entryLabel, structure);
    474471
    475472    // Finally patch the jump to slow case back in the hot path to jump here instead.
    476     void* jumpLocation = reinterpret_cast<char*>(stubInfo->hotPathBegin) + patchOffsetGetByIdBranchToSlowCase;
    477     Jump::patch(jumpLocation, code);
     473    CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
     474    jumpLocation.relink(entryLabel);
    478475}
    479476
     
    507504
    508505    // Use the patch information to link the failure cases back to the original slow case routine.
    509     void* lastProtoBegin = prototypeStructures->list[currentIndex - 1].stubRoutine;
     506    CodeLocationLabel lastProtoBegin = prototypeStructures->list[currentIndex - 1].stubRoutine;
    510507    patchBuffer.link(failureCases1, lastProtoBegin);
    511508    patchBuffer.link(failureCases2, lastProtoBegin);
    512509
    513510    // On success return back to the hot patch code, at a point it will perform the store to dest for us.
    514     intptr_t successDest = reinterpret_cast<intptr_t>(stubInfo->hotPathBegin) + patchOffsetGetByIdPutResult;
    515     patchBuffer.link(success, reinterpret_cast<void*>(successDest));
     511    patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
     512
     513    CodeLocationLabel entryLabel = patchBuffer.entry();
    516514
    517515    structure->ref();
    518516    prototypeStructure->ref();
    519     prototypeStructures->list[currentIndex].set(code, structure, prototypeStructure);
     517    prototypeStructures->list[currentIndex].set(entryLabel, structure, prototypeStructure);
    520518
    521519    // Finally patch the jump to slow case back in the hot path to jump here instead.
    522     void* jumpLocation = reinterpret_cast<char*>(stubInfo->hotPathBegin) + patchOffsetGetByIdBranchToSlowCase;
    523     Jump::patch(jumpLocation, code);
     520    CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
     521    jumpLocation.relink(entryLabel);
    524522}
    525523
     
    561559
    562560    // Use the patch information to link the failure cases back to the original slow case routine.
    563     void* lastProtoBegin = prototypeStructures->list[currentIndex - 1].stubRoutine;
     561    CodeLocationLabel lastProtoBegin = prototypeStructures->list[currentIndex - 1].stubRoutine;
    564562
    565563    patchBuffer.link(bucketsOfFail, lastProtoBegin);
    566564
    567565    // On success return back to the hot patch code, at a point it will perform the store to dest for us.
    568     intptr_t successDest = reinterpret_cast<intptr_t>(stubInfo->hotPathBegin) + patchOffsetGetByIdPutResult;
    569     patchBuffer.link(success, reinterpret_cast<void*>(successDest));
     566    patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
     567
     568    CodeLocationLabel entryLabel = patchBuffer.entry();
    570569
    571570    // Track the stub we have created so that it will be deleted later.
    572571    structure->ref();
    573572    chain->ref();
    574     prototypeStructures->list[currentIndex].set(code, structure, chain);
     573    prototypeStructures->list[currentIndex].set(entryLabel, structure, chain);
    575574
    576575    // Finally patch the jump to slow case back in the hot path to jump here instead.
    577     void* jumpLocation = reinterpret_cast<char*>(stubInfo->hotPathBegin) + patchOffsetGetByIdBranchToSlowCase;
    578     Jump::patch(jumpLocation, code);
    579 }
    580 #endif
    581 
    582 void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset, void* returnAddress, CallFrame* callFrame)
     576    CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
     577    jumpLocation.relink(entryLabel);
     578}
     579#endif
     580
     581void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset, ProcessorReturnAddress returnAddress, CallFrame* callFrame)
    583582{
    584583#if USE(CTI_REPATCH_PIC)
    585584    // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
    586     Jump::patch(returnAddress, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_proto_list));
     585    returnAddress.relinkCallerToFunction(Interpreter::cti_op_get_by_id_proto_list);
    587586
    588587    ASSERT(count);
     
    620619
    621620    // Use the patch information to link the failure cases back to the original slow case routine.
    622     void* slowCaseBegin = reinterpret_cast<char*>(stubInfo->callReturnLocation) - patchOffsetGetByIdSlowCaseCall;
    623 
    624     patchBuffer.link(bucketsOfFail, slowCaseBegin);
     621    patchBuffer.link(bucketsOfFail, stubInfo->callReturnLocation.labelAtOffset(-patchOffsetGetByIdSlowCaseCall));
    625622
    626623    // On success return back to the hot patch code, at a point it will perform the store to dest for us.
    627     intptr_t successDest = reinterpret_cast<intptr_t>(stubInfo->hotPathBegin) + patchOffsetGetByIdPutResult;
    628     patchBuffer.link(success, reinterpret_cast<void*>(successDest));
     624    patchBuffer.link(success, stubInfo->hotPathBegin.labelAtOffset(patchOffsetGetByIdPutResult));
    629625
    630626    // Track the stub we have created so that it will be deleted later.
    631     stubInfo->stubRoutine = code;
     627    CodeLocationLabel entryLabel = patchBuffer.entry();
     628    stubInfo->stubRoutine = entryLabel;
    632629
    633630    // Finally patch the jump to slow case back in the hot path to jump here instead.
    634     void* jumpLocation = reinterpret_cast<char*>(stubInfo->hotPathBegin) + patchOffsetGetByIdBranchToSlowCase;
    635     Jump::patch(jumpLocation, code);
     631    CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
     632    jumpLocation.relink(entryLabel);
    636633#else
    637634    ASSERT(count);
     
    668665    void* code = m_assembler.executableCopy(m_codeBlock->executablePool());
    669666
    670     patchBuffer.link(bucketsOfFail, reinterpret_cast<void*>(Interpreter::cti_op_get_by_id_proto_fail));
    671 
    672     stubInfo->stubRoutine = code;
    673 
    674     Jump::patch(returnAddress, code);
    675 #endif
    676 }
    677 
    678 void JIT::privateCompilePutByIdReplace(StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, void* returnAddress)
     667    patchBuffer.link(bucketsOfFail, Interpreter::cti_op_get_by_id_proto_fail);
     668
     669    stubInfo->stubRoutine = patchBuffer.entry();
     670
     671    returnAddress.relinkCallerToFunction(code);
     672#endif
     673}
     674
     675void JIT::privateCompilePutByIdReplace(StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ProcessorReturnAddress returnAddress)
    679676{
    680677    // Check eax is an object of the right Structure.
     
    690687    PatchBuffer patchBuffer(code);
    691688   
    692     patchBuffer.link(failureCases1, reinterpret_cast<void*>(Interpreter::cti_op_put_by_id_fail));
    693     patchBuffer.link(failureCases2, reinterpret_cast<void*>(Interpreter::cti_op_put_by_id_fail));
    694 
    695     stubInfo->stubRoutine = code;
     689    patchBuffer.linkTailRecursive(failureCases1, Interpreter::cti_op_put_by_id_fail);
     690    patchBuffer.linkTailRecursive(failureCases2, Interpreter::cti_op_put_by_id_fail);
     691
     692    stubInfo->stubRoutine = patchBuffer.entry();
    696693   
    697     Jump::patch(returnAddress, code);
     694    returnAddress.relinkCallerToFunction(code);
    698695}
    699696
Note: See TracChangeset for help on using the changeset viewer.