Changeset 44700 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jun 15, 2009, 5:26:53 PM (16 years ago)
Author:
[email protected]
Message:

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

Reviewed by Oliver Hunt.

Move repatching methods into a set of methods on a class. This will allow us to
coallesce memory reprotection calls. Really, we want this class to be called
PatchBuffer, we want the class PatchBuffer to be called LinkBuffer, we want both
to be memblers of MacroAssembler rather then AbstractMacroAssembler, we don't
want the CodeLocationFoo types anymore (they are now only really there to provide
type safety, and that is completely undermined by the way we use offsets). Then
the link & patch buffers should delegate the actual patching calls to the
architecture-specific layer of the MacroAssembler. Landing all these changes as a
sequence of patches.

No performance impact.

  • assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::CodeLocationCall::CodeLocationCall): (JSC::AbstractMacroAssembler::CodeLocationNearCall::CodeLocationNearCall): (JSC::AbstractMacroAssembler::CodeLocationNearCall::calleeReturnAddressValue): (JSC::AbstractMacroAssembler::RepatchBuffer::RepatchBuffer): (JSC::AbstractMacroAssembler::RepatchBuffer::relink): (JSC::AbstractMacroAssembler::RepatchBuffer::repatch): (JSC::AbstractMacroAssembler::RepatchBuffer::relinkCallerToTrampoline): (JSC::AbstractMacroAssembler::RepatchBuffer::relinkCallerToFunction): (JSC::AbstractMacroAssembler::RepatchBuffer::relinkNearCallerToTrampoline): (JSC::AbstractMacroAssembler::RepatchBuffer::repatchLoadPtrToLEA):
  • jit/JIT.cpp: (JSC::ctiPatchNearCallByReturnAddress): (JSC::ctiPatchCallByReturnAddress): (JSC::JIT::unlinkCall): (JSC::JIT::linkCall):
  • jit/JITPropertyAccess.cpp: (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::patchGetByIdSelf): (JSC::JIT::patchMethodCallProto): (JSC::JIT::patchPutByIdReplace): (JSC::JIT::privateCompilePatchGetArrayLength): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdSelfList): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain):
Location:
trunk/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r44693 r44700  
     12009-06-15  Gavin Barraclough  <[email protected]>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Move repatching methods into a set of methods on a class.  This will allow us to
     6        coallesce memory reprotection calls.  Really, we want this class to be called
     7        PatchBuffer, we want the class PatchBuffer to be called LinkBuffer, we want both
     8        to be memblers of MacroAssembler rather then AbstractMacroAssembler, we don't
     9        want the CodeLocationFoo types anymore (they are now only really there to provide
     10        type safety, and that is completely undermined by the way we use offsets).  Then
     11        the link & patch buffers should delegate the actual patching calls to the
     12        architecture-specific layer of the MacroAssembler.  Landing all these changes as a
     13        sequence of patches.
     14
     15        No performance impact.
     16
     17        * assembler/AbstractMacroAssembler.h:
     18        (JSC::AbstractMacroAssembler::CodeLocationCall::CodeLocationCall):
     19        (JSC::AbstractMacroAssembler::CodeLocationNearCall::CodeLocationNearCall):
     20        (JSC::AbstractMacroAssembler::CodeLocationNearCall::calleeReturnAddressValue):
     21        (JSC::AbstractMacroAssembler::RepatchBuffer::RepatchBuffer):
     22        (JSC::AbstractMacroAssembler::RepatchBuffer::relink):
     23        (JSC::AbstractMacroAssembler::RepatchBuffer::repatch):
     24        (JSC::AbstractMacroAssembler::RepatchBuffer::relinkCallerToTrampoline):
     25        (JSC::AbstractMacroAssembler::RepatchBuffer::relinkCallerToFunction):
     26        (JSC::AbstractMacroAssembler::RepatchBuffer::relinkNearCallerToTrampoline):
     27        (JSC::AbstractMacroAssembler::RepatchBuffer::repatchLoadPtrToLEA):
     28        * jit/JIT.cpp:
     29        (JSC::ctiPatchNearCallByReturnAddress):
     30        (JSC::ctiPatchCallByReturnAddress):
     31        (JSC::JIT::unlinkCall):
     32        (JSC::JIT::linkCall):
     33        * jit/JITPropertyAccess.cpp:
     34        (JSC::JIT::privateCompilePutByIdTransition):
     35        (JSC::JIT::patchGetByIdSelf):
     36        (JSC::JIT::patchMethodCallProto):
     37        (JSC::JIT::patchPutByIdReplace):
     38        (JSC::JIT::privateCompilePatchGetArrayLength):
     39        (JSC::JIT::privateCompileGetByIdProto):
     40        (JSC::JIT::privateCompileGetByIdSelfList):
     41        (JSC::JIT::privateCompileGetByIdProtoList):
     42        (JSC::JIT::privateCompileGetByIdChainList):
     43        (JSC::JIT::privateCompileGetByIdChain):
     44
    1452009-06-15  Gavin Barraclough  <[email protected]>
    246
  • trunk/JavaScriptCore/assembler/AbstractMacroAssembler.h

    r44514 r44700  
    5050    class Jump;
    5151    class PatchBuffer;
     52    class RepatchBuffer;
    5253    class CodeLocationInstruction;
    5354    class CodeLocationLabel;
     
    429430    // instruction stream, without any semantic information.
    430431    class CodeLocationCommon {
     432        friend class RepatchBuffer;
     433
    431434    public:
    432435        CodeLocationCommon()
     
    469472    // An arbitrary instruction in the JIT code.
    470473    class CodeLocationInstruction : public CodeLocationCommon {
    471         friend class CodeLocationCommon;
    472474    public:
    473475        CodeLocationInstruction()
     
    475477        }
    476478
    477         void repatchLoadPtrToLEA()
    478         {
    479             AssemblerType::repatchLoadPtrToLEA(this->dataLocation());
    480         }
    481 
    482     private:
    483479        explicit CodeLocationInstruction(void* location)
    484480            : CodeLocationCommon(CodePtr(location))
     
    496492        friend class CodeLocationNearCall;
    497493        friend class PatchBuffer;
     494        friend class RepatchBuffer;
    498495        friend class ProcessorReturnAddress;
    499496
     
    542539        }
    543540
    544         void relink(CodeLocationLabel destination)
    545         {
    546             AssemblerType::relinkJump(this->dataLocation(), destination.dataLocation());
    547         }
    548 
    549     private:
    550541        explicit CodeLocationJump(void* location)
    551542            : CodeLocationCommon(CodePtr(location))
     
    558549    // A point in the JIT code at which there is a call instruction.
    559550    class CodeLocationCall : public CodeLocationCommon {
    560         friend class CodeLocationCommon;
    561         friend class PatchBuffer;
    562         friend class ProcessorReturnAddress;
    563551    public:
    564552        CodeLocationCall()
     
    566554        }
    567555
    568         void relink(CodeLocationLabel destination)
    569         {
    570 #if PLATFORM(X86_64)
    571             CodeLocationCommon::dataLabelPtrAtOffset(-REPTACH_OFFSET_CALL_R11).repatch(destination.executableAddress());
    572 #else
    573             AssemblerType::relinkCall(this->dataLocation(), destination.executableAddress());
    574 #endif
    575         }
    576 
    577         void relink(FunctionPtr destination)
    578         {
    579 #if PLATFORM(X86_64)
    580             CodeLocationCommon::dataLabelPtrAtOffset(-REPTACH_OFFSET_CALL_R11).repatch(destination.executableAddress());
    581 #else
    582             AssemblerType::relinkCall(this->dataLocation(), destination.executableAddress());
    583 #endif
     556        explicit CodeLocationCall(CodePtr location)
     557            : CodeLocationCommon(location)
     558        {
     559        }
     560
     561        explicit CodeLocationCall(void* location)
     562            : CodeLocationCommon(CodePtr(location))
     563        {
    584564        }
    585565
     
    591571        }
    592572
    593     private:
    594         explicit CodeLocationCall(CodePtr location)
    595             : CodeLocationCommon(location)
    596         {
    597         }
    598 
    599         explicit CodeLocationCall(void* location)
    600             : CodeLocationCommon(CodePtr(location))
    601         {
    602         }
    603573    };
    604574
     
    607577    // A point in the JIT code at which there is a call instruction with near linkage.
    608578    class CodeLocationNearCall : public CodeLocationCommon {
    609         friend class CodeLocationCommon;
    610         friend class PatchBuffer;
    611         friend class ProcessorReturnAddress;
    612579    public:
    613580        CodeLocationNearCall()
     
    615582        }
    616583
    617         void relink(CodePtr destination)
    618         {
    619             AssemblerType::relinkCall(this->dataLocation(), destination.executableAddress());
    620         }
    621 
    622         void relink(CodeLocationLabel destination)
    623         {
    624             AssemblerType::relinkCall(this->dataLocation(), destination.executableAddress());
    625         }
    626 
    627         void relink(FunctionPtr destination)
    628         {
    629             AssemblerType::relinkCall(this->dataLocation(), destination.executableAddress());
     584        explicit CodeLocationNearCall(CodePtr location)
     585            : CodeLocationCommon(location)
     586        {
     587        }
     588
     589        explicit CodeLocationNearCall(void* location)
     590            : CodeLocationCommon(CodePtr(location))
     591        {
    630592        }
    631593
     
    636598            return this->executableAddress();
    637599        }
    638 
    639     private:
    640         explicit CodeLocationNearCall(CodePtr location)
    641             : CodeLocationCommon(location)
    642         {
    643         }
    644 
    645         explicit CodeLocationNearCall(void* location)
    646             : CodeLocationCommon(CodePtr(location))
    647         {
    648         }
    649600    };
    650601
     
    653604    // A point in the JIT code at which there is an int32_t immediate that may be repatched.
    654605    class CodeLocationDataLabel32 : public CodeLocationCommon {
    655         friend class CodeLocationCommon;
    656         friend class PatchBuffer;
    657606    public:
    658607        CodeLocationDataLabel32()
     
    660609        }
    661610
    662         void repatch(int32_t value)
    663         {
    664             AssemblerType::repatchInt32(this->dataLocation(), value);
    665         }
    666 
    667     private:
    668611        explicit CodeLocationDataLabel32(void* location)
    669612            : CodeLocationCommon(CodePtr(location))
     
    676619    // A point in the JIT code at which there is a void* immediate that may be repatched.
    677620    class CodeLocationDataLabelPtr : public CodeLocationCommon {
    678         friend class CodeLocationCommon;
    679         friend class PatchBuffer;
    680621    public:
    681622        CodeLocationDataLabelPtr()
     
    683624        }
    684625
    685         void repatch(void* value)
    686         {
    687             AssemblerType::repatchPointer(this->dataLocation(), value);
    688         }
    689 
    690     private:
    691626        explicit CodeLocationDataLabelPtr(void* location)
    692627            : CodeLocationCommon(CodePtr(location))
     
    699634    // This class can be used to relink a call identified by its return address.
    700635    class ProcessorReturnAddress {
    701         friend class CodeLocationCall;
    702         friend class CodeLocationNearCall;
    703636    public:
    704637        ProcessorReturnAddress(void* location)
     
    707640        }
    708641
    709         void relinkCallerToTrampoline(CodeLocationLabel label)
    710         {
    711             CodeLocationCall(CodePtr(m_location)).relink(label);
    712         }
    713        
    714         void relinkCallerToTrampoline(CodePtr newCalleeFunction)
    715         {
    716             relinkCallerToTrampoline(CodeLocationLabel(newCalleeFunction));
    717         }
    718 
    719         void relinkCallerToFunction(FunctionPtr function)
    720         {
    721             CodeLocationCall(CodePtr(m_location)).relink(function);
    722         }
    723        
    724         void relinkNearCallerToTrampoline(CodeLocationLabel label)
    725         {
    726             CodeLocationNearCall(CodePtr(m_location)).relink(label);
    727         }
    728        
    729         void relinkNearCallerToTrampoline(CodePtr newCalleeFunction)
    730         {
    731             relinkNearCallerToTrampoline(CodeLocationLabel(newCalleeFunction));
    732         }
    733 
    734642        void* addressForLookup()
    735643        {
     
    737645        }
    738646
    739     private:
    740647        ReturnAddressPtr m_location;
    741648    };
     
    902809    };
    903810
     811    class RepatchBuffer {
     812    public:
     813        RepatchBuffer()
     814        {
     815        }
     816
     817        void relink(CodeLocationJump jump, CodeLocationLabel destination)
     818        {
     819            AssemblerType::relinkJump(jump.dataLocation(), destination.dataLocation());
     820        }
     821
     822        void relink(CodeLocationCall call, CodeLocationLabel destination)
     823        {
     824#if PLATFORM(X86_64)
     825            repatch(call.dataLabelPtrAtOffset(-REPTACH_OFFSET_CALL_R11), destination.executableAddress());
     826#else
     827            AssemblerType::relinkCall(call.dataLocation(), destination.executableAddress());
     828#endif
     829        }
     830
     831        void relink(CodeLocationCall call, FunctionPtr destination)
     832        {
     833#if PLATFORM(X86_64)
     834            repatch(call.dataLabelPtrAtOffset(-REPTACH_OFFSET_CALL_R11), destination.executableAddress());
     835#else
     836            AssemblerType::relinkCall(call.dataLocation(), destination.executableAddress());
     837#endif
     838        }
     839
     840        void relink(CodeLocationNearCall nearCall, CodePtr destination)
     841        {
     842            AssemblerType::relinkCall(nearCall.dataLocation(), destination.executableAddress());
     843        }
     844
     845        void relink(CodeLocationNearCall nearCall, CodeLocationLabel destination)
     846        {
     847            AssemblerType::relinkCall(nearCall.dataLocation(), destination.executableAddress());
     848        }
     849
     850        void relink(CodeLocationNearCall nearCall, FunctionPtr destination)
     851        {
     852            AssemblerType::relinkCall(nearCall.dataLocation(), destination.executableAddress());
     853        }
     854
     855        void repatch(CodeLocationDataLabel32 dataLabel32, int32_t value)
     856        {
     857            AssemblerType::repatchInt32(dataLabel32.dataLocation(), value);
     858        }
     859
     860        void repatch(CodeLocationDataLabelPtr dataLabelPtr, void* value)
     861        {
     862            AssemblerType::repatchPointer(dataLabelPtr.dataLocation(), value);
     863        }
     864
     865        void relinkCallerToTrampoline(ProcessorReturnAddress returnAddress, CodeLocationLabel label)
     866        {
     867            relink(CodeLocationCall(CodePtr(returnAddress.m_location)), label);
     868        }
     869       
     870        void relinkCallerToTrampoline(ProcessorReturnAddress returnAddress, CodePtr newCalleeFunction)
     871        {
     872            relinkCallerToTrampoline(returnAddress, CodeLocationLabel(newCalleeFunction));
     873        }
     874
     875        void relinkCallerToFunction(ProcessorReturnAddress returnAddress, FunctionPtr function)
     876        {
     877            relink(CodeLocationCall(CodePtr(returnAddress.m_location)), function);
     878        }
     879       
     880        void relinkNearCallerToTrampoline(ProcessorReturnAddress returnAddress, CodeLocationLabel label)
     881        {
     882            relink(CodeLocationNearCall(CodePtr(returnAddress.m_location)), label);
     883        }
     884       
     885        void relinkNearCallerToTrampoline(ProcessorReturnAddress returnAddress, CodePtr newCalleeFunction)
     886        {
     887            relinkNearCallerToTrampoline(returnAddress, CodeLocationLabel(newCalleeFunction));
     888        }
     889
     890        void repatchLoadPtrToLEA(CodeLocationInstruction instruction)
     891        {
     892            AssemblerType::repatchLoadPtrToLEA(instruction.dataLocation());
     893        }
     894    };
     895
    904896
    905897    // Section 5: Misc admin methods
  • trunk/JavaScriptCore/jit/JIT.cpp

    r44693 r44700  
    4949void ctiPatchNearCallByReturnAddress(MacroAssembler::ProcessorReturnAddress returnAddress, MacroAssemblerCodePtr newCalleeFunction)
    5050{
    51     returnAddress.relinkNearCallerToTrampoline(newCalleeFunction);
     51    MacroAssembler::RepatchBuffer repatchBuffer;
     52    repatchBuffer.relinkNearCallerToTrampoline(returnAddress, newCalleeFunction);
    5253}
    5354
    5455void ctiPatchCallByReturnAddress(MacroAssembler::ProcessorReturnAddress returnAddress, MacroAssemblerCodePtr newCalleeFunction)
    5556{
    56     returnAddress.relinkCallerToTrampoline(newCalleeFunction);
     57    MacroAssembler::RepatchBuffer repatchBuffer;
     58    repatchBuffer.relinkCallerToTrampoline(returnAddress, newCalleeFunction);
    5759}
    5860
    5961void ctiPatchCallByReturnAddress(MacroAssembler::ProcessorReturnAddress returnAddress, FunctionPtr newCalleeFunction)
    6062{
    61     returnAddress.relinkCallerToFunction(newCalleeFunction);
     63    MacroAssembler::RepatchBuffer repatchBuffer;
     64    repatchBuffer.relinkCallerToFunction(returnAddress, newCalleeFunction);
    6265}
    6366
     
    903906    // (and, if a new JSFunction happened to be constructed at the same location, we could get a false positive
    904907    // match).  Reset the check so it no longer matches.
    905     callLinkInfo->hotPathBegin.repatch(JSValue::encode(JSValue()));
     908    RepatchBuffer repatchBuffer;
     909    repatchBuffer.repatch(callLinkInfo->hotPathBegin, JSValue::encode(JSValue()));
    906910}
    907911
    908912void JIT::linkCall(JSFunction* callee, CodeBlock* calleeCodeBlock, JITCode& code, CallLinkInfo* callLinkInfo, int callerArgCount, JSGlobalData* globalData)
    909913{
     914    RepatchBuffer repatchBuffer;
     915
    910916    // Currently we only link calls with the exact number of arguments.
    911917    // If this is a native call calleeCodeBlock is null so the number of parameters is unimportant
     
    916922            calleeCodeBlock->addCaller(callLinkInfo);
    917923   
    918         callLinkInfo->hotPathBegin.repatch(callee);
    919         callLinkInfo->hotPathOther.relink(code.addressForCall());
     924        repatchBuffer.repatch(callLinkInfo->hotPathBegin, callee);
     925        repatchBuffer.relink(callLinkInfo->hotPathOther, code.addressForCall());
    920926    }
    921927
    922928    // patch the call so we do not continue to try to link.
    923     callLinkInfo->callReturnLocation.relink(globalData->jitStubs.ctiVirtualCall());
     929    repatchBuffer.relink(callLinkInfo->callReturnLocation, globalData->jitStubs.ctiVirtualCall());
    924930}
    925931
  • trunk/JavaScriptCore/jit/JITPropertyAccess.cpp

    r44525 r44700  
    499499    CodeLocationLabel entryLabel = patchBuffer.finalizeCodeAddendum();
    500500    stubInfo->stubRoutine = entryLabel;
    501     returnAddress.relinkCallerToTrampoline(entryLabel);
     501    RepatchBuffer repatchBuffer;
     502    repatchBuffer.relinkCallerToTrampoline(returnAddress, entryLabel);
    502503}
    503504
    504505void JIT::patchGetByIdSelf(StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ProcessorReturnAddress returnAddress)
    505506{
     507    RepatchBuffer repatchBuffer;
     508
    506509    // We don't want to patch more than once - in future go to cti_op_get_by_id_generic.
    507510    // Should probably go to JITStubs::cti_op_get_by_id_fail, but that doesn't do anything interesting right now.
    508     returnAddress.relinkCallerToFunction(FunctionPtr(JITStubs::cti_op_get_by_id_self_fail));
     511    repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(JITStubs::cti_op_get_by_id_self_fail));
    509512
    510513    int offset = sizeof(JSValue) * cachedOffset;
     
    513516    // and makes the subsequent load's offset automatically correct
    514517    if (structure->isUsingInlineStorage())
    515         stubInfo->hotPathBegin.instructionAtOffset(patchOffsetGetByIdExternalLoad).repatchLoadPtrToLEA();
     518        repatchBuffer.repatchLoadPtrToLEA(stubInfo->hotPathBegin.instructionAtOffset(patchOffsetGetByIdExternalLoad));
    516519
    517520    // Patch the offset into the propoerty map to load from, then patch the Structure to look for.
    518     stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetGetByIdStructure).repatch(structure);
    519     stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetGetByIdPropertyMapOffset).repatch(offset);
     521    repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetGetByIdStructure), structure);
     522    repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetGetByIdPropertyMapOffset), offset);
    520523}
    521524
    522525void JIT::patchMethodCallProto(MethodCallLinkInfo& methodCallLinkInfo, JSFunction* callee, Structure* structure, JSObject* proto)
    523526{
     527    RepatchBuffer repatchBuffer;
     528
    524529    ASSERT(!methodCallLinkInfo.cachedStructure);
    525530    methodCallLinkInfo.cachedStructure = structure;
    526531    structure->ref();
    527532
    528     methodCallLinkInfo.structureLabel.repatch(structure);
    529     methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckProtoObj).repatch(proto);
    530     methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckProtoStruct).repatch(proto->structure());
    531     methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckPutFunction).repatch(callee);
     533    repatchBuffer.repatch(methodCallLinkInfo.structureLabel, structure);
     534    repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckProtoObj), proto);
     535    repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckProtoStruct), proto->structure());
     536    repatchBuffer.repatch(methodCallLinkInfo.structureLabel.dataLabelPtrAtOffset(patchOffsetMethodCheckPutFunction), callee);
    532537}
    533538
    534539void JIT::patchPutByIdReplace(StructureStubInfo* stubInfo, Structure* structure, size_t cachedOffset, ProcessorReturnAddress returnAddress)
    535540{
     541    RepatchBuffer repatchBuffer;
     542
    536543    // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
    537544    // Should probably go to JITStubs::cti_op_put_by_id_fail, but that doesn't do anything interesting right now.
    538     returnAddress.relinkCallerToFunction(FunctionPtr(JITStubs::cti_op_put_by_id_generic));
     545    repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(JITStubs::cti_op_put_by_id_generic));
    539546
    540547    int offset = sizeof(JSValue) * cachedOffset;
     
    543550    // and makes the subsequent load's offset automatically correct
    544551    if (structure->isUsingInlineStorage())
    545         stubInfo->hotPathBegin.instructionAtOffset(patchOffsetPutByIdExternalLoad).repatchLoadPtrToLEA();
     552        repatchBuffer.repatchLoadPtrToLEA(stubInfo->hotPathBegin.instructionAtOffset(patchOffsetPutByIdExternalLoad));
    546553
    547554    // Patch the offset into the propoerty map to load from, then patch the Structure to look for.
    548     stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetPutByIdStructure).repatch(structure);
    549     stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetPutByIdPropertyMapOffset).repatch(offset);
     555    repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabelPtrAtOffset(patchOffsetPutByIdStructure), structure);
     556    repatchBuffer.repatch(stubInfo->hotPathBegin.dataLabel32AtOffset(patchOffsetPutByIdPropertyMapOffset), offset);
    550557}
    551558
     
    553560{
    554561    StructureStubInfo* stubInfo = &m_codeBlock->getStubInfo(returnAddress.addressForLookup());
    555 
    556     // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
    557     returnAddress.relinkCallerToFunction(FunctionPtr(JITStubs::cti_op_get_by_id_array_fail));
    558562
    559563    // Check eax is an array
     
    585589    // Finally patch the jump to slow case back in the hot path to jump here instead.
    586590    CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
    587     jumpLocation.relink(entryLabel);
     591    RepatchBuffer repatchBuffer;
     592    repatchBuffer.relink(jumpLocation, entryLabel);
     593
     594    // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
     595    repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(JITStubs::cti_op_get_by_id_array_fail));
    588596}
    589597
    590598void JIT::privateCompileGetByIdProto(StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, size_t cachedOffset, ProcessorReturnAddress returnAddress, CallFrame* callFrame)
    591599{
    592     // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
    593     returnAddress.relinkCallerToFunction(FunctionPtr(JITStubs::cti_op_get_by_id_proto_list));
    594 
    595600    // The prototype object definitely exists (if this stub exists the CodeBlock is referencing a Structure that is
    596601    // referencing the prototype object - let's speculatively load it's table nice and early!)
     
    630635    // Finally patch the jump to slow case back in the hot path to jump here instead.
    631636    CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
    632     jumpLocation.relink(entryLabel);
     637    RepatchBuffer repatchBuffer;
     638    repatchBuffer.relink(jumpLocation, entryLabel);
     639
     640    // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
     641    repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(JITStubs::cti_op_get_by_id_proto_list));
    633642}
    634643
     
    658667    // Finally patch the jump to slow case back in the hot path to jump here instead.
    659668    CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
    660     jumpLocation.relink(entryLabel);
     669    RepatchBuffer repatchBuffer;
     670    repatchBuffer.relink(jumpLocation, entryLabel);
    661671}
    662672
     
    702712    // Finally patch the jump to slow case back in the hot path to jump here instead.
    703713    CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
    704     jumpLocation.relink(entryLabel);
     714    RepatchBuffer repatchBuffer;
     715    repatchBuffer.relink(jumpLocation, entryLabel);
    705716}
    706717
     
    755766    // Finally patch the jump to slow case back in the hot path to jump here instead.
    756767    CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
    757     jumpLocation.relink(entryLabel);
     768    RepatchBuffer repatchBuffer;
     769    repatchBuffer.relink(jumpLocation, entryLabel);
    758770}
    759771
    760772void JIT::privateCompileGetByIdChain(StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, size_t cachedOffset, ProcessorReturnAddress returnAddress, CallFrame* callFrame)
    761773{
    762     // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
    763     returnAddress.relinkCallerToFunction(FunctionPtr(JITStubs::cti_op_get_by_id_proto_list));
    764 
    765774    ASSERT(count);
    766775   
     
    805814    // Finally patch the jump to slow case back in the hot path to jump here instead.
    806815    CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
    807     jumpLocation.relink(entryLabel);
     816    RepatchBuffer repatchBuffer;
     817    repatchBuffer.relink(jumpLocation, entryLabel);
     818
     819    // We don't want to patch more than once - in future go to cti_op_put_by_id_generic.
     820    repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(JITStubs::cti_op_get_by_id_proto_list));
    808821}
    809822
Note: See TracChangeset for help on using the changeset viewer.