Changeset 189288 in webkit


Ignore:
Timestamp:
Sep 3, 2015 2:11:59 PM (9 years ago)
Author:
fpizlo@apple.com
Message:

Get rid of RepatchBuffer and replace it with static functions
https://bugs.webkit.org/show_bug.cgi?id=148742

Reviewed by Geoffrey Garen and Mark Lam.

RepatchBuffer is an object that doesn't have any state. All of its instance methods are
just wrappers for methods on MacroAssembler. So, we should make those MacroAssembler
methods public and call them directly.

(JSC::AbstractMacroAssembler::linkJump):
(JSC::AbstractMacroAssembler::linkPointer):
(JSC::AbstractMacroAssembler::getLinkerAddress):
(JSC::AbstractMacroAssembler::getLinkerCallReturnOffset):
(JSC::AbstractMacroAssembler::repatchJump):
(JSC::AbstractMacroAssembler::repatchNearCall):
(JSC::AbstractMacroAssembler::repatchCompact):
(JSC::AbstractMacroAssembler::repatchInt32):
(JSC::AbstractMacroAssembler::repatchPointer):
(JSC::AbstractMacroAssembler::readPointer):
(JSC::AbstractMacroAssembler::replaceWithLoad):
(JSC::AbstractMacroAssembler::replaceWithAddressComputation):
(JSC::AbstractMacroAssembler::AbstractMacroAssembler):

  • assembler/MacroAssemblerARM64.h:

(JSC::MacroAssemblerARM64::revertJumpReplacementToPatchableBranch32WithPatch):
(JSC::MacroAssemblerARM64::repatchCall):
(JSC::MacroAssemblerARM64::makeBranch):
(JSC::MacroAssemblerARM64::linkCall):

  • assembler/MacroAssemblerARMv7.h:

(JSC::MacroAssemblerARMv7::revertJumpReplacementToPatchableBranch32WithPatch):
(JSC::MacroAssemblerARMv7::repatchCall):
(JSC::MacroAssemblerARMv7::linkCall):
(JSC::MacroAssemblerARMv7::trustedImm32FromPtr):

  • assembler/MacroAssemblerX86.h:

(JSC::MacroAssemblerX86::revertJumpReplacementToPatchableBranch32WithPatch):
(JSC::MacroAssemblerX86::repatchCall):
(JSC::MacroAssemblerX86::linkCall):

  • assembler/MacroAssemblerX86_64.h:

(JSC::MacroAssemblerX86_64::revertJumpReplacementToBranchPtrWithPatch):
(JSC::MacroAssemblerX86_64::repatchCall):
(JSC::MacroAssemblerX86_64::linkCall):

  • assembler/RepatchBuffer.h: Removed.
  • bytecode/CallLinkInfo.cpp:

(JSC::CallLinkInfo::clearStub):
(JSC::CallLinkInfo::unlink):
(JSC::CallLinkInfo::visitWeak):

  • bytecode/CallLinkInfo.h:

(JSC::CallLinkInfo::registerPreservationMode):
(JSC::CallLinkInfo::isLinked):
(JSC::CallLinkInfo::setUpCall):
(JSC::CallLinkInfo::codeOrigin):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::finalizeUnconditionally):
(JSC::CodeBlock::resetStub):
(JSC::CodeBlock::resetStubInternal):
(JSC::CodeBlock::resetStubDuringGCInternal):
(JSC::CodeBlock::unlinkIncomingCalls):

  • bytecode/CodeBlock.h:
  • bytecode/PolymorphicGetByIdList.cpp:

(JSC::GetByIdAccess::fromStructureStubInfo):
(JSC::GetByIdAccess::visitWeak):
(JSC::PolymorphicGetByIdList::didSelfPatching):
(JSC::PolymorphicGetByIdList::visitWeak):

  • bytecode/PolymorphicGetByIdList.h:

(JSC::GetByIdAccess::doesCalls):

  • bytecode/PolymorphicPutByIdList.cpp:

(JSC::PutByIdAccess::fromStructureStubInfo):
(JSC::PutByIdAccess::visitWeak):
(JSC::PolymorphicPutByIdList::addAccess):
(JSC::PolymorphicPutByIdList::visitWeak):

  • bytecode/PolymorphicPutByIdList.h:

(JSC::PutByIdAccess::customSetter):
(JSC::PolymorphicPutByIdList::kind):

  • bytecode/StructureStubInfo.cpp:

(JSC::StructureStubInfo::deref):
(JSC::StructureStubInfo::visitWeakReferences):

  • bytecode/StructureStubInfo.h:

(JSC::StructureStubInfo::seenOnce):

  • dfg/DFGOSRExitCompiler.cpp:
  • ftl/FTLCompile.cpp:

(JSC::FTL::mmAllocateDataSection):

  • ftl/FTLOSRExitCompiler.cpp:

(JSC::FTL::compileFTLOSRExit):

  • jit/AccessorCallJITStubRoutine.cpp:

(JSC::AccessorCallJITStubRoutine::~AccessorCallJITStubRoutine):
(JSC::AccessorCallJITStubRoutine::visitWeak):

  • jit/AccessorCallJITStubRoutine.h:
  • jit/JIT.cpp:

(JSC::ctiPatchCallByReturnAddress):
(JSC::JIT::JIT):
(JSC::ctiPatchNearCallByReturnAddress): Deleted.

  • jit/JIT.h:
  • jit/JITCall.cpp:
  • jit/JITOpcodes.cpp:

(JSC::JIT::privateCompileHasIndexedProperty):
(JSC::JIT::emit_op_has_indexed_property):

  • jit/JITOperations.cpp:

(JSC::getByVal):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::privateCompileGetByVal):
(JSC::JIT::privateCompileGetByValWithCachedId):
(JSC::JIT::privateCompilePutByVal):
(JSC::JIT::privateCompilePutByValWithCachedId):

  • jit/JITPropertyAccess32_64.cpp:
  • jit/JITStubRoutine.cpp:

(JSC::JITStubRoutine::~JITStubRoutine):
(JSC::JITStubRoutine::visitWeak):

  • jit/JITStubRoutine.h:
  • jit/PolymorphicCallStubRoutine.cpp:

(JSC::PolymorphicCallNode::~PolymorphicCallNode):
(JSC::PolymorphicCallNode::unlink):
(JSC::PolymorphicCallStubRoutine::clearCallNodesFor):
(JSC::PolymorphicCallStubRoutine::visitWeak):

  • jit/PolymorphicCallStubRoutine.h:

(JSC::PolymorphicCallNode::hasCallLinkInfo):

  • jit/Repatch.cpp:

(JSC::readCallTarget):
(JSC::repatchCall):
(JSC::repatchByIdSelfAccess):
(JSC::checkObjectPropertyConditions):
(JSC::replaceWithJump):
(JSC::tryCacheGetByID):
(JSC::repatchGetByID):
(JSC::patchJumpToGetByIdStub):
(JSC::tryBuildGetByIDList):
(JSC::tryCachePutByID):
(JSC::tryBuildPutByIdList):
(JSC::tryRepatchIn):
(JSC::repatchIn):
(JSC::linkSlowFor):
(JSC::linkFor):
(JSC::revertCall):
(JSC::unlinkFor):
(JSC::linkVirtualFor):
(JSC::linkPolymorphicCall):
(JSC::resetGetByID):
(JSC::resetPutByID):
(JSC::resetIn):

  • jit/Repatch.h:
Location:
trunk/Source/JavaScriptCore
Files:
1 deleted
39 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r189284 r189288  
     12015-09-03  Filip Pizlo  <fpizlo@apple.com>
     2
     3        Get rid of RepatchBuffer and replace it with static functions
     4        https://bugs.webkit.org/show_bug.cgi?id=148742
     5
     6        Reviewed by Geoffrey Garen and Mark Lam.
     7
     8        RepatchBuffer is an object that doesn't have any state. All of its instance methods are
     9        just wrappers for methods on MacroAssembler. So, we should make those MacroAssembler
     10        methods public and call them directly.
     11
     12        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
     13        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
     14        * JavaScriptCore.xcodeproj/project.pbxproj:
     15        * assembler/AbstractMacroAssembler.h:
     16        (JSC::AbstractMacroAssembler::linkJump):
     17        (JSC::AbstractMacroAssembler::linkPointer):
     18        (JSC::AbstractMacroAssembler::getLinkerAddress):
     19        (JSC::AbstractMacroAssembler::getLinkerCallReturnOffset):
     20        (JSC::AbstractMacroAssembler::repatchJump):
     21        (JSC::AbstractMacroAssembler::repatchNearCall):
     22        (JSC::AbstractMacroAssembler::repatchCompact):
     23        (JSC::AbstractMacroAssembler::repatchInt32):
     24        (JSC::AbstractMacroAssembler::repatchPointer):
     25        (JSC::AbstractMacroAssembler::readPointer):
     26        (JSC::AbstractMacroAssembler::replaceWithLoad):
     27        (JSC::AbstractMacroAssembler::replaceWithAddressComputation):
     28        (JSC::AbstractMacroAssembler::AbstractMacroAssembler):
     29        * assembler/MacroAssemblerARM64.h:
     30        (JSC::MacroAssemblerARM64::revertJumpReplacementToPatchableBranch32WithPatch):
     31        (JSC::MacroAssemblerARM64::repatchCall):
     32        (JSC::MacroAssemblerARM64::makeBranch):
     33        (JSC::MacroAssemblerARM64::linkCall):
     34        * assembler/MacroAssemblerARMv7.h:
     35        (JSC::MacroAssemblerARMv7::revertJumpReplacementToPatchableBranch32WithPatch):
     36        (JSC::MacroAssemblerARMv7::repatchCall):
     37        (JSC::MacroAssemblerARMv7::linkCall):
     38        (JSC::MacroAssemblerARMv7::trustedImm32FromPtr):
     39        * assembler/MacroAssemblerX86.h:
     40        (JSC::MacroAssemblerX86::revertJumpReplacementToPatchableBranch32WithPatch):
     41        (JSC::MacroAssemblerX86::repatchCall):
     42        (JSC::MacroAssemblerX86::linkCall):
     43        * assembler/MacroAssemblerX86_64.h:
     44        (JSC::MacroAssemblerX86_64::revertJumpReplacementToBranchPtrWithPatch):
     45        (JSC::MacroAssemblerX86_64::repatchCall):
     46        (JSC::MacroAssemblerX86_64::linkCall):
     47        * assembler/RepatchBuffer.h: Removed.
     48        * bytecode/CallLinkInfo.cpp:
     49        (JSC::CallLinkInfo::clearStub):
     50        (JSC::CallLinkInfo::unlink):
     51        (JSC::CallLinkInfo::visitWeak):
     52        * bytecode/CallLinkInfo.h:
     53        (JSC::CallLinkInfo::registerPreservationMode):
     54        (JSC::CallLinkInfo::isLinked):
     55        (JSC::CallLinkInfo::setUpCall):
     56        (JSC::CallLinkInfo::codeOrigin):
     57        * bytecode/CodeBlock.cpp:
     58        (JSC::CodeBlock::finalizeUnconditionally):
     59        (JSC::CodeBlock::resetStub):
     60        (JSC::CodeBlock::resetStubInternal):
     61        (JSC::CodeBlock::resetStubDuringGCInternal):
     62        (JSC::CodeBlock::unlinkIncomingCalls):
     63        * bytecode/CodeBlock.h:
     64        * bytecode/PolymorphicGetByIdList.cpp:
     65        (JSC::GetByIdAccess::fromStructureStubInfo):
     66        (JSC::GetByIdAccess::visitWeak):
     67        (JSC::PolymorphicGetByIdList::didSelfPatching):
     68        (JSC::PolymorphicGetByIdList::visitWeak):
     69        * bytecode/PolymorphicGetByIdList.h:
     70        (JSC::GetByIdAccess::doesCalls):
     71        * bytecode/PolymorphicPutByIdList.cpp:
     72        (JSC::PutByIdAccess::fromStructureStubInfo):
     73        (JSC::PutByIdAccess::visitWeak):
     74        (JSC::PolymorphicPutByIdList::addAccess):
     75        (JSC::PolymorphicPutByIdList::visitWeak):
     76        * bytecode/PolymorphicPutByIdList.h:
     77        (JSC::PutByIdAccess::customSetter):
     78        (JSC::PolymorphicPutByIdList::kind):
     79        * bytecode/StructureStubInfo.cpp:
     80        (JSC::StructureStubInfo::deref):
     81        (JSC::StructureStubInfo::visitWeakReferences):
     82        * bytecode/StructureStubInfo.h:
     83        (JSC::StructureStubInfo::seenOnce):
     84        * dfg/DFGOSRExitCompiler.cpp:
     85        * ftl/FTLCompile.cpp:
     86        (JSC::FTL::mmAllocateDataSection):
     87        * ftl/FTLOSRExitCompiler.cpp:
     88        (JSC::FTL::compileFTLOSRExit):
     89        * jit/AccessorCallJITStubRoutine.cpp:
     90        (JSC::AccessorCallJITStubRoutine::~AccessorCallJITStubRoutine):
     91        (JSC::AccessorCallJITStubRoutine::visitWeak):
     92        * jit/AccessorCallJITStubRoutine.h:
     93        * jit/JIT.cpp:
     94        (JSC::ctiPatchCallByReturnAddress):
     95        (JSC::JIT::JIT):
     96        (JSC::ctiPatchNearCallByReturnAddress): Deleted.
     97        * jit/JIT.h:
     98        * jit/JITCall.cpp:
     99        * jit/JITOpcodes.cpp:
     100        (JSC::JIT::privateCompileHasIndexedProperty):
     101        (JSC::JIT::emit_op_has_indexed_property):
     102        * jit/JITOperations.cpp:
     103        (JSC::getByVal):
     104        * jit/JITPropertyAccess.cpp:
     105        (JSC::JIT::privateCompileGetByVal):
     106        (JSC::JIT::privateCompileGetByValWithCachedId):
     107        (JSC::JIT::privateCompilePutByVal):
     108        (JSC::JIT::privateCompilePutByValWithCachedId):
     109        * jit/JITPropertyAccess32_64.cpp:
     110        * jit/JITStubRoutine.cpp:
     111        (JSC::JITStubRoutine::~JITStubRoutine):
     112        (JSC::JITStubRoutine::visitWeak):
     113        * jit/JITStubRoutine.h:
     114        * jit/PolymorphicCallStubRoutine.cpp:
     115        (JSC::PolymorphicCallNode::~PolymorphicCallNode):
     116        (JSC::PolymorphicCallNode::unlink):
     117        (JSC::PolymorphicCallStubRoutine::clearCallNodesFor):
     118        (JSC::PolymorphicCallStubRoutine::visitWeak):
     119        * jit/PolymorphicCallStubRoutine.h:
     120        (JSC::PolymorphicCallNode::hasCallLinkInfo):
     121        * jit/Repatch.cpp:
     122        (JSC::readCallTarget):
     123        (JSC::repatchCall):
     124        (JSC::repatchByIdSelfAccess):
     125        (JSC::checkObjectPropertyConditions):
     126        (JSC::replaceWithJump):
     127        (JSC::tryCacheGetByID):
     128        (JSC::repatchGetByID):
     129        (JSC::patchJumpToGetByIdStub):
     130        (JSC::tryBuildGetByIDList):
     131        (JSC::tryCachePutByID):
     132        (JSC::tryBuildPutByIdList):
     133        (JSC::tryRepatchIn):
     134        (JSC::repatchIn):
     135        (JSC::linkSlowFor):
     136        (JSC::linkFor):
     137        (JSC::revertCall):
     138        (JSC::unlinkFor):
     139        (JSC::linkVirtualFor):
     140        (JSC::linkPolymorphicCall):
     141        (JSC::resetGetByID):
     142        (JSC::resetPutByID):
     143        (JSC::resetIn):
     144        * jit/Repatch.h:
     145
    11462015-09-03  Sukolsak Sakshuwong  <sukolsak@gmail.com>
    2147
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj

    r189284 r189288  
    1 <?xml version="1.0" encoding="utf-8"?>
     1<?xml version="1.0" encoding="utf-8"?>
    22<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    33  <ItemGroup Label="ProjectConfigurations">
     
    994994    <ClInclude Include="..\assembler\MacroAssemblerX86_64.h" />
    995995    <ClInclude Include="..\assembler\MaxFrameExtentForSlowPathCall.h" />
    996     <ClInclude Include="..\assembler\RepatchBuffer.h" />
    997996    <ClInclude Include="..\assembler\X86Assembler.h" />
    998997    <ClInclude Include="..\bindings\ScriptFunctionCall.h" />
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters

    r189284 r189288  
    1 <?xml version="1.0" encoding="utf-8"?>
     1<?xml version="1.0" encoding="utf-8"?>
    22<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    33  <ItemGroup>
     
    20022002      <Filter>assembler</Filter>
    20032003    </ClInclude>
    2004     <ClInclude Include="..\assembler\RepatchBuffer.h">
    2005       <Filter>assembler</Filter>
    2006     </ClInclude>
    20072004    <ClInclude Include="..\assembler\X86Assembler.h">
    20082005      <Filter>assembler</Filter>
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r189284 r189288  
    11161116                86D3B2C610156BDE002865E7 /* MacroAssemblerARM.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B2C210156BDE002865E7 /* MacroAssemblerARM.h */; settings = {ATTRIBUTES = (Private, ); }; };
    11171117                86D3B3C310159D7F002865E7 /* LinkBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B3C110159D7F002865E7 /* LinkBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
    1118                 86D3B3C410159D7F002865E7 /* RepatchBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B3C210159D7F002865E7 /* RepatchBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
    11191118                86DB64640F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86DB64630F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp */; };
    11201119                86E116B10FE75AC800B512BC /* CodeLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E116B00FE75AC800B512BC /* CodeLocation.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    29642963                86D3B2C210156BDE002865E7 /* MacroAssemblerARM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerARM.h; sourceTree = "<group>"; };
    29652964                86D3B3C110159D7F002865E7 /* LinkBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkBuffer.h; sourceTree = "<group>"; };
    2966                 86D3B3C210159D7F002865E7 /* RepatchBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RepatchBuffer.h; sourceTree = "<group>"; };
    29672965                86DB64630F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExecutableAllocatorFixedVMPool.cpp; sourceTree = "<group>"; };
    29682966                86E116B00FE75AC800B512BC /* CodeLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeLocation.h; sourceTree = "<group>"; };
     
    54945492                                65860177185A8F5E00030EEE /* MaxFrameExtentForSlowPathCall.h */,
    54955493                                86C568DF11A213EE0007F7F0 /* MIPSAssembler.h */,
    5496                                 86D3B3C210159D7F002865E7 /* RepatchBuffer.h */,
    54975494                                86AE64A7135E5E1C00963012 /* SH4Assembler.h */,
    54985495                                9688CB140ED12B4E001D649F /* X86Assembler.h */,
     
    67396736                                A5BA15ED182340B400A82E69 /* RemoteInspectorXPCConnection.h in Headers */,
    67406737                                0F24E55117EE274900ABB217 /* Repatch.h in Headers */,
    6741                                 86D3B3C410159D7F002865E7 /* RepatchBuffer.h in Headers */,
    67426738                                869EBCB70E8C6D4A008722CC /* ResultType.h in Headers */,
    67436739                                C22B31B9140577D700DB475A /* SamplingCounter.h in Headers */,
  • trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h

    r189130 r189288  
    936936    AssemblerType m_assembler;
    937937   
     938    static void linkJump(void* code, Jump jump, CodeLocationLabel target)
     939    {
     940        AssemblerType::linkJump(code, jump.m_label, target.dataLocation());
     941    }
     942
     943    static void linkPointer(void* code, AssemblerLabel label, void* value)
     944    {
     945        AssemblerType::linkPointer(code, label, value);
     946    }
     947
     948    static void* getLinkerAddress(void* code, AssemblerLabel label)
     949    {
     950        return AssemblerType::getRelocatedAddress(code, label);
     951    }
     952
     953    static unsigned getLinkerCallReturnOffset(Call call)
     954    {
     955        return AssemblerType::getCallReturnOffset(call.m_label);
     956    }
     957
     958    static void repatchJump(CodeLocationJump jump, CodeLocationLabel destination)
     959    {
     960        AssemblerType::relinkJump(jump.dataLocation(), destination.dataLocation());
     961    }
     962
     963    static void repatchNearCall(CodeLocationNearCall nearCall, CodeLocationLabel destination)
     964    {
     965        AssemblerType::relinkCall(nearCall.dataLocation(), destination.executableAddress());
     966    }
     967
     968    static void repatchCompact(CodeLocationDataLabelCompact dataLabelCompact, int32_t value)
     969    {
     970        AssemblerType::repatchCompact(dataLabelCompact.dataLocation(), value);
     971    }
     972   
     973    static void repatchInt32(CodeLocationDataLabel32 dataLabel32, int32_t value)
     974    {
     975        AssemblerType::repatchInt32(dataLabel32.dataLocation(), value);
     976    }
     977
     978    static void repatchPointer(CodeLocationDataLabelPtr dataLabelPtr, void* value)
     979    {
     980        AssemblerType::repatchPointer(dataLabelPtr.dataLocation(), value);
     981    }
     982   
     983    static void* readPointer(CodeLocationDataLabelPtr dataLabelPtr)
     984    {
     985        return AssemblerType::readPointer(dataLabelPtr.dataLocation());
     986    }
     987   
     988    static void replaceWithLoad(CodeLocationConvertibleLoad label)
     989    {
     990        AssemblerType::replaceWithLoad(label.dataLocation());
     991    }
     992   
     993    static void replaceWithAddressComputation(CodeLocationConvertibleLoad label)
     994    {
     995        AssemblerType::replaceWithAddressComputation(label.dataLocation());
     996    }
     997
    938998protected:
    939999    AbstractMacroAssembler()
     
    10321092
    10331093    friend class LinkBuffer;
    1034     friend class RepatchBuffer;
    1035 
    1036     static void linkJump(void* code, Jump jump, CodeLocationLabel target)
    1037     {
    1038         AssemblerType::linkJump(code, jump.m_label, target.dataLocation());
    1039     }
    1040 
    1041     static void linkPointer(void* code, AssemblerLabel label, void* value)
    1042     {
    1043         AssemblerType::linkPointer(code, label, value);
    1044     }
    1045 
    1046     static void* getLinkerAddress(void* code, AssemblerLabel label)
    1047     {
    1048         return AssemblerType::getRelocatedAddress(code, label);
    1049     }
    1050 
    1051     static unsigned getLinkerCallReturnOffset(Call call)
    1052     {
    1053         return AssemblerType::getCallReturnOffset(call.m_label);
    1054     }
    1055 
    1056     static void repatchJump(CodeLocationJump jump, CodeLocationLabel destination)
    1057     {
    1058         AssemblerType::relinkJump(jump.dataLocation(), destination.dataLocation());
    1059     }
    1060 
    1061     static void repatchNearCall(CodeLocationNearCall nearCall, CodeLocationLabel destination)
    1062     {
    1063         AssemblerType::relinkCall(nearCall.dataLocation(), destination.executableAddress());
    1064     }
    1065 
    1066     static void repatchCompact(CodeLocationDataLabelCompact dataLabelCompact, int32_t value)
    1067     {
    1068         AssemblerType::repatchCompact(dataLabelCompact.dataLocation(), value);
    1069     }
    1070    
    1071     static void repatchInt32(CodeLocationDataLabel32 dataLabel32, int32_t value)
    1072     {
    1073         AssemblerType::repatchInt32(dataLabel32.dataLocation(), value);
    1074     }
    1075 
    1076     static void repatchPointer(CodeLocationDataLabelPtr dataLabelPtr, void* value)
    1077     {
    1078         AssemblerType::repatchPointer(dataLabelPtr.dataLocation(), value);
    1079     }
    1080    
    1081     static void* readPointer(CodeLocationDataLabelPtr dataLabelPtr)
    1082     {
    1083         return AssemblerType::readPointer(dataLabelPtr.dataLocation());
    1084     }
    1085    
    1086     static void replaceWithLoad(CodeLocationConvertibleLoad label)
    1087     {
    1088         AssemblerType::replaceWithLoad(label.dataLocation());
    1089     }
    1090    
    1091     static void replaceWithAddressComputation(CodeLocationConvertibleLoad label)
    1092     {
    1093         AssemblerType::replaceWithAddressComputation(label.dataLocation());
    1094     }
    10951094
    10961095private:
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h

    r188135 r189288  
    25072507    }
    25082508
     2509    static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
     2510    {
     2511        ARM64Assembler::repatchPointer(call.dataLabelPtrAtOffset(REPATCH_OFFSET_CALL_TO_POINTER).dataLocation(), destination.executableAddress());
     2512    }
     2513
     2514    static void repatchCall(CodeLocationCall call, FunctionPtr destination)
     2515    {
     2516        ARM64Assembler::repatchPointer(call.dataLabelPtrAtOffset(REPATCH_OFFSET_CALL_TO_POINTER).dataLocation(), destination.executableAddress());
     2517    }
     2518
    25092519protected:
    25102520    ALWAYS_INLINE Jump makeBranch(ARM64Assembler::Condition cond)
     
    28792889    }
    28802890
    2881     static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
    2882     {
    2883         ARM64Assembler::repatchPointer(call.dataLabelPtrAtOffset(REPATCH_OFFSET_CALL_TO_POINTER).dataLocation(), destination.executableAddress());
    2884     }
    2885 
    2886     static void repatchCall(CodeLocationCall call, FunctionPtr destination)
    2887     {
    2888         ARM64Assembler::repatchPointer(call.dataLabelPtrAtOffset(REPATCH_OFFSET_CALL_TO_POINTER).dataLocation(), destination.executableAddress());
    2889     }
    2890 
    28912891    CachedTempRegister m_dataMemoryTempRegister;
    28922892    CachedTempRegister m_cachedMemoryTempRegister;
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h

    r189148 r189288  
    19021902    }
    19031903
     1904    static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
     1905    {
     1906        ARMv7Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
     1907    }
     1908
     1909    static void repatchCall(CodeLocationCall call, FunctionPtr destination)
     1910    {
     1911        ARMv7Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
     1912    }
     1913
    19041914#if ENABLE(MASM_PROBE)
    19051915    void probe(ProbeFunction, void* arg1 = 0, void* arg2 = 0);
     
    20062016    }
    20072017
    2008     static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
    2009     {
    2010         ARMv7Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
    2011     }
    2012 
    2013     static void repatchCall(CodeLocationCall call, FunctionPtr destination)
    2014     {
    2015         ARMv7Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
    2016     }
    2017 
    20182018#if ENABLE(MASM_PROBE)
    20192019    inline TrustedImm32 trustedImm32FromPtr(void* ptr)
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86.h

    r176134 r189288  
    346346    }
    347347
     348    static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
     349    {
     350        X86Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
     351    }
     352
     353    static void repatchCall(CodeLocationCall call, FunctionPtr destination)
     354    {
     355        X86Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
     356    }
     357
    348358private:
    349359    friend class LinkBuffer;
     
    354364        X86Assembler::linkCall(code, call.m_label, function.value());
    355365    }
    356 
    357     static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
    358     {
    359         X86Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
    360     }
    361 
    362     static void repatchCall(CodeLocationCall call, FunctionPtr destination)
    363     {
    364         X86Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
    365     }
    366366};
    367367
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h

    r188888 r189288  
    855855    }
    856856
     857    static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
     858    {
     859        X86Assembler::repatchPointer(call.dataLabelPtrAtOffset(-REPATCH_OFFSET_CALL_R11).dataLocation(), destination.executableAddress());
     860    }
     861
     862    static void repatchCall(CodeLocationCall call, FunctionPtr destination)
     863    {
     864        X86Assembler::repatchPointer(call.dataLabelPtrAtOffset(-REPATCH_OFFSET_CALL_R11).dataLocation(), destination.executableAddress());
     865    }
     866
    857867private:
    858868    friend class LinkBuffer;
     
    866876            X86Assembler::linkCall(code, call.m_label, function.value());
    867877    }
    868 
    869     static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
    870     {
    871         X86Assembler::repatchPointer(call.dataLabelPtrAtOffset(-REPATCH_OFFSET_CALL_R11).dataLocation(), destination.executableAddress());
    872     }
    873 
    874     static void repatchCall(CodeLocationCall call, FunctionPtr destination)
    875     {
    876         X86Assembler::repatchPointer(call.dataLabelPtrAtOffset(-REPATCH_OFFSET_CALL_R11).dataLocation(), destination.executableAddress());
    877     }
    878878};
    879879
  • trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp

    r189278 r189288  
    3131#include "JSCInlines.h"
    3232#include "Repatch.h"
    33 #include "RepatchBuffer.h"
    3433#include <wtf/ListDump.h>
    3534#include <wtf/NeverDestroyed.h>
     
    4746}
    4847
    49 void CallLinkInfo::unlink(VM& vm, RepatchBuffer& repatchBuffer)
     48void CallLinkInfo::unlink(VM& vm)
    5049{
    5150    if (!isLinked()) {
     
    5655    }
    5756   
    58     unlinkFor(vm, repatchBuffer, *this);
     57    unlinkFor(vm, *this);
    5958
    6059    // It will be on a list if the callee has a code block.
     
    6362}
    6463
    65 void CallLinkInfo::visitWeak(VM& vm, RepatchBuffer& repatchBuffer)
     64void CallLinkInfo::visitWeak(VM& vm)
    6665{
    6766    auto handleSpecificCallee = [&] (JSFunction* callee) {
     
    7473    if (isLinked()) {
    7574        if (stub()) {
    76             if (!stub()->visitWeak(vm, repatchBuffer)) {
     75            if (!stub()->visitWeak(vm)) {
    7776                if (Options::verboseOSR()) {
    7877                    dataLog(
     
    8180                        ".\n");
    8281                }
    83                 unlink(vm, repatchBuffer);
     82                unlink(vm);
    8483                m_clearedByGC = true;
    8584            }
     
    9392            }
    9493            handleSpecificCallee(m_callee.get());
    95             unlink(vm, repatchBuffer);
     94            unlink(vm);
    9695        }
    9796    }
  • trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.h

    r189278 r189288  
    4040#if ENABLE(JIT)
    4141
    42 class RepatchBuffer;
    43 
    4442class CallLinkInfo : public BasicRawSentinelNode<CallLinkInfo> {
    4543public:
     
    9189
    9290    bool isLinked() { return m_stub || m_callee; }
    93     void unlink(VM&, RepatchBuffer&);
     91    void unlink(VM&);
    9492
    9593    void setUpCall(CallType callType, CodeOrigin codeOrigin, unsigned calleeGPR)
     
    279277    }
    280278
    281     void visitWeak(VM&, RepatchBuffer&);
     279    void visitWeak(VM&);
    282280
    283281private:
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r189279 r189288  
    5858#include "ReduceWhitespace.h"
    5959#include "Repatch.h"
    60 #include "RepatchBuffer.h"
    6160#include "SlotVisitorInlines.h"
    6261#include "StackVisitor.h"
     
    26872686    // Handle inline caches.
    26882687    if (!!jitCode()) {
    2689         RepatchBuffer repatchBuffer(this);
    2690        
    26912688        for (auto iter = callLinkInfosBegin(); !!iter; ++iter)
    2692             (*iter)->visitWeak(*vm(), repatchBuffer);
     2689            (*iter)->visitWeak(*vm());
    26932690
    26942691        for (Bag<StructureStubInfo>::iterator iter = m_stubInfos.begin(); !!iter; ++iter) {
    26952692            StructureStubInfo& stubInfo = **iter;
    26962693           
    2697             if (stubInfo.visitWeakReferences(*vm(), repatchBuffer))
     2694            if (stubInfo.visitWeakReferences(*vm()))
    26982695                continue;
    26992696           
    2700             resetStubDuringGCInternal(repatchBuffer, stubInfo);
     2697            resetStubDuringGCInternal(stubInfo);
    27012698        }
    27022699    }
     
    27852782    ConcurrentJITLocker locker(m_lock);
    27862783   
    2787     RepatchBuffer repatchBuffer(this);
    2788     resetStubInternal(repatchBuffer, stubInfo);
    2789 }
    2790 
    2791 void CodeBlock::resetStubInternal(RepatchBuffer& repatchBuffer, StructureStubInfo& stubInfo)
     2784    resetStubInternal(stubInfo);
     2785}
     2786
     2787void CodeBlock::resetStubInternal(StructureStubInfo& stubInfo)
    27922788{
    27932789    AccessType accessType = static_cast<AccessType>(stubInfo.accessType);
     
    28022798   
    28032799    if (isGetByIdAccess(accessType))
    2804         resetGetByID(repatchBuffer, this, stubInfo);
     2800        resetGetByID(this, stubInfo);
    28052801    else if (isPutByIdAccess(accessType))
    2806         resetPutByID(repatchBuffer, this, stubInfo);
     2802        resetPutByID(this, stubInfo);
    28072803    else {
    28082804        RELEASE_ASSERT(isInAccess(accessType));
    2809         resetIn(repatchBuffer, this, stubInfo);
     2805        resetIn(this, stubInfo);
    28102806    }
    28112807   
     
    28132809}
    28142810
    2815 void CodeBlock::resetStubDuringGCInternal(RepatchBuffer& repatchBuffer, StructureStubInfo& stubInfo)
    2816 {
    2817     resetStubInternal(repatchBuffer, stubInfo);
     2811void CodeBlock::resetStubDuringGCInternal(StructureStubInfo& stubInfo)
     2812{
     2813    resetStubInternal(stubInfo);
    28182814    stubInfo.resetByGC = true;
    28192815}
     
    30373033    if (m_incomingCalls.isEmpty() && m_incomingPolymorphicCalls.isEmpty())
    30383034        return;
    3039     RepatchBuffer repatchBuffer(this);
    30403035    while (m_incomingCalls.begin() != m_incomingCalls.end())
    3041         m_incomingCalls.begin()->unlink(*vm(), repatchBuffer);
     3036        m_incomingCalls.begin()->unlink(*vm());
    30423037    while (m_incomingPolymorphicCalls.begin() != m_incomingPolymorphicCalls.end())
    3043         m_incomingPolymorphicCalls.begin()->unlink(*vm(), repatchBuffer);
     3038        m_incomingPolymorphicCalls.begin()->unlink(*vm());
    30443039#endif // ENABLE(JIT)
    30453040}
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.h

    r189257 r189288  
    8181class ExecState;
    8282class LLIntOffsetsExtractor;
    83 class RepatchBuffer;
    8483class TypeLocation;
    8584
     
    983982
    984983#if ENABLE(JIT)
    985     void resetStubInternal(RepatchBuffer&, StructureStubInfo&);
    986     void resetStubDuringGCInternal(RepatchBuffer&, StructureStubInfo&);
     984    void resetStubInternal(StructureStubInfo&);
     985    void resetStubDuringGCInternal(StructureStubInfo&);
    987986#endif
    988987    WriteBarrier<UnlinkedCodeBlock> m_unlinkedCode;
  • trunk/Source/JavaScriptCore/bytecode/PolymorphicGetByIdList.cpp

    r189278 r189288  
    6666}
    6767
    68 bool GetByIdAccess::visitWeak(VM& vm, RepatchBuffer& repatchBuffer) const
     68bool GetByIdAccess::visitWeak(VM& vm) const
    6969{
    7070    if (m_structure && !Heap::isMarked(m_structure.get()))
     
    7272    if (!m_conditionSet.areStillLive())
    7373        return false;
    74     if (!m_stubRoutine->visitWeak(vm, repatchBuffer))
     74    if (!m_stubRoutine->visitWeak(vm))
    7575        return false;
    7676    return true;
     
    140140}
    141141
    142 bool PolymorphicGetByIdList::visitWeak(VM& vm, RepatchBuffer& repatchBuffer) const
     142bool PolymorphicGetByIdList::visitWeak(VM& vm) const
    143143{
    144144    for (unsigned i = size(); i--;) {
    145         if (!at(i).visitWeak(vm, repatchBuffer))
     145        if (!at(i).visitWeak(vm))
    146146            return false;
    147147    }
  • trunk/Source/JavaScriptCore/bytecode/PolymorphicGetByIdList.h

    r189278 r189288  
    8383    bool doesCalls() const { return type() == Getter || type() == CustomGetter; }
    8484   
    85     bool visitWeak(VM&, RepatchBuffer&) const;
     85    bool visitWeak(VM&) const;
    8686
    8787private:
     
    116116    bool didSelfPatching() const; // Are any of the accesses SimpleInline?
    117117   
    118     bool visitWeak(VM&, RepatchBuffer&) const;
     118    bool visitWeak(VM&) const;
    119119
    120120private:
  • trunk/Source/JavaScriptCore/bytecode/PolymorphicPutByIdList.cpp

    r189278 r189288  
    6464}
    6565
    66 bool PutByIdAccess::visitWeak(VM& vm, RepatchBuffer& repatchBuffer) const
     66bool PutByIdAccess::visitWeak(VM& vm) const
    6767{
    6868    if (!m_conditionSet.areStillLive())
     
    8989        return false;
    9090    }
    91     if (!m_stubRoutine->visitWeak(vm, repatchBuffer))
     91    if (!m_stubRoutine->visitWeak(vm))
    9292        return false;
    9393    return true;
     
    143143}
    144144
    145 bool PolymorphicPutByIdList::visitWeak(VM& vm, RepatchBuffer& repatchBuffer) const
     145bool PolymorphicPutByIdList::visitWeak(VM& vm) const
    146146{
    147147    for (unsigned i = 0; i < size(); ++i) {
    148         if (!at(i).visitWeak(vm, repatchBuffer))
     148        if (!at(i).visitWeak(vm))
    149149            return false;
    150150    }
  • trunk/Source/JavaScriptCore/bytecode/PolymorphicPutByIdList.h

    r189278 r189288  
    157157    }
    158158
    159     bool visitWeak(VM&, RepatchBuffer&) const;
     159    bool visitWeak(VM&) const;
    160160   
    161161private:
     
    195195    PutKind kind() const { return m_kind; }
    196196   
    197     bool visitWeak(VM&, RepatchBuffer&) const;
     197    bool visitWeak(VM&) const;
    198198   
    199199private:
  • trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp

    r189278 r189288  
    6464}
    6565
    66 bool StructureStubInfo::visitWeakReferences(VM& vm, RepatchBuffer& repatchBuffer)
     66bool StructureStubInfo::visitWeakReferences(VM& vm)
    6767{
    6868    switch (accessType) {
     
    7272        break;
    7373    case access_get_by_id_list: {
    74         if (!u.getByIdList.list->visitWeak(vm, repatchBuffer))
     74        if (!u.getByIdList.list->visitWeak(vm))
    7575            return false;
    7676        break;
     
    8989        break;
    9090    case access_put_by_id_list:
    91         if (!u.putByIdList.list->visitWeak(vm, repatchBuffer))
     91        if (!u.putByIdList.list->visitWeak(vm))
    9292            return false;
    9393        break;
  • trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.h

    r189278 r189288  
    166166    // allowed to accomplish this by either clearing those pointers somehow or by proving that
    167167    // they have already been marked. It is not allowed to mark new objects.
    168     bool visitWeakReferences(VM&, RepatchBuffer&);
     168    bool visitWeakReferences(VM&);
    169169       
    170170    bool seenOnce()
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompiler.cpp

    r181993 r189288  
    3636#include "OperandsInlines.h"
    3737#include "JSCInlines.h"
    38 #include "RepatchBuffer.h"
    3938#include <wtf/StringPrintStream.h>
    4039
     
    168167    }
    169168   
    170     {
    171         RepatchBuffer repatchBuffer(codeBlock);
    172         repatchBuffer.relink(exit.codeLocationForRepatch(codeBlock), CodeLocationLabel(exit.m_code.code()));
    173     }
     169    MacroAssembler::repatchJump(exit.codeLocationForRepatch(codeBlock), CodeLocationLabel(exit.m_code.code()));
    174170   
    175171    vm->osrExitJumpDestination = exit.m_code.code().executableAddress();
  • trunk/Source/JavaScriptCore/ftl/FTLCompile.cpp

    r188932 r189288  
    4545#include "LLVMAPI.h"
    4646#include "LinkBuffer.h"
    47 #include "RepatchBuffer.h"
    4847
    4948namespace JSC { namespace FTL {
     
    620619    }
    621620   
    622     RepatchBuffer repatchBuffer(codeBlock);
    623 
    624621    auto iter = recordMap.find(state.handleStackOverflowExceptionStackmapID);
    625622    // It's sort of remotely possible that we won't have an in-band exception handling
     
    634631            RELEASE_ASSERT(stackOverflowException.isSet());
    635632
    636             repatchBuffer.replaceWithJump(source, state.finalizer->handleExceptionsLinkBuffer->locationOf(stackOverflowException));
     633            MacroAssembler::replaceWithJump(source, state.finalizer->handleExceptionsLinkBuffer->locationOf(stackOverflowException));
    637634        }
    638635    }
     
    648645                bitwise_cast<char*>(generatedFunction) + record.instructionOffset);
    649646           
    650             repatchBuffer.replaceWithJump(source, state.finalizer->handleExceptionsLinkBuffer->entrypoint());
     647            MacroAssembler::replaceWithJump(source, state.finalizer->handleExceptionsLinkBuffer->entrypoint());
    651648        }
    652649    }
     
    671668                    jitCode->common.jumpReplacements.append(JumpReplacement(source, info.m_thunkAddress));
    672669                else
    673                     repatchBuffer.replaceWithJump(source, info.m_thunkAddress);
     670                    MacroAssembler::replaceWithJump(source, info.m_thunkAddress);
    674671            }
    675672        }
  • trunk/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp

    r186795 r189288  
    4242#include "JSCInlines.h"
    4343#include "RegisterPreservationWrapperGenerator.h"
    44 #include "RepatchBuffer.h"
    4544
    4645namespace JSC { namespace FTL {
     
    524523    compileStub(exitID, jitCode, exit, vm, codeBlock);
    525524   
    526     RepatchBuffer repatchBuffer(codeBlock);
    527     repatchBuffer.relink(
     525    MacroAssembler::repatchJump(
    528526        exit.codeLocationForRepatch(codeBlock), CodeLocationLabel(exit.m_code.code()));
    529527   
  • trunk/Source/JavaScriptCore/jit/AccessorCallJITStubRoutine.cpp

    r189278 r189288  
    4444}
    4545
    46 bool AccessorCallJITStubRoutine::visitWeak(VM& vm, RepatchBuffer& repatchBuffer)
     46bool AccessorCallJITStubRoutine::visitWeak(VM& vm)
    4747{
    48     m_callLinkInfo->visitWeak(vm, repatchBuffer);
     48    m_callLinkInfo->visitWeak(vm);
    4949    return true;
    5050}
  • trunk/Source/JavaScriptCore/jit/AccessorCallJITStubRoutine.h

    r189278 r189288  
    4545    virtual ~AccessorCallJITStubRoutine();
    4646   
    47     virtual bool visitWeak(VM&, RepatchBuffer&) override;
     47    virtual bool visitWeak(VM&) override;
    4848   
    4949    std::unique_ptr<CallLinkInfo> m_callLinkInfo;
  • trunk/Source/JavaScriptCore/jit/JIT.cpp

    r189201 r189288  
    4343#include "JSCInlines.h"
    4444#include "ProfilerDatabase.h"
    45 #include "RepatchBuffer.h"
    4645#include "ResultType.h"
    4746#include "SamplingTool.h"
     
    5554namespace JSC {
    5655
    57 void ctiPatchNearCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction)
    58 {
    59     RepatchBuffer repatchBuffer(codeblock);
    60     repatchBuffer.relinkNearCallerToTrampoline(returnAddress, newCalleeFunction);
    61 }
    62 
    63 void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction)
    64 {
    65     RepatchBuffer repatchBuffer(codeblock);
    66     repatchBuffer.relinkCallerToTrampoline(returnAddress, newCalleeFunction);
    67 }
    68 
    69 void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction)
    70 {
    71     RepatchBuffer repatchBuffer(codeblock);
    72     repatchBuffer.relinkCallerToFunction(returnAddress, newCalleeFunction);
     56void ctiPatchCallByReturnAddress(ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction)
     57{
     58    MacroAssembler::repatchCall(
     59        CodeLocationCall(MacroAssemblerCodePtr(returnAddress)),
     60        newCalleeFunction);
    7361}
    7462
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r189279 r189288  
    181181    };
    182182
    183     // Near calls can only be patched to other JIT code, regular calls can be patched to JIT code or relinked to stub functions.
    184     void ctiPatchNearCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction);
    185     void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction);
    186     void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction);
     183    void ctiPatchCallByReturnAddress(ReturnAddressPtr, FunctionPtr newCalleeFunction);
    187184
    188185    class JIT : private JSInterfaceJIT {
  • trunk/Source/JavaScriptCore/jit/JITCall.cpp

    r188932 r189288  
    3737#include "JSCInlines.h"
    3838#include "LinkBuffer.h"
    39 #include "RepatchBuffer.h"
    4039#include "ResultType.h"
    4140#include "SamplingTool.h"
  • trunk/Source/JavaScriptCore/jit/JITCall32_64.cpp

    r188932 r189288  
    3737#include "JSCInlines.h"
    3838#include "LinkBuffer.h"
    39 #include "RepatchBuffer.h"
    4039#include "ResultType.h"
    4140#include "SamplingTool.h"
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r189009 r189288  
    4242#include "LinkBuffer.h"
    4343#include "MaxFrameExtentForSlowPathCall.h"
    44 #include "RepatchBuffer.h"
    4544#include "SlowPathCall.h"
    4645#include "TypeLocation.h"
     
    10861085        ("Baseline has_indexed_property stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value()));
    10871086   
    1088     RepatchBuffer repatchBuffer(m_codeBlock);
    1089     repatchBuffer.relink(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
    1090     repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(operationHasIndexedPropertyGeneric));
     1087    MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
     1088    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationHasIndexedPropertyGeneric));
    10911089}
    10921090
  • trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp

    r188545 r189288  
    11/*
    2  * Copyright (C) 2009, 2012, 2013, 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2009, 2012, 2013, 2014, 2015 Apple Inc. All rights reserved.
    33 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
    44 *
     
    4343#include "LinkBuffer.h"
    4444#include "MaxFrameExtentForSlowPathCall.h"
    45 #include "RepatchBuffer.h"
    4645#include "SlowPathCall.h"
    4746#include "TypeProfilerLog.h"
     
    10661065        ("Baseline has_indexed_property stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value()));
    10671066   
    1068     RepatchBuffer repatchBuffer(m_codeBlock);
    1069     repatchBuffer.relink(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
    1070     repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(operationHasIndexedPropertyGeneric));
     1067    MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
     1068    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationHasIndexedPropertyGeneric));
    10711069}
    10721070
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r189279 r189288  
    5555#include "PropertyName.h"
    5656#include "Repatch.h"
    57 #include "RepatchBuffer.h"
    5857#include "ScopedArguments.h"
    5958#include "TestRunnerUtils.h"
     
    647646        // Don't ever try to optimize.
    648647        byValInfo->tookSlowPath = true;
    649         ctiPatchCallByReturnAddress(exec->codeBlock(), ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationPutByValGeneric));
     648        ctiPatchCallByReturnAddress(ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationPutByValGeneric));
    650649    }
    651650    putByVal(exec, baseValue, subscript, value, byValInfo);
     
    729728        // Don't ever try to optimize.
    730729        byValInfo->tookSlowPath = true;
    731         ctiPatchCallByReturnAddress(exec->codeBlock(), ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationDirectPutByValGeneric));
     730        ctiPatchCallByReturnAddress(ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationDirectPutByValGeneric));
    732731    }
    733732
     
    15941593        if (isJSString(baseValue)) {
    15951594            if (asString(baseValue)->canGetIndex(i)) {
    1596                 ctiPatchCallByReturnAddress(exec->codeBlock(), returnAddress, FunctionPtr(operationGetByValString));
     1595                ctiPatchCallByReturnAddress(returnAddress, FunctionPtr(operationGetByValString));
    15971596                return asString(baseValue)->getIndex(exec, i);
    15981597            }
     
    17171716        // Don't ever try to optimize.
    17181717        byValInfo->tookSlowPath = true;
    1719         ctiPatchCallByReturnAddress(exec->codeBlock(), returnAddress, FunctionPtr(operationGetByValGeneric));
     1718        ctiPatchCallByReturnAddress(returnAddress, FunctionPtr(operationGetByValGeneric));
    17201719    }
    17211720
     
    17571756            || object->structure(vm)->typeInfo().interceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero()) {
    17581757            // Don't ever try to optimize.
    1759             ctiPatchCallByReturnAddress(exec->codeBlock(), ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationHasIndexedPropertyGeneric));
     1758            ctiPatchCallByReturnAddress(ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationHasIndexedPropertyGeneric));
    17601759        }
    17611760    }
     
    18061805            if (!isJSString(baseValue)) {
    18071806                ASSERT(exec->bytecodeOffset());
    1808                 ctiPatchCallByReturnAddress(exec->codeBlock(), ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(byValInfo->stubRoutine ? operationGetByValGeneric : operationGetByValOptimize));
     1807                ctiPatchCallByReturnAddress(ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(byValInfo->stubRoutine ? operationGetByValGeneric : operationGetByValOptimize));
    18091808            }
    18101809        }
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp

    r189279 r189288  
    3939#include "JSFunction.h"
    4040#include "LinkBuffer.h"
    41 #include "RepatchBuffer.h"
    4241#include "ResultType.h"
    4342#include "SamplingTool.h"
     
    11161115        ("Baseline get_by_val stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value()));
    11171116   
    1118     RepatchBuffer repatchBuffer(m_codeBlock);
    1119     repatchBuffer.relink(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
    1120     repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(operationGetByValGeneric));
     1117    MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
     1118    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationGetByValGeneric));
    11211119}
    11221120
     
    11481146    byValInfo->stubInfo = gen.stubInfo();
    11491147
    1150     RepatchBuffer repatchBuffer(m_codeBlock);
    1151     repatchBuffer.relink(byValInfo->notIndexJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
    1152     repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(operationGetByValGeneric));
     1148    MacroAssembler::repatchJump(byValInfo->notIndexJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
     1149    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationGetByValGeneric));
    11531150}
    11541151
     
    12161213            ("Baseline put_by_val_direct stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value()));
    12171214    }
    1218     RepatchBuffer repatchBuffer(m_codeBlock);
    1219     repatchBuffer.relink(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
    1220     repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(isDirect ? operationDirectPutByValGeneric : operationPutByValGeneric));
     1215    MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
     1216    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(isDirect ? operationDirectPutByValGeneric : operationPutByValGeneric));
    12211217}
    12221218
     
    12451241    byValInfo->stubInfo = gen.stubInfo();
    12461242
    1247     RepatchBuffer repatchBuffer(m_codeBlock);
    1248     repatchBuffer.relink(byValInfo->notIndexJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
    1249     repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(putKind == Direct ? operationDirectPutByValGeneric : operationPutByValGeneric));
     1243    MacroAssembler::repatchJump(byValInfo->notIndexJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
     1244    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(putKind == Direct ? operationDirectPutByValGeneric : operationPutByValGeneric));
    12501245}
    12511246
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp

    r189279 r189288  
    3939#include "JSFunction.h"
    4040#include "LinkBuffer.h"
    41 #include "RepatchBuffer.h"
    4241#include "ResultType.h"
    4342#include "SamplingTool.h"
  • trunk/Source/JavaScriptCore/jit/JITStubRoutine.cpp

    r189278 r189288  
    3737JITStubRoutine::~JITStubRoutine() { }
    3838
    39 bool JITStubRoutine::visitWeak(VM&, RepatchBuffer&)
     39bool JITStubRoutine::visitWeak(VM&)
    4040{
    4141    return true;
  • trunk/Source/JavaScriptCore/jit/JITStubRoutine.h

    r189278 r189288  
    145145    // false, you will usually not do any clearing because the idea is that you will simply be
    146146    // destroyed.
    147     virtual bool visitWeak(VM&, RepatchBuffer&);
     147    virtual bool visitWeak(VM&);
    148148
    149149protected:
  • trunk/Source/JavaScriptCore/jit/PolymorphicCallStubRoutine.cpp

    r189278 r189288  
    4242}
    4343
    44 void PolymorphicCallNode::unlink(VM& vm, RepatchBuffer& repatchBuffer)
     44void PolymorphicCallNode::unlink(VM& vm)
    4545{
    4646    if (m_callLinkInfo) {
     
    4848            dataLog("Unlinking polymorphic call at ", m_callLinkInfo->callReturnLocation(), ", ", m_callLinkInfo->codeOrigin(), "\n");
    4949
    50         m_callLinkInfo->unlink(vm, repatchBuffer);
     50        m_callLinkInfo->unlink(vm);
    5151    }
    5252
     
    118118}
    119119
    120 bool PolymorphicCallStubRoutine::visitWeak(VM&, RepatchBuffer&)
     120bool PolymorphicCallStubRoutine::visitWeak(VM&)
    121121{
    122122    for (auto& variant : m_variants) {
  • trunk/Source/JavaScriptCore/jit/PolymorphicCallStubRoutine.h

    r189278 r189288  
    5151    ~PolymorphicCallNode();
    5252   
    53     void unlink(VM&, RepatchBuffer&);
     53    void unlink(VM&);
    5454
    5555    bool hasCallLinkInfo(CallLinkInfo* info) { return m_callLinkInfo == info; }
     
    9797    void clearCallNodesFor(CallLinkInfo*);
    9898   
    99     bool visitWeak(VM&, RepatchBuffer&) override;
     99    bool visitWeak(VM&) override;
    100100
    101101protected:
  • trunk/Source/JavaScriptCore/jit/Repatch.cpp

    r189278 r189288  
    4444#include "PolymorphicPutByIdList.h"
    4545#include "RegExpMatchesArray.h"
    46 #include "RepatchBuffer.h"
    4746#include "ScratchRegisterAllocator.h"
    4847#include "StackAlignment.h"
     
    7675}
    7776
    78 static void repatchCall(RepatchBuffer& repatchBuffer, CodeBlock* codeBlock, CodeLocationCall call, FunctionPtr newCalleeFunction)
     77static void repatchCall(CodeBlock* codeBlock, CodeLocationCall call, FunctionPtr newCalleeFunction)
    7978{
    8079#if ENABLE(FTL_JIT)
     
    9291    UNUSED_PARAM(codeBlock);
    9392#endif // ENABLE(FTL_JIT)
    94     repatchBuffer.relink(call, newCalleeFunction);
    95 }
    96 
    97 static void repatchCall(CodeBlock* codeBlock, CodeLocationCall call, FunctionPtr newCalleeFunction)
    98 {
    99     RepatchBuffer repatchBuffer(codeBlock);
    100     repatchCall(repatchBuffer, codeBlock, call, newCalleeFunction);
     93    MacroAssembler::repatchCall(call, newCalleeFunction);
    10194}
    10295
     
    109102        vm.registerWatchpointForImpureProperty(propertyName, stubInfo.addWatchpoint(codeBlock));
    110103   
    111     RepatchBuffer repatchBuffer(codeBlock);
    112 
    113104    // Only optimize once!
    114     repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, slowPathFunction);
     105    repatchCall(codeBlock, stubInfo.callReturnLocation, slowPathFunction);
    115106
    116107    // Patch the structure check & the offset of the load.
    117     repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(-(intptr_t)stubInfo.patch.deltaCheckImmToCall), bitwise_cast<int32_t>(structure->id()));
    118     repatchBuffer.setLoadInstructionIsActive(stubInfo.callReturnLocation.convertibleLoadAtOffset(stubInfo.patch.deltaCallToStorageLoad), isOutOfLineOffset(offset));
     108    MacroAssembler::repatchInt32(
     109        stubInfo.callReturnLocation.dataLabel32AtOffset(-(intptr_t)stubInfo.patch.deltaCheckImmToCall),
     110        bitwise_cast<int32_t>(structure->id()));
     111    CodeLocationConvertibleLoad convertibleLoad = stubInfo.callReturnLocation.convertibleLoadAtOffset(stubInfo.patch.deltaCallToStorageLoad);
     112    if (isOutOfLineOffset(offset))
     113        MacroAssembler::replaceWithLoad(convertibleLoad);
     114    else
     115        MacroAssembler::replaceWithAddressComputation(convertibleLoad);
    119116#if USE(JSVALUE64)
    120117    if (compact)
    121         repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToLoadOrStore), offsetRelativeToPatchedStorage(offset));
     118        MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToLoadOrStore), offsetRelativeToPatchedStorage(offset));
    122119    else
    123         repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToLoadOrStore), offsetRelativeToPatchedStorage(offset));
     120        MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToLoadOrStore), offsetRelativeToPatchedStorage(offset));
    124121#elif USE(JSVALUE32_64)
    125122    if (compact) {
    126         repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag));
    127         repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));
     123        MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag));
     124        MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));
    128125    } else {
    129         repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag));
    130         repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));
     126        MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag));
     127        MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));
    131128    }
    132129#endif
     
    162159}
    163160
    164 static void replaceWithJump(RepatchBuffer& repatchBuffer, StructureStubInfo& stubInfo, const MacroAssemblerCodePtr target)
     161static void replaceWithJump(StructureStubInfo& stubInfo, const MacroAssemblerCodePtr target)
    165162{
    166163    if (MacroAssembler::canJumpReplacePatchableBranch32WithPatch()) {
    167         repatchBuffer.replaceWithJump(
    168             RepatchBuffer::startOfPatchableBranch32WithPatchOnAddress(
     164        MacroAssembler::replaceWithJump(
     165            MacroAssembler::startOfPatchableBranch32WithPatchOnAddress(
    169166                stubInfo.callReturnLocation.dataLabel32AtOffset(
    170167                    -(intptr_t)stubInfo.patch.deltaCheckImmToCall)),
     
    173170    }
    174171   
    175     repatchBuffer.relink(
     172    MacroAssembler::repatchJump(
    176173        stubInfo.callReturnLocation.jumpAtOffset(
    177174            stubInfo.patch.deltaCallToJump),
     
    682679                        stubInfo.patch.deltaCallToDone).executableAddress()));
    683680
    684             RepatchBuffer repatchBuffer(codeBlock);
    685             replaceWithJump(repatchBuffer, stubInfo, stubInfo.stubRoutine->code().code());
    686             repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, operationGetById);
     681            replaceWithJump(stubInfo, stubInfo.stubRoutine->code().code());
     682            repatchCall(codeBlock, stubInfo.callReturnLocation, operationGetById);
    687683
    688684            return RetryCacheLater;
     
    715711                    stubInfo.patch.deltaCallToDone).executableAddress()));
    716712
    717         RepatchBuffer repatchBuffer(codeBlock);
    718         replaceWithJump(repatchBuffer, stubInfo, stubInfo.stubRoutine->code().code());
    719         repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, operationGetById);
     713        replaceWithJump(stubInfo, stubInfo.stubRoutine->code().code());
     714        repatchCall(codeBlock, stubInfo.callReturnLocation, operationGetById);
    720715
    721716        return RetryCacheLater;
     
    759754}
    760755
    761 static void patchJumpToGetByIdStub(CodeBlock* codeBlock, StructureStubInfo& stubInfo, JITStubRoutine* stubRoutine)
     756static void patchJumpToGetByIdStub(StructureStubInfo& stubInfo, JITStubRoutine* stubRoutine)
    762757{
    763758    RELEASE_ASSERT(stubInfo.accessType == access_get_by_id_list);
    764     RepatchBuffer repatchBuffer(codeBlock);
    765759    if (stubInfo.u.getByIdList.list->didSelfPatching()) {
    766         repatchBuffer.relink(
     760        MacroAssembler::repatchJump(
    767761            stubInfo.callReturnLocation.jumpAtOffset(
    768762                stubInfo.patch.deltaCallToJump),
     
    771765    }
    772766   
    773     replaceWithJump(repatchBuffer, stubInfo, stubRoutine->code().code());
     767    replaceWithJump(stubInfo, stubRoutine->code().code());
    774768}
    775769
     
    853847        conditionSet));
    854848   
    855     patchJumpToGetByIdStub(codeBlock, stubInfo, stubRoutine.get());
     849    patchJumpToGetByIdStub(stubInfo, stubRoutine.get());
    856850   
    857851    return list->isFull() ? GiveUpOnCache : RetryCacheLater;
     
    12581252            if (!emitPutTransitionStub(exec, vm, structure, ident, slot, stubInfo, putKind, oldStructure, conditionSet))
    12591253                return GiveUpOnCache;
    1260            
    1261             RepatchBuffer repatchBuffer(codeBlock);
    1262             repatchBuffer.relink(
     1254
     1255            MacroAssembler::repatchJump(
    12631256                stubInfo.callReturnLocation.jumpAtOffset(
    12641257                    stubInfo.patch.deltaCallToJump),
    12651258                CodeLocationLabel(stubInfo.stubRoutine->code().code()));
    1266             repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, appropriateListBuildingPutByIdFunction(slot, putKind));
     1259            repatchCall(codeBlock, stubInfo.callReturnLocation, appropriateListBuildingPutByIdFunction(slot, putKind));
    12671260           
    12681261            stubInfo.initPutByIdTransition(*vm, codeBlock->ownerExecutable(), oldStructure, structure, conditionSet, putKind == Direct);
     
    13211314            structure, conditionSet, slot.customSetter(), stubRoutine));
    13221315
    1323         RepatchBuffer repatchBuffer(codeBlock);
    1324         repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code()));
    1325         repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, appropriateListBuildingPutByIdFunction(slot, putKind));
     1316        MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code()));
     1317        repatchCall(codeBlock, stubInfo.callReturnLocation, appropriateListBuildingPutByIdFunction(slot, putKind));
    13261318        RELEASE_ASSERT(!list->isFull());
    13271319        return RetryCacheLater;
     
    13941386                    structure, stubRoutine));
    13951387        }
    1396         RepatchBuffer repatchBuffer(codeBlock);
    1397         repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code()));
     1388        MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code()));
    13981389        if (list->isFull())
    1399             repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, appropriateGenericPutByIdFunction(slot, putKind));
     1390            repatchCall(codeBlock, stubInfo.callReturnLocation, appropriateGenericPutByIdFunction(slot, putKind));
    14001391
    14011392        return RetryCacheLater;
     
    14431434            structure, conditionSet, slot.customSetter(), stubRoutine));
    14441435
    1445         RepatchBuffer repatchBuffer(codeBlock);
    1446         repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code()));
     1436        MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code()));
    14471437        if (list->isFull())
    1448             repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, appropriateGenericPutByIdFunction(slot, putKind));
     1438            repatchCall(codeBlock, stubInfo.callReturnLocation, appropriateGenericPutByIdFunction(slot, putKind));
    14491439
    14501440        return RetryCacheLater;
     
    15741564    stubInfo.u.inList.listSize++;
    15751565   
    1576     RepatchBuffer repatchBuffer(codeBlock);
    1577     repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code()));
     1566    MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code()));
    15781567   
    15791568    return listIndex < (POLYMORPHIC_LIST_CACHE_SIZE - 1) ? RetryCacheLater : GiveUpOnCache;
     
    15881577}
    15891578
    1590 static void linkSlowFor(
    1591     RepatchBuffer& repatchBuffer, VM*, CallLinkInfo& callLinkInfo, MacroAssemblerCodeRef codeRef)
    1592 {
    1593     repatchBuffer.relink(
    1594         callLinkInfo.callReturnLocation(), codeRef.code());
    1595 }
    1596 
    1597 static void linkSlowFor(
    1598     RepatchBuffer& repatchBuffer, VM* vm, CallLinkInfo& callLinkInfo, ThunkGenerator generator)
    1599 {
    1600     linkSlowFor(repatchBuffer, vm, callLinkInfo, vm->getCTIStub(generator));
    1601 }
    1602 
    1603 static void linkSlowFor(
    1604     RepatchBuffer& repatchBuffer, VM* vm, CallLinkInfo& callLinkInfo)
     1579static void linkSlowFor(VM*, CallLinkInfo& callLinkInfo, MacroAssemblerCodeRef codeRef)
     1580{
     1581    MacroAssembler::repatchNearCall(callLinkInfo.callReturnLocation(), CodeLocationLabel(codeRef.code()));
     1582}
     1583
     1584static void linkSlowFor(VM* vm, CallLinkInfo& callLinkInfo, ThunkGenerator generator)
     1585{
     1586    linkSlowFor(vm, callLinkInfo, vm->getCTIStub(generator));
     1587}
     1588
     1589static void linkSlowFor(VM* vm, CallLinkInfo& callLinkInfo)
    16051590{
    16061591    MacroAssemblerCodeRef virtualThunk = virtualThunkFor(vm, callLinkInfo);
    1607     linkSlowFor(repatchBuffer, vm, callLinkInfo, virtualThunk);
     1592    linkSlowFor(vm, callLinkInfo, virtualThunk);
    16081593    callLinkInfo.setSlowStub(createJITStubRoutine(virtualThunk, *vm, nullptr, true));
    16091594}
     
    16181603
    16191604    VM* vm = callerCodeBlock->vm();
    1620    
    1621     RepatchBuffer repatchBuffer(callerCodeBlock);
    16221605   
    16231606    ASSERT(!callLinkInfo.isLinked());
     
    16261609    if (shouldShowDisassemblyFor(callerCodeBlock))
    16271610        dataLog("Linking call in ", *callerCodeBlock, " at ", callLinkInfo.codeOrigin(), " to ", pointerDump(calleeCodeBlock), ", entrypoint at ", codePtr, "\n");
    1628     repatchBuffer.relink(callLinkInfo.hotPathOther(), codePtr);
     1611    MacroAssembler::repatchNearCall(callLinkInfo.hotPathOther(), CodeLocationLabel(codePtr));
    16291612   
    16301613    if (calleeCodeBlock)
     
    16321615   
    16331616    if (callLinkInfo.specializationKind() == CodeForCall) {
    1634         linkSlowFor(
    1635             repatchBuffer, vm, callLinkInfo, linkPolymorphicCallThunkGenerator);
     1617        linkSlowFor(vm, callLinkInfo, linkPolymorphicCallThunkGenerator);
    16361618        return;
    16371619    }
    16381620   
    16391621    ASSERT(callLinkInfo.specializationKind() == CodeForConstruct);
    1640     linkSlowFor(repatchBuffer, vm, callLinkInfo);
     1622    linkSlowFor(vm, callLinkInfo);
    16411623}
    16421624
     
    16471629    VM* vm = callerCodeBlock->vm();
    16481630   
    1649     RepatchBuffer repatchBuffer(callerCodeBlock);
    1650    
    1651     linkSlowFor(repatchBuffer, vm, callLinkInfo);
    1652 }
    1653 
    1654 static void revertCall(
    1655     RepatchBuffer& repatchBuffer, VM* vm, CallLinkInfo& callLinkInfo, MacroAssemblerCodeRef codeRef)
    1656 {
    1657     repatchBuffer.revertJumpReplacementToBranchPtrWithPatch(
    1658         RepatchBuffer::startOfBranchPtrWithPatchOnRegister(callLinkInfo.hotPathBegin()),
     1631    linkSlowFor(vm, callLinkInfo);
     1632}
     1633
     1634static void revertCall(VM* vm, CallLinkInfo& callLinkInfo, MacroAssemblerCodeRef codeRef)
     1635{
     1636    MacroAssembler::revertJumpReplacementToBranchPtrWithPatch(
     1637        MacroAssembler::startOfBranchPtrWithPatchOnRegister(callLinkInfo.hotPathBegin()),
    16591638        static_cast<MacroAssembler::RegisterID>(callLinkInfo.calleeGPR()), 0);
    1660     linkSlowFor(repatchBuffer, vm, callLinkInfo, codeRef);
     1639    linkSlowFor(vm, callLinkInfo, codeRef);
    16611640    callLinkInfo.clearSeen();
    16621641    callLinkInfo.clearCallee();
     
    16671646}
    16681647
    1669 void unlinkFor(
    1670     VM& vm, RepatchBuffer& repatchBuffer, CallLinkInfo& callLinkInfo)
     1648void unlinkFor(VM& vm, CallLinkInfo& callLinkInfo)
    16711649{
    16721650    if (Options::showDisassembly())
    16731651        dataLog("Unlinking call from ", callLinkInfo.callReturnLocation(), "\n");
    16741652   
    1675     revertCall(repatchBuffer, &vm, callLinkInfo, vm.getCTIStub(linkCallThunkGenerator));
     1653    revertCall(&vm, callLinkInfo, vm.getCTIStub(linkCallThunkGenerator));
    16761654}
    16771655
     
    16851663        dataLog("Linking virtual call at ", *callerCodeBlock, " ", exec->callerFrame()->codeOrigin(), "\n");
    16861664   
    1687     RepatchBuffer repatchBuffer(callerCodeBlock);
    16881665    MacroAssemblerCodeRef virtualThunk = virtualThunkFor(vm, callLinkInfo);
    1689     revertCall(repatchBuffer, vm, callLinkInfo, virtualThunk);
     1666    revertCall(vm, callLinkInfo, virtualThunk);
    16901667    callLinkInfo.setSlowStub(createJITStubRoutine(virtualThunk, *vm, nullptr, true));
    16911668}
     
    19171894        WTF::move(fastCounts)));
    19181895   
    1919     RepatchBuffer repatchBuffer(callerCodeBlock);
    1920    
    1921     repatchBuffer.replaceWithJump(
    1922         RepatchBuffer::startOfBranchPtrWithPatchOnRegister(callLinkInfo.hotPathBegin()),
     1896    MacroAssembler::replaceWithJump(
     1897        MacroAssembler::startOfBranchPtrWithPatchOnRegister(callLinkInfo.hotPathBegin()),
    19231898        CodeLocationLabel(stubRoutine->code().code()));
    19241899    // The original slow path is unreachable on 64-bits, but still
    19251900    // reachable on 32-bits since a non-cell callee will always
    19261901    // trigger the slow path
    1927     linkSlowFor(repatchBuffer, vm, callLinkInfo);
     1902    linkSlowFor(vm, callLinkInfo);
    19281903   
    19291904    // If there had been a previous stub routine, that one will die as soon as the GC runs and sees
     
    19371912}
    19381913
    1939 void resetGetByID(RepatchBuffer& repatchBuffer, CodeBlock* codeBlock, StructureStubInfo& stubInfo)
    1940 {
    1941     repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, operationGetByIdOptimize);
     1914void resetGetByID(CodeBlock* codeBlock, StructureStubInfo& stubInfo)
     1915{
     1916    repatchCall(codeBlock, stubInfo.callReturnLocation, operationGetByIdOptimize);
    19421917    CodeLocationDataLabel32 structureLabel = stubInfo.callReturnLocation.dataLabel32AtOffset(-(intptr_t)stubInfo.patch.deltaCheckImmToCall);
    19431918    if (MacroAssembler::canJumpReplacePatchableBranch32WithPatch()) {
    1944         repatchBuffer.revertJumpReplacementToPatchableBranch32WithPatch(
    1945             RepatchBuffer::startOfPatchableBranch32WithPatchOnAddress(structureLabel),
     1919        MacroAssembler::revertJumpReplacementToPatchableBranch32WithPatch(
     1920            MacroAssembler::startOfPatchableBranch32WithPatchOnAddress(structureLabel),
    19461921            MacroAssembler::Address(
    19471922                static_cast<MacroAssembler::RegisterID>(stubInfo.patch.baseGPR),
     
    19491924            static_cast<int32_t>(unusedPointer));
    19501925    }
    1951     repatchBuffer.repatch(structureLabel, static_cast<int32_t>(unusedPointer));
     1926    MacroAssembler::repatchInt32(structureLabel, static_cast<int32_t>(unusedPointer));
    19521927#if USE(JSVALUE64)
    1953     repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToLoadOrStore), 0);
     1928    MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToLoadOrStore), 0);
    19541929#else
    1955     repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), 0);
    1956     repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), 0);
    1957 #endif
    1958     repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase));
    1959 }
    1960 
    1961 void resetPutByID(RepatchBuffer& repatchBuffer, CodeBlock* codeBlock, StructureStubInfo& stubInfo)
     1930    MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), 0);
     1931    MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), 0);
     1932#endif
     1933    MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase));
     1934}
     1935
     1936void resetPutByID(CodeBlock* codeBlock, StructureStubInfo& stubInfo)
    19621937{
    19631938    V_JITOperation_ESsiJJI unoptimizedFunction = bitwise_cast<V_JITOperation_ESsiJJI>(readCallTarget(codeBlock, stubInfo.callReturnLocation).executableAddress());
     
    19731948        optimizedFunction = operationPutByIdDirectNonStrictOptimize;
    19741949    }
    1975     repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, optimizedFunction);
     1950    repatchCall(codeBlock, stubInfo.callReturnLocation, optimizedFunction);
    19761951    CodeLocationDataLabel32 structureLabel = stubInfo.callReturnLocation.dataLabel32AtOffset(-(intptr_t)stubInfo.patch.deltaCheckImmToCall);
    19771952    if (MacroAssembler::canJumpReplacePatchableBranch32WithPatch()) {
    1978         repatchBuffer.revertJumpReplacementToPatchableBranch32WithPatch(
    1979             RepatchBuffer::startOfPatchableBranch32WithPatchOnAddress(structureLabel),
     1953        MacroAssembler::revertJumpReplacementToPatchableBranch32WithPatch(
     1954            MacroAssembler::startOfPatchableBranch32WithPatchOnAddress(structureLabel),
    19801955            MacroAssembler::Address(
    19811956                static_cast<MacroAssembler::RegisterID>(stubInfo.patch.baseGPR),
     
    19831958            static_cast<int32_t>(unusedPointer));
    19841959    }
    1985     repatchBuffer.repatch(structureLabel, static_cast<int32_t>(unusedPointer));
     1960    MacroAssembler::repatchInt32(structureLabel, static_cast<int32_t>(unusedPointer));
    19861961#if USE(JSVALUE64)
    1987     repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToLoadOrStore), 0);
     1962    MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToLoadOrStore), 0);
    19881963#else
    1989     repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), 0);
    1990     repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), 0);
    1991 #endif
    1992     repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase));
    1993 }
    1994 
    1995 void resetIn(RepatchBuffer& repatchBuffer, CodeBlock*, StructureStubInfo& stubInfo)
    1996 {
    1997     repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase));
     1964    MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), 0);
     1965    MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), 0);
     1966#endif
     1967    MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase));
     1968}
     1969
     1970void resetIn(CodeBlock*, StructureStubInfo& stubInfo)
     1971{
     1972    MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase));
    19981973}
    19991974
  • trunk/Source/JavaScriptCore/jit/Repatch.h

    r189278 r189288  
    4343void linkFor(ExecState*, CallLinkInfo&, CodeBlock*, JSFunction* callee, MacroAssemblerCodePtr);
    4444void linkSlowFor(ExecState*, CallLinkInfo&);
    45 void unlinkFor(VM&, RepatchBuffer&, CallLinkInfo&);
     45void unlinkFor(VM&, CallLinkInfo&);
    4646void linkVirtualFor(ExecState*, CallLinkInfo&);
    4747void linkPolymorphicCall(ExecState*, CallLinkInfo&, CallVariant);
    48 void resetGetByID(RepatchBuffer&, CodeBlock*, StructureStubInfo&);
    49 void resetPutByID(RepatchBuffer&, CodeBlock*, StructureStubInfo&);
    50 void resetIn(RepatchBuffer&, CodeBlock*, StructureStubInfo&);
     48void resetGetByID(CodeBlock*, StructureStubInfo&);
     49void resetPutByID(CodeBlock*, StructureStubInfo&);
     50void resetIn(CodeBlock*, StructureStubInfo&);
    5151
    5252} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.