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


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):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.