Title: [189288] trunk/Source/_javascript_Core
Revision
189288
Author
[email protected]
Date
2015-09-03 14:11:59 -0700 (Thu, 03 Sep 2015)

Log 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.

* _javascript_Core.vcxproj/_javascript_Core.vcxproj:
* _javascript_Core.vcxproj/_javascript_Core.vcxproj.filters:
* _javascript_Core.xcodeproj/project.pbxproj:
* assembler/AbstractMacroAssembler.h:
(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:

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (189287 => 189288)


--- trunk/Source/_javascript_Core/ChangeLog	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-09-03 21:11:59 UTC (rev 189288)
@@ -1,3 +1,148 @@
+2015-09-03  Filip Pizlo  <[email protected]>
+
+        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.
+
+        * _javascript_Core.vcxproj/_javascript_Core.vcxproj:
+        * _javascript_Core.vcxproj/_javascript_Core.vcxproj.filters:
+        * _javascript_Core.xcodeproj/project.pbxproj:
+        * assembler/AbstractMacroAssembler.h:
+        (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:
+
 2015-09-03  Sukolsak Sakshuwong  <[email protected]>
 
         Initial implementation of WebAssembly function compiler

Modified: trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj (189287 => 189288)


--- trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj	2015-09-03 21:11:59 UTC (rev 189288)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="DebugSuffix|Win32">
@@ -993,7 +993,6 @@
     <ClInclude Include="..\assembler\MacroAssemblerX86Common.h" />
     <ClInclude Include="..\assembler\MacroAssemblerX86_64.h" />
     <ClInclude Include="..\assembler\MaxFrameExtentForSlowPathCall.h" />
-    <ClInclude Include="..\assembler\RepatchBuffer.h" />
     <ClInclude Include="..\assembler\X86Assembler.h" />
     <ClInclude Include="..\bindings\ScriptFunctionCall.h" />
     <ClInclude Include="..\bindings\ScriptObject.h" />
@@ -1906,4 +1905,4 @@
   <ImportGroup Label="ExtensionTargets">
     <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
   </ImportGroup>
-</Project>
\ No newline at end of file
+</Project>

Modified: trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj.filters (189287 => 189288)


--- trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj.filters	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcxproj/_javascript_Core.vcxproj.filters	2015-09-03 21:11:59 UTC (rev 189288)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup>
     <Filter Include="assembler">
@@ -2001,9 +2001,6 @@
     <ClInclude Include="..\assembler\MaxFrameExtentForSlowPathCall.h">
       <Filter>assembler</Filter>
     </ClInclude>
-    <ClInclude Include="..\assembler\RepatchBuffer.h">
-      <Filter>assembler</Filter>
-    </ClInclude>
     <ClInclude Include="..\assembler\X86Assembler.h">
       <Filter>assembler</Filter>
     </ClInclude>
@@ -4673,4 +4670,4 @@
       <Filter>jit</Filter>
     </MASM>
   </ItemGroup>
-</Project>
\ No newline at end of file
+</Project>

Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (189287 => 189288)


--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2015-09-03 21:11:59 UTC (rev 189288)
@@ -1115,7 +1115,6 @@
 		86D3B2C510156BDE002865E7 /* AssemblerBufferWithConstantPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B2C110156BDE002865E7 /* AssemblerBufferWithConstantPool.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		86D3B2C610156BDE002865E7 /* MacroAssemblerARM.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B2C210156BDE002865E7 /* MacroAssemblerARM.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		86D3B3C310159D7F002865E7 /* LinkBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B3C110159D7F002865E7 /* LinkBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		86D3B3C410159D7F002865E7 /* RepatchBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B3C210159D7F002865E7 /* RepatchBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		86DB64640F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86DB64630F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp */; };
 		86E116B10FE75AC800B512BC /* CodeLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E116B00FE75AC800B512BC /* CodeLocation.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		86E3C612167BABD7006D760A /* JSValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E3C606167BAB87006D760A /* JSValue.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -2963,7 +2962,6 @@
 		86D3B2C110156BDE002865E7 /* AssemblerBufferWithConstantPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssemblerBufferWithConstantPool.h; sourceTree = "<group>"; };
 		86D3B2C210156BDE002865E7 /* MacroAssemblerARM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerARM.h; sourceTree = "<group>"; };
 		86D3B3C110159D7F002865E7 /* LinkBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkBuffer.h; sourceTree = "<group>"; };
-		86D3B3C210159D7F002865E7 /* RepatchBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RepatchBuffer.h; sourceTree = "<group>"; };
 		86DB64630F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExecutableAllocatorFixedVMPool.cpp; sourceTree = "<group>"; };
 		86E116B00FE75AC800B512BC /* CodeLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeLocation.h; sourceTree = "<group>"; };
 		86E3C606167BAB87006D760A /* JSValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSValue.h; sourceTree = "<group>"; };
@@ -5493,7 +5491,6 @@
 				860161E20F3A83C100F84710 /* MacroAssemblerX86Common.h */,
 				65860177185A8F5E00030EEE /* MaxFrameExtentForSlowPathCall.h */,
 				86C568DF11A213EE0007F7F0 /* MIPSAssembler.h */,
-				86D3B3C210159D7F002865E7 /* RepatchBuffer.h */,
 				86AE64A7135E5E1C00963012 /* SH4Assembler.h */,
 				9688CB140ED12B4E001D649F /* X86Assembler.h */,
 			);
@@ -6738,7 +6735,6 @@
 				A5BA15EB182340B400A82E69 /* RemoteInspectorDebuggableConnection.h in Headers */,
 				A5BA15ED182340B400A82E69 /* RemoteInspectorXPCConnection.h in Headers */,
 				0F24E55117EE274900ABB217 /* Repatch.h in Headers */,
-				86D3B3C410159D7F002865E7 /* RepatchBuffer.h in Headers */,
 				869EBCB70E8C6D4A008722CC /* ResultType.h in Headers */,
 				C22B31B9140577D700DB475A /* SamplingCounter.h in Headers */,
 				1429D8860ED21C3D00B89619 /* SamplingTool.h in Headers */,

Modified: trunk/Source/_javascript_Core/assembler/AbstractMacroAssembler.h (189287 => 189288)


--- trunk/Source/_javascript_Core/assembler/AbstractMacroAssembler.h	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/assembler/AbstractMacroAssembler.h	2015-09-03 21:11:59 UTC (rev 189288)
@@ -935,6 +935,66 @@
 
     AssemblerType m_assembler;
     
+    static void linkJump(void* code, Jump jump, CodeLocationLabel target)
+    {
+        AssemblerType::linkJump(code, jump.m_label, target.dataLocation());
+    }
+
+    static void linkPointer(void* code, AssemblerLabel label, void* value)
+    {
+        AssemblerType::linkPointer(code, label, value);
+    }
+
+    static void* getLinkerAddress(void* code, AssemblerLabel label)
+    {
+        return AssemblerType::getRelocatedAddress(code, label);
+    }
+
+    static unsigned getLinkerCallReturnOffset(Call call)
+    {
+        return AssemblerType::getCallReturnOffset(call.m_label);
+    }
+
+    static void repatchJump(CodeLocationJump jump, CodeLocationLabel destination)
+    {
+        AssemblerType::relinkJump(jump.dataLocation(), destination.dataLocation());
+    }
+
+    static void repatchNearCall(CodeLocationNearCall nearCall, CodeLocationLabel destination)
+    {
+        AssemblerType::relinkCall(nearCall.dataLocation(), destination.executableAddress());
+    }
+
+    static void repatchCompact(CodeLocationDataLabelCompact dataLabelCompact, int32_t value)
+    {
+        AssemblerType::repatchCompact(dataLabelCompact.dataLocation(), value);
+    }
+    
+    static void repatchInt32(CodeLocationDataLabel32 dataLabel32, int32_t value)
+    {
+        AssemblerType::repatchInt32(dataLabel32.dataLocation(), value);
+    }
+
+    static void repatchPointer(CodeLocationDataLabelPtr dataLabelPtr, void* value)
+    {
+        AssemblerType::repatchPointer(dataLabelPtr.dataLocation(), value);
+    }
+    
+    static void* readPointer(CodeLocationDataLabelPtr dataLabelPtr)
+    {
+        return AssemblerType::readPointer(dataLabelPtr.dataLocation());
+    }
+    
+    static void replaceWithLoad(CodeLocationConvertibleLoad label)
+    {
+        AssemblerType::replaceWithLoad(label.dataLocation());
+    }
+    
+    static void replaceWithAddressComputation(CodeLocationConvertibleLoad label)
+    {
+        AssemblerType::replaceWithAddressComputation(label.dataLocation());
+    }
+
 protected:
     AbstractMacroAssembler()
         : m_randomSource(cryptographicallyRandomNumber())
@@ -1031,68 +1091,7 @@
     unsigned m_tempRegistersValidBits;
 
     friend class LinkBuffer;
-    friend class RepatchBuffer;
 
-    static void linkJump(void* code, Jump jump, CodeLocationLabel target)
-    {
-        AssemblerType::linkJump(code, jump.m_label, target.dataLocation());
-    }
-
-    static void linkPointer(void* code, AssemblerLabel label, void* value)
-    {
-        AssemblerType::linkPointer(code, label, value);
-    }
-
-    static void* getLinkerAddress(void* code, AssemblerLabel label)
-    {
-        return AssemblerType::getRelocatedAddress(code, label);
-    }
-
-    static unsigned getLinkerCallReturnOffset(Call call)
-    {
-        return AssemblerType::getCallReturnOffset(call.m_label);
-    }
-
-    static void repatchJump(CodeLocationJump jump, CodeLocationLabel destination)
-    {
-        AssemblerType::relinkJump(jump.dataLocation(), destination.dataLocation());
-    }
-
-    static void repatchNearCall(CodeLocationNearCall nearCall, CodeLocationLabel destination)
-    {
-        AssemblerType::relinkCall(nearCall.dataLocation(), destination.executableAddress());
-    }
-
-    static void repatchCompact(CodeLocationDataLabelCompact dataLabelCompact, int32_t value)
-    {
-        AssemblerType::repatchCompact(dataLabelCompact.dataLocation(), value);
-    }
-    
-    static void repatchInt32(CodeLocationDataLabel32 dataLabel32, int32_t value)
-    {
-        AssemblerType::repatchInt32(dataLabel32.dataLocation(), value);
-    }
-
-    static void repatchPointer(CodeLocationDataLabelPtr dataLabelPtr, void* value)
-    {
-        AssemblerType::repatchPointer(dataLabelPtr.dataLocation(), value);
-    }
-    
-    static void* readPointer(CodeLocationDataLabelPtr dataLabelPtr)
-    {
-        return AssemblerType::readPointer(dataLabelPtr.dataLocation());
-    }
-    
-    static void replaceWithLoad(CodeLocationConvertibleLoad label)
-    {
-        AssemblerType::replaceWithLoad(label.dataLocation());
-    }
-    
-    static void replaceWithAddressComputation(CodeLocationConvertibleLoad label)
-    {
-        AssemblerType::replaceWithAddressComputation(label.dataLocation());
-    }
-
 private:
 
 }; // class AbstractMacroAssembler

Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerARM64.h (189287 => 189288)


--- trunk/Source/_javascript_Core/assembler/MacroAssemblerARM64.h	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerARM64.h	2015-09-03 21:11:59 UTC (rev 189288)
@@ -2506,6 +2506,16 @@
         UNREACHABLE_FOR_PLATFORM();
     }
 
+    static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
+    {
+        ARM64Assembler::repatchPointer(call.dataLabelPtrAtOffset(REPATCH_OFFSET_CALL_TO_POINTER).dataLocation(), destination.executableAddress());
+    }
+
+    static void repatchCall(CodeLocationCall call, FunctionPtr destination)
+    {
+        ARM64Assembler::repatchPointer(call.dataLabelPtrAtOffset(REPATCH_OFFSET_CALL_TO_POINTER).dataLocation(), destination.executableAddress());
+    }
+
 protected:
     ALWAYS_INLINE Jump makeBranch(ARM64Assembler::Condition cond)
     {
@@ -2878,16 +2888,6 @@
             ARM64Assembler::linkPointer(code, call.m_label.labelAtOffset(REPATCH_OFFSET_CALL_TO_POINTER), function.value());
     }
 
-    static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
-    {
-        ARM64Assembler::repatchPointer(call.dataLabelPtrAtOffset(REPATCH_OFFSET_CALL_TO_POINTER).dataLocation(), destination.executableAddress());
-    }
-
-    static void repatchCall(CodeLocationCall call, FunctionPtr destination)
-    {
-        ARM64Assembler::repatchPointer(call.dataLabelPtrAtOffset(REPATCH_OFFSET_CALL_TO_POINTER).dataLocation(), destination.executableAddress());
-    }
-
     CachedTempRegister m_dataMemoryTempRegister;
     CachedTempRegister m_cachedMemoryTempRegister;
     bool m_makeJumpPatchable;

Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerARMv7.h (189287 => 189288)


--- trunk/Source/_javascript_Core/assembler/MacroAssemblerARMv7.h	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerARMv7.h	2015-09-03 21:11:59 UTC (rev 189288)
@@ -1901,6 +1901,16 @@
         UNREACHABLE_FOR_PLATFORM();
     }
 
+    static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
+    {
+        ARMv7Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
+    }
+
+    static void repatchCall(CodeLocationCall call, FunctionPtr destination)
+    {
+        ARMv7Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
+    }
+
 #if ENABLE(MASM_PROBE)
     void probe(ProbeFunction, void* arg1 = 0, void* arg2 = 0);
 #endif // ENABLE(MASM_PROBE)
@@ -2005,16 +2015,6 @@
         ARMv7Assembler::linkCall(code, call.m_label, function.value());
     }
 
-    static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
-    {
-        ARMv7Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
-    }
-
-    static void repatchCall(CodeLocationCall call, FunctionPtr destination)
-    {
-        ARMv7Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
-    }
-
 #if ENABLE(MASM_PROBE)
     inline TrustedImm32 trustedImm32FromPtr(void* ptr)
     {

Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerX86.h (189287 => 189288)


--- trunk/Source/_javascript_Core/assembler/MacroAssemblerX86.h	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerX86.h	2015-09-03 21:11:59 UTC (rev 189288)
@@ -345,15 +345,6 @@
         X86Assembler::revertJumpTo_cmpl_im_force32(instructionStart.executableAddress(), initialValue, 0, address.base);
     }
 
-private:
-    friend class LinkBuffer;
-    friend class RepatchBuffer;
-
-    static void linkCall(void* code, Call call, FunctionPtr function)
-    {
-        X86Assembler::linkCall(code, call.m_label, function.value());
-    }
-
     static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
     {
         X86Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
@@ -363,6 +354,15 @@
     {
         X86Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
     }
+
+private:
+    friend class LinkBuffer;
+    friend class RepatchBuffer;
+
+    static void linkCall(void* code, Call call, FunctionPtr function)
+    {
+        X86Assembler::linkCall(code, call.m_label, function.value());
+    }
 };
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerX86_64.h (189287 => 189288)


--- trunk/Source/_javascript_Core/assembler/MacroAssemblerX86_64.h	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerX86_64.h	2015-09-03 21:11:59 UTC (rev 189288)
@@ -854,6 +854,16 @@
         X86Assembler::revertJumpTo_movq_i64r(instructionStart.executableAddress(), reinterpret_cast<intptr_t>(initialValue), scratchRegister);
     }
 
+    static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
+    {
+        X86Assembler::repatchPointer(call.dataLabelPtrAtOffset(-REPATCH_OFFSET_CALL_R11).dataLocation(), destination.executableAddress());
+    }
+
+    static void repatchCall(CodeLocationCall call, FunctionPtr destination)
+    {
+        X86Assembler::repatchPointer(call.dataLabelPtrAtOffset(-REPATCH_OFFSET_CALL_R11).dataLocation(), destination.executableAddress());
+    }
+
 private:
     friend class LinkBuffer;
     friend class RepatchBuffer;
@@ -865,16 +875,6 @@
         else
             X86Assembler::linkCall(code, call.m_label, function.value());
     }
-
-    static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
-    {
-        X86Assembler::repatchPointer(call.dataLabelPtrAtOffset(-REPATCH_OFFSET_CALL_R11).dataLocation(), destination.executableAddress());
-    }
-
-    static void repatchCall(CodeLocationCall call, FunctionPtr destination)
-    {
-        X86Assembler::repatchPointer(call.dataLabelPtrAtOffset(-REPATCH_OFFSET_CALL_R11).dataLocation(), destination.executableAddress());
-    }
 };
 
 } // namespace JSC

Deleted: trunk/Source/_javascript_Core/assembler/RepatchBuffer.h (189287 => 189288)


--- trunk/Source/_javascript_Core/assembler/RepatchBuffer.h	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/assembler/RepatchBuffer.h	2015-09-03 21:11:59 UTC (rev 189288)
@@ -1,181 +0,0 @@
-/*
- * Copyright (C) 2009, 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#ifndef RepatchBuffer_h
-#define RepatchBuffer_h
-
-#if ENABLE(JIT)
-
-#include "CodeBlock.h"
-#include <MacroAssembler.h>
-#include <wtf/Noncopyable.h>
-
-namespace JSC {
-
-// RepatchBuffer:
-//
-// This class is used to modify code after code generation has been completed,
-// and after the code has potentially already been executed.  This mechanism is
-// used to apply optimizations to the code.
-//
-class RepatchBuffer {
-    typedef MacroAssemblerCodePtr CodePtr;
-
-public:
-    RepatchBuffer(CodeBlock*)
-    {
-    }
-
-    ~RepatchBuffer()
-    {
-    }
-    
-    void relink(CodeLocationJump jump, CodeLocationLabel destination)
-    {
-        MacroAssembler::repatchJump(jump, destination);
-    }
-
-    void relink(CodeLocationCall call, CodeLocationLabel destination)
-    {
-        MacroAssembler::repatchCall(call, destination);
-    }
-
-    void relink(CodeLocationCall call, FunctionPtr destination)
-    {
-        MacroAssembler::repatchCall(call, destination);
-    }
-
-    void relink(CodeLocationNearCall nearCall, CodePtr destination)
-    {
-        MacroAssembler::repatchNearCall(nearCall, CodeLocationLabel(destination));
-    }
-
-    void relink(CodeLocationNearCall nearCall, CodeLocationLabel destination)
-    {
-        MacroAssembler::repatchNearCall(nearCall, destination);
-    }
-
-    void repatch(CodeLocationDataLabel32 dataLabel32, int32_t value)
-    {
-        MacroAssembler::repatchInt32(dataLabel32, value);
-    }
-
-    void repatch(CodeLocationDataLabelCompact dataLabelCompact, int32_t value)
-    {
-        MacroAssembler::repatchCompact(dataLabelCompact, value);
-    }
-
-    void repatch(CodeLocationDataLabelPtr dataLabelPtr, void* value)
-    {
-        MacroAssembler::repatchPointer(dataLabelPtr, value);
-    }
-
-    void relinkCallerToTrampoline(ReturnAddressPtr returnAddress, CodeLocationLabel label)
-    {
-        relink(CodeLocationCall(CodePtr(returnAddress)), label);
-    }
-    
-    void relinkCallerToTrampoline(ReturnAddressPtr returnAddress, CodePtr newCalleeFunction)
-    {
-        relinkCallerToTrampoline(returnAddress, CodeLocationLabel(newCalleeFunction));
-    }
-
-    void relinkCallerToFunction(ReturnAddressPtr returnAddress, FunctionPtr function)
-    {
-        relink(CodeLocationCall(CodePtr(returnAddress)), function);
-    }
-    
-    void relinkNearCallerToTrampoline(ReturnAddressPtr returnAddress, CodeLocationLabel label)
-    {
-        relink(CodeLocationNearCall(CodePtr(returnAddress)), label);
-    }
-    
-    void relinkNearCallerToTrampoline(ReturnAddressPtr returnAddress, CodePtr newCalleeFunction)
-    {
-        relinkNearCallerToTrampoline(returnAddress, CodeLocationLabel(newCalleeFunction));
-    }
-    
-    void replaceWithLoad(CodeLocationConvertibleLoad label)
-    {
-        MacroAssembler::replaceWithLoad(label);
-    }
-    
-    void replaceWithAddressComputation(CodeLocationConvertibleLoad label)
-    {
-        MacroAssembler::replaceWithAddressComputation(label);
-    }
-    
-    void setLoadInstructionIsActive(CodeLocationConvertibleLoad label, bool isActive)
-    {
-        if (isActive)
-            replaceWithLoad(label);
-        else
-            replaceWithAddressComputation(label);
-    }
-
-    static CodeLocationLabel startOfBranchPtrWithPatchOnRegister(CodeLocationDataLabelPtr label)
-    {
-        return MacroAssembler::startOfBranchPtrWithPatchOnRegister(label);
-    }
-    
-    static CodeLocationLabel startOfPatchableBranchPtrWithPatchOnAddress(CodeLocationDataLabelPtr label)
-    {
-        return MacroAssembler::startOfPatchableBranchPtrWithPatchOnAddress(label);
-    }
-
-    static CodeLocationLabel startOfPatchableBranch32WithPatchOnAddress(CodeLocationDataLabel32 label)
-    {
-        return MacroAssembler::startOfPatchableBranch32WithPatchOnAddress(label);
-    }
-    
-    void replaceWithJump(CodeLocationLabel instructionStart, CodeLocationLabel destination)
-    {
-        MacroAssembler::replaceWithJump(instructionStart, destination);
-    }
-    
-    // This is a *bit* of a silly API, since we currently always also repatch the
-    // immediate after calling this. But I'm fine with that, since this just feels
-    // less yucky.
-    void revertJumpReplacementToBranchPtrWithPatch(CodeLocationLabel instructionStart, MacroAssembler::RegisterID reg, void* value)
-    {
-        MacroAssembler::revertJumpReplacementToBranchPtrWithPatch(instructionStart, reg, value);
-    }
-
-    void revertJumpReplacementToPatchableBranchPtrWithPatch(CodeLocationLabel instructionStart, MacroAssembler::Address address, void* value)
-    {
-        MacroAssembler::revertJumpReplacementToPatchableBranchPtrWithPatch(instructionStart, address, value);
-    }
-
-    void revertJumpReplacementToPatchableBranch32WithPatch(CodeLocationLabel instructionStart, MacroAssembler::Address address, int32_t value)
-    {
-        MacroAssembler::revertJumpReplacementToPatchableBranch32WithPatch(instructionStart, address, value);
-    }
-};
-
-} // namespace JSC
-
-#endif // ENABLE(ASSEMBLER)
-
-#endif // RepatchBuffer_h

Modified: trunk/Source/_javascript_Core/bytecode/CallLinkInfo.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/bytecode/CallLinkInfo.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/bytecode/CallLinkInfo.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -30,7 +30,6 @@
 #include "DFGThunks.h"
 #include "JSCInlines.h"
 #include "Repatch.h"
-#include "RepatchBuffer.h"
 #include <wtf/ListDump.h>
 #include <wtf/NeverDestroyed.h>
 
@@ -46,7 +45,7 @@
     m_stub = nullptr;
 }
 
-void CallLinkInfo::unlink(VM& vm, RepatchBuffer& repatchBuffer)
+void CallLinkInfo::unlink(VM& vm)
 {
     if (!isLinked()) {
         // We could be called even if we're not linked anymore because of how polymorphic calls
@@ -55,14 +54,14 @@
         return;
     }
     
-    unlinkFor(vm, repatchBuffer, *this);
+    unlinkFor(vm, *this);
 
     // It will be on a list if the callee has a code block.
     if (isOnList())
         remove();
 }
 
-void CallLinkInfo::visitWeak(VM& vm, RepatchBuffer& repatchBuffer)
+void CallLinkInfo::visitWeak(VM& vm)
 {
     auto handleSpecificCallee = [&] (JSFunction* callee) {
         if (Heap::isMarked(callee->executable()))
@@ -73,14 +72,14 @@
     
     if (isLinked()) {
         if (stub()) {
-            if (!stub()->visitWeak(vm, repatchBuffer)) {
+            if (!stub()->visitWeak(vm)) {
                 if (Options::verboseOSR()) {
                     dataLog(
                         "Clearing closure call to ",
                         listDump(stub()->variants()), ", stub routine ", RawPointer(stub()),
                         ".\n");
                 }
-                unlink(vm, repatchBuffer);
+                unlink(vm);
                 m_clearedByGC = true;
             }
         } else if (!Heap::isMarked(m_callee.get())) {
@@ -92,7 +91,7 @@
                     ").\n");
             }
             handleSpecificCallee(m_callee.get());
-            unlink(vm, repatchBuffer);
+            unlink(vm);
         }
     }
     if (haveLastSeenCallee() && !Heap::isMarked(lastSeenCallee())) {

Modified: trunk/Source/_javascript_Core/bytecode/CallLinkInfo.h (189287 => 189288)


--- trunk/Source/_javascript_Core/bytecode/CallLinkInfo.h	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/bytecode/CallLinkInfo.h	2015-09-03 21:11:59 UTC (rev 189288)
@@ -39,8 +39,6 @@
 
 #if ENABLE(JIT)
 
-class RepatchBuffer;
-
 class CallLinkInfo : public BasicRawSentinelNode<CallLinkInfo> {
 public:
     enum CallType { None, Call, CallVarargs, Construct, ConstructVarargs };
@@ -90,7 +88,7 @@
     }
 
     bool isLinked() { return m_stub || m_callee; }
-    void unlink(VM&, RepatchBuffer&);
+    void unlink(VM&);
 
     void setUpCall(CallType callType, CodeOrigin codeOrigin, unsigned calleeGPR)
     {
@@ -278,7 +276,7 @@
         return m_codeOrigin;
     }
 
-    void visitWeak(VM&, RepatchBuffer&);
+    void visitWeak(VM&);
 
 private:
     CodeLocationNearCall m_callReturnLocation;

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -57,7 +57,6 @@
 #include "ProfilerDatabase.h"
 #include "ReduceWhitespace.h"
 #include "Repatch.h"
-#include "RepatchBuffer.h"
 #include "SlotVisitorInlines.h"
 #include "StackVisitor.h"
 #include "TypeLocationCache.h"
@@ -2686,18 +2685,16 @@
 #if ENABLE(JIT)
     // Handle inline caches.
     if (!!jitCode()) {
-        RepatchBuffer repatchBuffer(this);
-        
         for (auto iter = callLinkInfosBegin(); !!iter; ++iter)
-            (*iter)->visitWeak(*vm(), repatchBuffer);
+            (*iter)->visitWeak(*vm());
 
         for (Bag<StructureStubInfo>::iterator iter = m_stubInfos.begin(); !!iter; ++iter) {
             StructureStubInfo& stubInfo = **iter;
             
-            if (stubInfo.visitWeakReferences(*vm(), repatchBuffer))
+            if (stubInfo.visitWeakReferences(*vm()))
                 continue;
             
-            resetStubDuringGCInternal(repatchBuffer, stubInfo);
+            resetStubDuringGCInternal(stubInfo);
         }
     }
 #endif
@@ -2784,11 +2781,10 @@
     
     ConcurrentJITLocker locker(m_lock);
     
-    RepatchBuffer repatchBuffer(this);
-    resetStubInternal(repatchBuffer, stubInfo);
+    resetStubInternal(stubInfo);
 }
 
-void CodeBlock::resetStubInternal(RepatchBuffer& repatchBuffer, StructureStubInfo& stubInfo)
+void CodeBlock::resetStubInternal(StructureStubInfo& stubInfo)
 {
     AccessType accessType = static_cast<AccessType>(stubInfo.accessType);
     
@@ -2801,20 +2797,20 @@
     RELEASE_ASSERT(JITCode::isJIT(jitType()));
     
     if (isGetByIdAccess(accessType))
-        resetGetByID(repatchBuffer, this, stubInfo);
+        resetGetByID(this, stubInfo);
     else if (isPutByIdAccess(accessType))
-        resetPutByID(repatchBuffer, this, stubInfo);
+        resetPutByID(this, stubInfo);
     else {
         RELEASE_ASSERT(isInAccess(accessType));
-        resetIn(repatchBuffer, this, stubInfo);
+        resetIn(this, stubInfo);
     }
     
     stubInfo.reset();
 }
 
-void CodeBlock::resetStubDuringGCInternal(RepatchBuffer& repatchBuffer, StructureStubInfo& stubInfo)
+void CodeBlock::resetStubDuringGCInternal(StructureStubInfo& stubInfo)
 {
-    resetStubInternal(repatchBuffer, stubInfo);
+    resetStubInternal(stubInfo);
     stubInfo.resetByGC = true;
 }
 
@@ -3036,11 +3032,10 @@
 #if ENABLE(JIT)
     if (m_incomingCalls.isEmpty() && m_incomingPolymorphicCalls.isEmpty())
         return;
-    RepatchBuffer repatchBuffer(this);
     while (m_incomingCalls.begin() != m_incomingCalls.end())
-        m_incomingCalls.begin()->unlink(*vm(), repatchBuffer);
+        m_incomingCalls.begin()->unlink(*vm());
     while (m_incomingPolymorphicCalls.begin() != m_incomingPolymorphicCalls.end())
-        m_incomingPolymorphicCalls.begin()->unlink(*vm(), repatchBuffer);
+        m_incomingPolymorphicCalls.begin()->unlink(*vm());
 #endif // ENABLE(JIT)
 }
 

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (189287 => 189288)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2015-09-03 21:11:59 UTC (rev 189288)
@@ -80,7 +80,6 @@
 
 class ExecState;
 class LLIntOffsetsExtractor;
-class RepatchBuffer;
 class TypeLocation;
 
 enum ReoptimizationMode { DontCountReoptimization, CountReoptimization };
@@ -982,8 +981,8 @@
     void insertBasicBlockBoundariesForControlFlowProfiler(Vector<Instruction, 0, UnsafeVectorOverflow>&);
 
 #if ENABLE(JIT)
-    void resetStubInternal(RepatchBuffer&, StructureStubInfo&);
-    void resetStubDuringGCInternal(RepatchBuffer&, StructureStubInfo&);
+    void resetStubInternal(StructureStubInfo&);
+    void resetStubDuringGCInternal(StructureStubInfo&);
 #endif
     WriteBarrier<UnlinkedCodeBlock> m_unlinkedCode;
     int m_numParameters;

Modified: trunk/Source/_javascript_Core/bytecode/PolymorphicGetByIdList.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/bytecode/PolymorphicGetByIdList.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/bytecode/PolymorphicGetByIdList.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -65,13 +65,13 @@
     return result;
 }
 
-bool GetByIdAccess::visitWeak(VM& vm, RepatchBuffer& repatchBuffer) const
+bool GetByIdAccess::visitWeak(VM& vm) const
 {
     if (m_structure && !Heap::isMarked(m_structure.get()))
         return false;
     if (!m_conditionSet.areStillLive())
         return false;
-    if (!m_stubRoutine->visitWeak(vm, repatchBuffer))
+    if (!m_stubRoutine->visitWeak(vm))
         return false;
     return true;
 }
@@ -139,10 +139,10 @@
     return false;
 }
 
-bool PolymorphicGetByIdList::visitWeak(VM& vm, RepatchBuffer& repatchBuffer) const
+bool PolymorphicGetByIdList::visitWeak(VM& vm) const
 {
     for (unsigned i = size(); i--;) {
-        if (!at(i).visitWeak(vm, repatchBuffer))
+        if (!at(i).visitWeak(vm))
             return false;
     }
     return true;

Modified: trunk/Source/_javascript_Core/bytecode/PolymorphicGetByIdList.h (189287 => 189288)


--- trunk/Source/_javascript_Core/bytecode/PolymorphicGetByIdList.h	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/bytecode/PolymorphicGetByIdList.h	2015-09-03 21:11:59 UTC (rev 189288)
@@ -82,7 +82,7 @@
     
     bool doesCalls() const { return type() == Getter || type() == CustomGetter; }
     
-    bool visitWeak(VM&, RepatchBuffer&) const;
+    bool visitWeak(VM&) const;
 
 private:
     friend class CodeBlock;
@@ -115,7 +115,7 @@
     
     bool didSelfPatching() const; // Are any of the accesses SimpleInline?
     
-    bool visitWeak(VM&, RepatchBuffer&) const;
+    bool visitWeak(VM&) const;
 
 private:
     friend class CodeBlock;

Modified: trunk/Source/_javascript_Core/bytecode/PolymorphicPutByIdList.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/bytecode/PolymorphicPutByIdList.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/bytecode/PolymorphicPutByIdList.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -63,7 +63,7 @@
     return result;
 }
 
-bool PutByIdAccess::visitWeak(VM& vm, RepatchBuffer& repatchBuffer) const
+bool PutByIdAccess::visitWeak(VM& vm) const
 {
     if (!m_conditionSet.areStillLive())
         return false;
@@ -88,7 +88,7 @@
         RELEASE_ASSERT_NOT_REACHED();
         return false;
     }
-    if (!m_stubRoutine->visitWeak(vm, repatchBuffer))
+    if (!m_stubRoutine->visitWeak(vm))
         return false;
     return true;
 }
@@ -142,10 +142,10 @@
     m_list.last() = putByIdAccess;
 }
 
-bool PolymorphicPutByIdList::visitWeak(VM& vm, RepatchBuffer& repatchBuffer) const
+bool PolymorphicPutByIdList::visitWeak(VM& vm) const
 {
     for (unsigned i = 0; i < size(); ++i) {
-        if (!at(i).visitWeak(vm, repatchBuffer))
+        if (!at(i).visitWeak(vm))
             return false;
     }
     return true;

Modified: trunk/Source/_javascript_Core/bytecode/PolymorphicPutByIdList.h (189287 => 189288)


--- trunk/Source/_javascript_Core/bytecode/PolymorphicPutByIdList.h	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/bytecode/PolymorphicPutByIdList.h	2015-09-03 21:11:59 UTC (rev 189288)
@@ -156,7 +156,7 @@
         return m_customSetter;
     }
 
-    bool visitWeak(VM&, RepatchBuffer&) const;
+    bool visitWeak(VM&) const;
     
 private:
     friend class CodeBlock;
@@ -194,7 +194,7 @@
     
     PutKind kind() const { return m_kind; }
     
-    bool visitWeak(VM&, RepatchBuffer&) const;
+    bool visitWeak(VM&) const;
     
 private:
     friend class CodeBlock;

Modified: trunk/Source/_javascript_Core/bytecode/StructureStubInfo.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/bytecode/StructureStubInfo.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/bytecode/StructureStubInfo.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -63,7 +63,7 @@
     }
 }
 
-bool StructureStubInfo::visitWeakReferences(VM& vm, RepatchBuffer& repatchBuffer)
+bool StructureStubInfo::visitWeakReferences(VM& vm)
 {
     switch (accessType) {
     case access_get_by_id_self:
@@ -71,7 +71,7 @@
             return false;
         break;
     case access_get_by_id_list: {
-        if (!u.getByIdList.list->visitWeak(vm, repatchBuffer))
+        if (!u.getByIdList.list->visitWeak(vm))
             return false;
         break;
     }
@@ -88,7 +88,7 @@
             return false;
         break;
     case access_put_by_id_list:
-        if (!u.putByIdList.list->visitWeak(vm, repatchBuffer))
+        if (!u.putByIdList.list->visitWeak(vm))
             return false;
         break;
     case access_in_list: {

Modified: trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h (189287 => 189288)


--- trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h	2015-09-03 21:11:59 UTC (rev 189288)
@@ -165,7 +165,7 @@
     // outgoing GC pointers are known to point to currently marked objects; this method is
     // allowed to accomplish this by either clearing those pointers somehow or by proving that
     // they have already been marked. It is not allowed to mark new objects.
-    bool visitWeakReferences(VM&, RepatchBuffer&);
+    bool visitWeakReferences(VM&);
         
     bool seenOnce()
     {

Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExitCompiler.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/dfg/DFGOSRExitCompiler.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExitCompiler.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -35,7 +35,6 @@
 #include "LinkBuffer.h"
 #include "OperandsInlines.h"
 #include "JSCInlines.h"
-#include "RepatchBuffer.h"
 #include <wtf/StringPrintStream.h>
 
 namespace JSC { namespace DFG {
@@ -167,10 +166,7 @@
                 toCString(ignoringContext<DumpContext>(operands)).data()));
     }
     
-    {
-        RepatchBuffer repatchBuffer(codeBlock);
-        repatchBuffer.relink(exit.codeLocationForRepatch(codeBlock), CodeLocationLabel(exit.m_code.code()));
-    }
+    MacroAssembler::repatchJump(exit.codeLocationForRepatch(codeBlock), CodeLocationLabel(exit.m_code.code()));
     
     vm->osrExitJumpDestination = exit.m_code.code().executableAddress();
 }

Modified: trunk/Source/_javascript_Core/ftl/FTLCompile.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/ftl/FTLCompile.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/ftl/FTLCompile.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -44,7 +44,6 @@
 #include "JITStubs.h"
 #include "LLVMAPI.h"
 #include "LinkBuffer.h"
-#include "RepatchBuffer.h"
 
 namespace JSC { namespace FTL {
 
@@ -619,8 +618,6 @@
         });
     }
     
-    RepatchBuffer repatchBuffer(codeBlock);
-
     auto iter = recordMap.find(state.handleStackOverflowExceptionStackmapID);
     // It's sort of remotely possible that we won't have an in-band exception handling
     // path, for some kinds of functions.
@@ -633,7 +630,7 @@
 
             RELEASE_ASSERT(stackOverflowException.isSet());
 
-            repatchBuffer.replaceWithJump(source, state.finalizer->handleExceptionsLinkBuffer->locationOf(stackOverflowException));
+            MacroAssembler::replaceWithJump(source, state.finalizer->handleExceptionsLinkBuffer->locationOf(stackOverflowException));
         }
     }
     
@@ -647,7 +644,7 @@
             CodeLocationLabel source = CodeLocationLabel(
                 bitwise_cast<char*>(generatedFunction) + record.instructionOffset);
             
-            repatchBuffer.replaceWithJump(source, state.finalizer->handleExceptionsLinkBuffer->entrypoint());
+            MacroAssembler::replaceWithJump(source, state.finalizer->handleExceptionsLinkBuffer->entrypoint());
         }
     }
     
@@ -670,7 +667,7 @@
                 if (info.m_isInvalidationPoint)
                     jitCode->common.jumpReplacements.append(JumpReplacement(source, info.m_thunkAddress));
                 else
-                    repatchBuffer.replaceWithJump(source, info.m_thunkAddress);
+                    MacroAssembler::replaceWithJump(source, info.m_thunkAddress);
             }
         }
         

Modified: trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -41,7 +41,6 @@
 #include "OperandsInlines.h"
 #include "JSCInlines.h"
 #include "RegisterPreservationWrapperGenerator.h"
-#include "RepatchBuffer.h"
 
 namespace JSC { namespace FTL {
 
@@ -523,8 +522,7 @@
     
     compileStub(exitID, jitCode, exit, vm, codeBlock);
     
-    RepatchBuffer repatchBuffer(codeBlock);
-    repatchBuffer.relink(
+    MacroAssembler::repatchJump(
         exit.codeLocationForRepatch(codeBlock), CodeLocationLabel(exit.m_code.code()));
     
     return exit.m_code.code().executableAddress();

Modified: trunk/Source/_javascript_Core/jit/AccessorCallJITStubRoutine.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/jit/AccessorCallJITStubRoutine.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/jit/AccessorCallJITStubRoutine.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -43,9 +43,9 @@
 {
 }
 
-bool AccessorCallJITStubRoutine::visitWeak(VM& vm, RepatchBuffer& repatchBuffer)
+bool AccessorCallJITStubRoutine::visitWeak(VM& vm)
 {
-    m_callLinkInfo->visitWeak(vm, repatchBuffer);
+    m_callLinkInfo->visitWeak(vm);
     return true;
 }
 

Modified: trunk/Source/_javascript_Core/jit/AccessorCallJITStubRoutine.h (189287 => 189288)


--- trunk/Source/_javascript_Core/jit/AccessorCallJITStubRoutine.h	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/jit/AccessorCallJITStubRoutine.h	2015-09-03 21:11:59 UTC (rev 189288)
@@ -44,7 +44,7 @@
     
     virtual ~AccessorCallJITStubRoutine();
     
-    virtual bool visitWeak(VM&, RepatchBuffer&) override;
+    virtual bool visitWeak(VM&) override;
     
     std::unique_ptr<CallLinkInfo> m_callLinkInfo;
 };

Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/jit/JIT.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -42,7 +42,6 @@
 #include "MaxFrameExtentForSlowPathCall.h"
 #include "JSCInlines.h"
 #include "ProfilerDatabase.h"
-#include "RepatchBuffer.h"
 #include "ResultType.h"
 #include "SamplingTool.h"
 #include "SlowPathCall.h"
@@ -54,24 +53,13 @@
 
 namespace JSC {
 
-void ctiPatchNearCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction)
+void ctiPatchCallByReturnAddress(ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction)
 {
-    RepatchBuffer repatchBuffer(codeblock);
-    repatchBuffer.relinkNearCallerToTrampoline(returnAddress, newCalleeFunction);
+    MacroAssembler::repatchCall(
+        CodeLocationCall(MacroAssemblerCodePtr(returnAddress)),
+        newCalleeFunction);
 }
 
-void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction)
-{
-    RepatchBuffer repatchBuffer(codeblock);
-    repatchBuffer.relinkCallerToTrampoline(returnAddress, newCalleeFunction);
-}
-
-void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction)
-{
-    RepatchBuffer repatchBuffer(codeblock);
-    repatchBuffer.relinkCallerToFunction(returnAddress, newCalleeFunction);
-}
-
 JIT::JIT(VM* vm, CodeBlock* codeBlock)
     : JSInterfaceJIT(vm, codeBlock)
     , m_interpreter(vm->interpreter)

Modified: trunk/Source/_javascript_Core/jit/JIT.h (189287 => 189288)


--- trunk/Source/_javascript_Core/jit/JIT.h	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/jit/JIT.h	2015-09-03 21:11:59 UTC (rev 189288)
@@ -180,10 +180,7 @@
         CallLinkInfo* callLinkInfo;
     };
 
-    // Near calls can only be patched to other JIT code, regular calls can be patched to JIT code or relinked to stub functions.
-    void ctiPatchNearCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction);
-    void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction);
-    void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction);
+    void ctiPatchCallByReturnAddress(ReturnAddressPtr, FunctionPtr newCalleeFunction);
 
     class JIT : private JSInterfaceJIT {
         friend class JITSlowPathCall;

Modified: trunk/Source/_javascript_Core/jit/JITCall.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/jit/JITCall.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/jit/JITCall.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -36,7 +36,6 @@
 #include "Interpreter.h"
 #include "JSCInlines.h"
 #include "LinkBuffer.h"
-#include "RepatchBuffer.h"
 #include "ResultType.h"
 #include "SamplingTool.h"
 #include "SetupVarargsFrame.h"

Modified: trunk/Source/_javascript_Core/jit/JITCall32_64.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/jit/JITCall32_64.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/jit/JITCall32_64.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -36,7 +36,6 @@
 #include "JSFunction.h"
 #include "JSCInlines.h"
 #include "LinkBuffer.h"
-#include "RepatchBuffer.h"
 #include "ResultType.h"
 #include "SamplingTool.h"
 #include "SetupVarargsFrame.h"

Modified: trunk/Source/_javascript_Core/jit/JITOpcodes.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -41,7 +41,6 @@
 #include "JSPropertyNameEnumerator.h"
 #include "LinkBuffer.h"
 #include "MaxFrameExtentForSlowPathCall.h"
-#include "RepatchBuffer.h"
 #include "SlowPathCall.h"
 #include "TypeLocation.h"
 #include "TypeProfilerLog.h"
@@ -1085,9 +1084,8 @@
         m_codeBlock, patchBuffer,
         ("Baseline has_indexed_property stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value()));
     
-    RepatchBuffer repatchBuffer(m_codeBlock);
-    repatchBuffer.relink(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
-    repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(operationHasIndexedPropertyGeneric));
+    MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
+    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationHasIndexedPropertyGeneric));
 }
 
 void JIT::emit_op_has_indexed_property(Instruction* currentInstruction)

Modified: trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009, 2012, 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 2012, 2013, 2014, 2015 Apple Inc. All rights reserved.
  * Copyright (C) 2010 Patrick Gansterer <[email protected]>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,6 @@
 #include "JSPropertyNameEnumerator.h"
 #include "LinkBuffer.h"
 #include "MaxFrameExtentForSlowPathCall.h"
-#include "RepatchBuffer.h"
 #include "SlowPathCall.h"
 #include "TypeProfilerLog.h"
 #include "VirtualRegister.h"
@@ -1065,9 +1064,8 @@
         m_codeBlock, patchBuffer,
         ("Baseline has_indexed_property stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value()));
     
-    RepatchBuffer repatchBuffer(m_codeBlock);
-    repatchBuffer.relink(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
-    repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(operationHasIndexedPropertyGeneric));
+    MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
+    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationHasIndexedPropertyGeneric));
 }
 
 void JIT::emit_op_has_indexed_property(Instruction* currentInstruction)

Modified: trunk/Source/_javascript_Core/jit/JITOperations.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/jit/JITOperations.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/jit/JITOperations.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -54,7 +54,6 @@
 #include "ObjectConstructor.h"
 #include "PropertyName.h"
 #include "Repatch.h"
-#include "RepatchBuffer.h"
 #include "ScopedArguments.h"
 #include "TestRunnerUtils.h"
 #include "TypeProfilerLog.h"
@@ -646,7 +645,7 @@
     if (tryPutByValOptimize(exec, baseValue, subscript, byValInfo, ReturnAddressPtr(OUR_RETURN_ADDRESS)) == OptimizationResult::GiveUp) {
         // Don't ever try to optimize.
         byValInfo->tookSlowPath = true;
-        ctiPatchCallByReturnAddress(exec->codeBlock(), ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationPutByValGeneric));
+        ctiPatchCallByReturnAddress(ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationPutByValGeneric));
     }
     putByVal(exec, baseValue, subscript, value, byValInfo);
 }
@@ -728,7 +727,7 @@
     if (tryDirectPutByValOptimize(exec, object, subscript, byValInfo, ReturnAddressPtr(OUR_RETURN_ADDRESS)) == OptimizationResult::GiveUp) {
         // Don't ever try to optimize.
         byValInfo->tookSlowPath = true;
-        ctiPatchCallByReturnAddress(exec->codeBlock(), ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationDirectPutByValGeneric));
+        ctiPatchCallByReturnAddress(ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationDirectPutByValGeneric));
     }
 
     directPutByVal(exec, object, subscript, value, byValInfo);
@@ -1593,7 +1592,7 @@
         uint32_t i = subscript.asUInt32();
         if (isJSString(baseValue)) {
             if (asString(baseValue)->canGetIndex(i)) {
-                ctiPatchCallByReturnAddress(exec->codeBlock(), returnAddress, FunctionPtr(operationGetByValString));
+                ctiPatchCallByReturnAddress(returnAddress, FunctionPtr(operationGetByValString));
                 return asString(baseValue)->getIndex(exec, i);
             }
             byValInfo->arrayProfile->setOutOfBounds();
@@ -1716,7 +1715,7 @@
     if (tryGetByValOptimize(exec, baseValue, subscript, byValInfo, returnAddress) == OptimizationResult::GiveUp) {
         // Don't ever try to optimize.
         byValInfo->tookSlowPath = true;
-        ctiPatchCallByReturnAddress(exec->codeBlock(), returnAddress, FunctionPtr(operationGetByValGeneric));
+        ctiPatchCallByReturnAddress(returnAddress, FunctionPtr(operationGetByValGeneric));
     }
 
     return JSValue::encode(getByVal(exec, baseValue, subscript, byValInfo, returnAddress));
@@ -1756,7 +1755,7 @@
         if (++byValInfo->slowPathCount >= 10
             || object->structure(vm)->typeInfo().interceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero()) {
             // Don't ever try to optimize.
-            ctiPatchCallByReturnAddress(exec->codeBlock(), ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationHasIndexedPropertyGeneric));
+            ctiPatchCallByReturnAddress(ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationHasIndexedPropertyGeneric));
         }
     }
 
@@ -1805,7 +1804,7 @@
             result = baseValue.get(exec, i);
             if (!isJSString(baseValue)) {
                 ASSERT(exec->bytecodeOffset());
-                ctiPatchCallByReturnAddress(exec->codeBlock(), ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(byValInfo->stubRoutine ? operationGetByValGeneric : operationGetByValOptimize));
+                ctiPatchCallByReturnAddress(ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(byValInfo->stubRoutine ? operationGetByValGeneric : operationGetByValOptimize));
             }
         }
     } else {

Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -38,7 +38,6 @@
 #include "JSEnvironmentRecord.h"
 #include "JSFunction.h"
 #include "LinkBuffer.h"
-#include "RepatchBuffer.h"
 #include "ResultType.h"
 #include "SamplingTool.h"
 #include "ScopedArguments.h"
@@ -1115,9 +1114,8 @@
         m_codeBlock, patchBuffer,
         ("Baseline get_by_val stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value()));
     
-    RepatchBuffer repatchBuffer(m_codeBlock);
-    repatchBuffer.relink(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
-    repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(operationGetByValGeneric));
+    MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
+    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationGetByValGeneric));
 }
 
 void JIT::privateCompileGetByValWithCachedId(ByValInfo* byValInfo, ReturnAddressPtr returnAddress, const Identifier& propertyName)
@@ -1147,9 +1145,8 @@
         ("Baseline get_by_val with cached property name '%s' stub for %s, return point %p", propertyName.impl()->utf8().data(), toCString(*m_codeBlock).data(), returnAddress.value()));
     byValInfo->stubInfo = gen.stubInfo();
 
-    RepatchBuffer repatchBuffer(m_codeBlock);
-    repatchBuffer.relink(byValInfo->notIndexJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
-    repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(operationGetByValGeneric));
+    MacroAssembler::repatchJump(byValInfo->notIndexJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
+    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationGetByValGeneric));
 }
 
 void JIT::privateCompilePutByVal(ByValInfo* byValInfo, ReturnAddressPtr returnAddress, JITArrayMode arrayMode)
@@ -1215,9 +1212,8 @@
             m_codeBlock, patchBuffer,
             ("Baseline put_by_val_direct stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value()));
     }
-    RepatchBuffer repatchBuffer(m_codeBlock);
-    repatchBuffer.relink(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
-    repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(isDirect ? operationDirectPutByValGeneric : operationPutByValGeneric));
+    MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
+    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(isDirect ? operationDirectPutByValGeneric : operationPutByValGeneric));
 }
 
 void JIT::privateCompilePutByValWithCachedId(ByValInfo* byValInfo, ReturnAddressPtr returnAddress, PutKind putKind, const Identifier& propertyName)
@@ -1244,9 +1240,8 @@
         ("Baseline put_by_val%s with cached property name '%s' stub for %s, return point %p", (putKind == Direct) ? "_direct" : "", propertyName.impl()->utf8().data(), toCString(*m_codeBlock).data(), returnAddress.value()));
     byValInfo->stubInfo = gen.stubInfo();
 
-    RepatchBuffer repatchBuffer(m_codeBlock);
-    repatchBuffer.relink(byValInfo->notIndexJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
-    repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(putKind == Direct ? operationDirectPutByValGeneric : operationPutByValGeneric));
+    MacroAssembler::repatchJump(byValInfo->notIndexJump, CodeLocationLabel(byValInfo->stubRoutine->code().code()));
+    MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(putKind == Direct ? operationDirectPutByValGeneric : operationPutByValGeneric));
 }
 
 

Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess32_64.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -38,7 +38,6 @@
 #include "JSEnvironmentRecord.h"
 #include "JSFunction.h"
 #include "LinkBuffer.h"
-#include "RepatchBuffer.h"
 #include "ResultType.h"
 #include "SamplingTool.h"
 #include "SlowPathCall.h"

Modified: trunk/Source/_javascript_Core/jit/JITStubRoutine.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/jit/JITStubRoutine.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/jit/JITStubRoutine.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -36,7 +36,7 @@
 
 JITStubRoutine::~JITStubRoutine() { }
 
-bool JITStubRoutine::visitWeak(VM&, RepatchBuffer&)
+bool JITStubRoutine::visitWeak(VM&)
 {
     return true;
 }

Modified: trunk/Source/_javascript_Core/jit/JITStubRoutine.h (189287 => 189288)


--- trunk/Source/_javascript_Core/jit/JITStubRoutine.h	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/jit/JITStubRoutine.h	2015-09-03 21:11:59 UTC (rev 189288)
@@ -144,7 +144,7 @@
     // Return true if you are still valid after. Return false if you are now invalid. If you return
     // false, you will usually not do any clearing because the idea is that you will simply be
     // destroyed.
-    virtual bool visitWeak(VM&, RepatchBuffer&);
+    virtual bool visitWeak(VM&);
 
 protected:
     virtual void observeZeroRefCount();

Modified: trunk/Source/_javascript_Core/jit/PolymorphicCallStubRoutine.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/jit/PolymorphicCallStubRoutine.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/jit/PolymorphicCallStubRoutine.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -41,13 +41,13 @@
         remove();
 }
 
-void PolymorphicCallNode::unlink(VM& vm, RepatchBuffer& repatchBuffer)
+void PolymorphicCallNode::unlink(VM& vm)
 {
     if (m_callLinkInfo) {
         if (Options::showDisassembly())
             dataLog("Unlinking polymorphic call at ", m_callLinkInfo->callReturnLocation(), ", ", m_callLinkInfo->codeOrigin(), "\n");
 
-        m_callLinkInfo->unlink(vm, repatchBuffer);
+        m_callLinkInfo->unlink(vm);
     }
 
     if (isOnList())
@@ -117,7 +117,7 @@
     }
 }
 
-bool PolymorphicCallStubRoutine::visitWeak(VM&, RepatchBuffer&)
+bool PolymorphicCallStubRoutine::visitWeak(VM&)
 {
     for (auto& variant : m_variants) {
         if (!Heap::isMarked(variant.get()))

Modified: trunk/Source/_javascript_Core/jit/PolymorphicCallStubRoutine.h (189287 => 189288)


--- trunk/Source/_javascript_Core/jit/PolymorphicCallStubRoutine.h	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/jit/PolymorphicCallStubRoutine.h	2015-09-03 21:11:59 UTC (rev 189288)
@@ -50,7 +50,7 @@
     
     ~PolymorphicCallNode();
     
-    void unlink(VM&, RepatchBuffer&);
+    void unlink(VM&);
 
     bool hasCallLinkInfo(CallLinkInfo* info) { return m_callLinkInfo == info; }
     void clearCallLinkInfo();
@@ -96,7 +96,7 @@
 
     void clearCallNodesFor(CallLinkInfo*);
     
-    bool visitWeak(VM&, RepatchBuffer&) override;
+    bool visitWeak(VM&) override;
 
 protected:
     virtual void markRequiredObjectsInternal(SlotVisitor&) override;

Modified: trunk/Source/_javascript_Core/jit/Repatch.cpp (189287 => 189288)


--- trunk/Source/_javascript_Core/jit/Repatch.cpp	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/jit/Repatch.cpp	2015-09-03 21:11:59 UTC (rev 189288)
@@ -43,7 +43,6 @@
 #include "PolymorphicGetByIdList.h"
 #include "PolymorphicPutByIdList.h"
 #include "RegExpMatchesArray.h"
-#include "RepatchBuffer.h"
 #include "ScratchRegisterAllocator.h"
 #include "StackAlignment.h"
 #include "StructureRareDataInlines.h"
@@ -75,7 +74,7 @@
     return result;
 }
 
-static void repatchCall(RepatchBuffer& repatchBuffer, CodeBlock* codeBlock, CodeLocationCall call, FunctionPtr newCalleeFunction)
+static void repatchCall(CodeBlock* codeBlock, CodeLocationCall call, FunctionPtr newCalleeFunction)
 {
 #if ENABLE(FTL_JIT)
     if (codeBlock->jitType() == JITCode::FTLJIT) {
@@ -91,15 +90,9 @@
 #else // ENABLE(FTL_JIT)
     UNUSED_PARAM(codeBlock);
 #endif // ENABLE(FTL_JIT)
-    repatchBuffer.relink(call, newCalleeFunction);
+    MacroAssembler::repatchCall(call, newCalleeFunction);
 }
 
-static void repatchCall(CodeBlock* codeBlock, CodeLocationCall call, FunctionPtr newCalleeFunction)
-{
-    RepatchBuffer repatchBuffer(codeBlock);
-    repatchCall(repatchBuffer, codeBlock, call, newCalleeFunction);
-}
-
 static void repatchByIdSelfAccess(
     VM& vm, CodeBlock* codeBlock, StructureStubInfo& stubInfo, Structure* structure,
     const Identifier& propertyName, PropertyOffset offset, const FunctionPtr &slowPathFunction,
@@ -108,26 +101,30 @@
     if (structure->needImpurePropertyWatchpoint())
         vm.registerWatchpointForImpureProperty(propertyName, stubInfo.addWatchpoint(codeBlock));
     
-    RepatchBuffer repatchBuffer(codeBlock);
-
     // Only optimize once!
-    repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, slowPathFunction);
+    repatchCall(codeBlock, stubInfo.callReturnLocation, slowPathFunction);
 
     // Patch the structure check & the offset of the load.
-    repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(-(intptr_t)stubInfo.patch.deltaCheckImmToCall), bitwise_cast<int32_t>(structure->id()));
-    repatchBuffer.setLoadInstructionIsActive(stubInfo.callReturnLocation.convertibleLoadAtOffset(stubInfo.patch.deltaCallToStorageLoad), isOutOfLineOffset(offset));
+    MacroAssembler::repatchInt32(
+        stubInfo.callReturnLocation.dataLabel32AtOffset(-(intptr_t)stubInfo.patch.deltaCheckImmToCall),
+        bitwise_cast<int32_t>(structure->id()));
+    CodeLocationConvertibleLoad convertibleLoad = stubInfo.callReturnLocation.convertibleLoadAtOffset(stubInfo.patch.deltaCallToStorageLoad);
+    if (isOutOfLineOffset(offset))
+        MacroAssembler::replaceWithLoad(convertibleLoad);
+    else
+        MacroAssembler::replaceWithAddressComputation(convertibleLoad);
 #if USE(JSVALUE64)
     if (compact)
-        repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToLoadOrStore), offsetRelativeToPatchedStorage(offset));
+        MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToLoadOrStore), offsetRelativeToPatchedStorage(offset));
     else
-        repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToLoadOrStore), offsetRelativeToPatchedStorage(offset));
+        MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToLoadOrStore), offsetRelativeToPatchedStorage(offset));
 #elif USE(JSVALUE32_64)
     if (compact) {
-        repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag));
-        repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));
+        MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag));
+        MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));
     } else {
-        repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag));
-        repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));
+        MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag));
+        MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));
     }
 #endif
 }
@@ -161,18 +158,18 @@
     }
 }
 
-static void replaceWithJump(RepatchBuffer& repatchBuffer, StructureStubInfo& stubInfo, const MacroAssemblerCodePtr target)
+static void replaceWithJump(StructureStubInfo& stubInfo, const MacroAssemblerCodePtr target)
 {
     if (MacroAssembler::canJumpReplacePatchableBranch32WithPatch()) {
-        repatchBuffer.replaceWithJump(
-            RepatchBuffer::startOfPatchableBranch32WithPatchOnAddress(
+        MacroAssembler::replaceWithJump(
+            MacroAssembler::startOfPatchableBranch32WithPatchOnAddress(
                 stubInfo.callReturnLocation.dataLabel32AtOffset(
                     -(intptr_t)stubInfo.patch.deltaCheckImmToCall)),
             CodeLocationLabel(target));
         return;
     }
     
-    repatchBuffer.relink(
+    MacroAssembler::repatchJump(
         stubInfo.callReturnLocation.jumpAtOffset(
             stubInfo.patch.deltaCallToJump),
         CodeLocationLabel(target));
@@ -681,9 +678,8 @@
                     toCString(*exec->codeBlock()).data(), stubInfo.callReturnLocation.labelAtOffset(
                         stubInfo.patch.deltaCallToDone).executableAddress()));
 
-            RepatchBuffer repatchBuffer(codeBlock);
-            replaceWithJump(repatchBuffer, stubInfo, stubInfo.stubRoutine->code().code());
-            repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, operationGetById);
+            replaceWithJump(stubInfo, stubInfo.stubRoutine->code().code());
+            repatchCall(codeBlock, stubInfo.callReturnLocation, operationGetById);
 
             return RetryCacheLater;
         }
@@ -714,9 +710,8 @@
                 toCString(*exec->codeBlock()).data(), stubInfo.callReturnLocation.labelAtOffset(
                     stubInfo.patch.deltaCallToDone).executableAddress()));
 
-        RepatchBuffer repatchBuffer(codeBlock);
-        replaceWithJump(repatchBuffer, stubInfo, stubInfo.stubRoutine->code().code());
-        repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, operationGetById);
+        replaceWithJump(stubInfo, stubInfo.stubRoutine->code().code());
+        repatchCall(codeBlock, stubInfo.callReturnLocation, operationGetById);
 
         return RetryCacheLater;
     }
@@ -758,19 +753,18 @@
         repatchCall(exec->codeBlock(), stubInfo.callReturnLocation, operationGetById);
 }
 
-static void patchJumpToGetByIdStub(CodeBlock* codeBlock, StructureStubInfo& stubInfo, JITStubRoutine* stubRoutine)
+static void patchJumpToGetByIdStub(StructureStubInfo& stubInfo, JITStubRoutine* stubRoutine)
 {
     RELEASE_ASSERT(stubInfo.accessType == access_get_by_id_list);
-    RepatchBuffer repatchBuffer(codeBlock);
     if (stubInfo.u.getByIdList.list->didSelfPatching()) {
-        repatchBuffer.relink(
+        MacroAssembler::repatchJump(
             stubInfo.callReturnLocation.jumpAtOffset(
                 stubInfo.patch.deltaCallToJump),
             CodeLocationLabel(stubRoutine->code().code()));
         return;
     }
     
-    replaceWithJump(repatchBuffer, stubInfo, stubRoutine->code().code());
+    replaceWithJump(stubInfo, stubRoutine->code().code());
 }
 
 static InlineCacheAction tryBuildGetByIDList(ExecState* exec, JSValue baseValue, const Identifier& ident, const PropertySlot& slot, StructureStubInfo& stubInfo)
@@ -852,7 +846,7 @@
         *vm, codeBlock->ownerExecutable(), accessType, stubRoutine, structure,
         conditionSet));
     
-    patchJumpToGetByIdStub(codeBlock, stubInfo, stubRoutine.get());
+    patchJumpToGetByIdStub(stubInfo, stubRoutine.get());
     
     return list->isFull() ? GiveUpOnCache : RetryCacheLater;
 }
@@ -1257,13 +1251,12 @@
             ObjectPropertyConditionSet conditionSet;
             if (!emitPutTransitionStub(exec, vm, structure, ident, slot, stubInfo, putKind, oldStructure, conditionSet))
                 return GiveUpOnCache;
-            
-            RepatchBuffer repatchBuffer(codeBlock);
-            repatchBuffer.relink(
+
+            MacroAssembler::repatchJump(
                 stubInfo.callReturnLocation.jumpAtOffset(
                     stubInfo.patch.deltaCallToJump),
                 CodeLocationLabel(stubInfo.stubRoutine->code().code()));
-            repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, appropriateListBuildingPutByIdFunction(slot, putKind));
+            repatchCall(codeBlock, stubInfo.callReturnLocation, appropriateListBuildingPutByIdFunction(slot, putKind));
             
             stubInfo.initPutByIdTransition(*vm, codeBlock->ownerExecutable(), oldStructure, structure, conditionSet, putKind == Direct);
             
@@ -1320,9 +1313,8 @@
             slot.isCacheableSetter() ? PutByIdAccess::Setter : PutByIdAccess::CustomSetter,
             structure, conditionSet, slot.customSetter(), stubRoutine));
 
-        RepatchBuffer repatchBuffer(codeBlock);
-        repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code()));
-        repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, appropriateListBuildingPutByIdFunction(slot, putKind));
+        MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code()));
+        repatchCall(codeBlock, stubInfo.callReturnLocation, appropriateListBuildingPutByIdFunction(slot, putKind));
         RELEASE_ASSERT(!list->isFull());
         return RetryCacheLater;
     }
@@ -1393,10 +1385,9 @@
                     *vm, codeBlock->ownerExecutable(),
                     structure, stubRoutine));
         }
-        RepatchBuffer repatchBuffer(codeBlock);
-        repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code()));
+        MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code()));
         if (list->isFull())
-            repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, appropriateGenericPutByIdFunction(slot, putKind));
+            repatchCall(codeBlock, stubInfo.callReturnLocation, appropriateGenericPutByIdFunction(slot, putKind));
 
         return RetryCacheLater;
     }
@@ -1442,10 +1433,9 @@
             slot.isCacheableSetter() ? PutByIdAccess::Setter : PutByIdAccess::CustomSetter,
             structure, conditionSet, slot.customSetter(), stubRoutine));
 
-        RepatchBuffer repatchBuffer(codeBlock);
-        repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code()));
+        MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code()));
         if (list->isFull())
-            repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, appropriateGenericPutByIdFunction(slot, putKind));
+            repatchCall(codeBlock, stubInfo.callReturnLocation, appropriateGenericPutByIdFunction(slot, putKind));
 
         return RetryCacheLater;
     }
@@ -1573,8 +1563,7 @@
     polymorphicStructureList->list[listIndex].set(*vm, codeBlock->ownerExecutable(), stubRoutine, structure, true);
     stubInfo.u.inList.listSize++;
     
-    RepatchBuffer repatchBuffer(codeBlock);
-    repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code()));
+    MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code()));
     
     return listIndex < (POLYMORPHIC_LIST_CACHE_SIZE - 1) ? RetryCacheLater : GiveUpOnCache;
 }
@@ -1587,24 +1576,20 @@
         repatchCall(exec->codeBlock(), stubInfo.callReturnLocation, operationIn);
 }
 
-static void linkSlowFor(
-    RepatchBuffer& repatchBuffer, VM*, CallLinkInfo& callLinkInfo, MacroAssemblerCodeRef codeRef)
+static void linkSlowFor(VM*, CallLinkInfo& callLinkInfo, MacroAssemblerCodeRef codeRef)
 {
-    repatchBuffer.relink(
-        callLinkInfo.callReturnLocation(), codeRef.code());
+    MacroAssembler::repatchNearCall(callLinkInfo.callReturnLocation(), CodeLocationLabel(codeRef.code()));
 }
 
-static void linkSlowFor(
-    RepatchBuffer& repatchBuffer, VM* vm, CallLinkInfo& callLinkInfo, ThunkGenerator generator)
+static void linkSlowFor(VM* vm, CallLinkInfo& callLinkInfo, ThunkGenerator generator)
 {
-    linkSlowFor(repatchBuffer, vm, callLinkInfo, vm->getCTIStub(generator));
+    linkSlowFor(vm, callLinkInfo, vm->getCTIStub(generator));
 }
 
-static void linkSlowFor(
-    RepatchBuffer& repatchBuffer, VM* vm, CallLinkInfo& callLinkInfo)
+static void linkSlowFor(VM* vm, CallLinkInfo& callLinkInfo)
 {
     MacroAssemblerCodeRef virtualThunk = virtualThunkFor(vm, callLinkInfo);
-    linkSlowFor(repatchBuffer, vm, callLinkInfo, virtualThunk);
+    linkSlowFor(vm, callLinkInfo, virtualThunk);
     callLinkInfo.setSlowStub(createJITStubRoutine(virtualThunk, *vm, nullptr, true));
 }
 
@@ -1618,26 +1603,23 @@
 
     VM* vm = callerCodeBlock->vm();
     
-    RepatchBuffer repatchBuffer(callerCodeBlock);
-    
     ASSERT(!callLinkInfo.isLinked());
     callLinkInfo.setCallee(exec->callerFrame()->vm(), callLinkInfo.hotPathBegin(), callerCodeBlock->ownerExecutable(), callee);
     callLinkInfo.setLastSeenCallee(exec->callerFrame()->vm(), callerCodeBlock->ownerExecutable(), callee);
     if (shouldShowDisassemblyFor(callerCodeBlock))
         dataLog("Linking call in ", *callerCodeBlock, " at ", callLinkInfo.codeOrigin(), " to ", pointerDump(calleeCodeBlock), ", entrypoint at ", codePtr, "\n");
-    repatchBuffer.relink(callLinkInfo.hotPathOther(), codePtr);
+    MacroAssembler::repatchNearCall(callLinkInfo.hotPathOther(), CodeLocationLabel(codePtr));
     
     if (calleeCodeBlock)
         calleeCodeBlock->linkIncomingCall(exec->callerFrame(), &callLinkInfo);
     
     if (callLinkInfo.specializationKind() == CodeForCall) {
-        linkSlowFor(
-            repatchBuffer, vm, callLinkInfo, linkPolymorphicCallThunkGenerator);
+        linkSlowFor(vm, callLinkInfo, linkPolymorphicCallThunkGenerator);
         return;
     }
     
     ASSERT(callLinkInfo.specializationKind() == CodeForConstruct);
-    linkSlowFor(repatchBuffer, vm, callLinkInfo);
+    linkSlowFor(vm, callLinkInfo);
 }
 
 void linkSlowFor(
@@ -1646,18 +1628,15 @@
     CodeBlock* callerCodeBlock = exec->callerFrame()->codeBlock();
     VM* vm = callerCodeBlock->vm();
     
-    RepatchBuffer repatchBuffer(callerCodeBlock);
-    
-    linkSlowFor(repatchBuffer, vm, callLinkInfo);
+    linkSlowFor(vm, callLinkInfo);
 }
 
-static void revertCall(
-    RepatchBuffer& repatchBuffer, VM* vm, CallLinkInfo& callLinkInfo, MacroAssemblerCodeRef codeRef)
+static void revertCall(VM* vm, CallLinkInfo& callLinkInfo, MacroAssemblerCodeRef codeRef)
 {
-    repatchBuffer.revertJumpReplacementToBranchPtrWithPatch(
-        RepatchBuffer::startOfBranchPtrWithPatchOnRegister(callLinkInfo.hotPathBegin()),
+    MacroAssembler::revertJumpReplacementToBranchPtrWithPatch(
+        MacroAssembler::startOfBranchPtrWithPatchOnRegister(callLinkInfo.hotPathBegin()),
         static_cast<MacroAssembler::RegisterID>(callLinkInfo.calleeGPR()), 0);
-    linkSlowFor(repatchBuffer, vm, callLinkInfo, codeRef);
+    linkSlowFor(vm, callLinkInfo, codeRef);
     callLinkInfo.clearSeen();
     callLinkInfo.clearCallee();
     callLinkInfo.clearStub();
@@ -1666,13 +1645,12 @@
         callLinkInfo.remove();
 }
 
-void unlinkFor(
-    VM& vm, RepatchBuffer& repatchBuffer, CallLinkInfo& callLinkInfo)
+void unlinkFor(VM& vm, CallLinkInfo& callLinkInfo)
 {
     if (Options::showDisassembly())
         dataLog("Unlinking call from ", callLinkInfo.callReturnLocation(), "\n");
     
-    revertCall(repatchBuffer, &vm, callLinkInfo, vm.getCTIStub(linkCallThunkGenerator));
+    revertCall(&vm, callLinkInfo, vm.getCTIStub(linkCallThunkGenerator));
 }
 
 void linkVirtualFor(
@@ -1684,9 +1662,8 @@
     if (shouldShowDisassemblyFor(callerCodeBlock))
         dataLog("Linking virtual call at ", *callerCodeBlock, " ", exec->callerFrame()->codeOrigin(), "\n");
     
-    RepatchBuffer repatchBuffer(callerCodeBlock);
     MacroAssemblerCodeRef virtualThunk = virtualThunkFor(vm, callLinkInfo);
-    revertCall(repatchBuffer, vm, callLinkInfo, virtualThunk);
+    revertCall(vm, callLinkInfo, virtualThunk);
     callLinkInfo.setSlowStub(createJITStubRoutine(virtualThunk, *vm, nullptr, true));
 }
 
@@ -1916,15 +1893,13 @@
         *vm, callerCodeBlock->ownerExecutable(), exec->callerFrame(), callLinkInfo, callCases,
         WTF::move(fastCounts)));
     
-    RepatchBuffer repatchBuffer(callerCodeBlock);
-    
-    repatchBuffer.replaceWithJump(
-        RepatchBuffer::startOfBranchPtrWithPatchOnRegister(callLinkInfo.hotPathBegin()),
+    MacroAssembler::replaceWithJump(
+        MacroAssembler::startOfBranchPtrWithPatchOnRegister(callLinkInfo.hotPathBegin()),
         CodeLocationLabel(stubRoutine->code().code()));
     // The original slow path is unreachable on 64-bits, but still
     // reachable on 32-bits since a non-cell callee will always
     // trigger the slow path
-    linkSlowFor(repatchBuffer, vm, callLinkInfo);
+    linkSlowFor(vm, callLinkInfo);
     
     // If there had been a previous stub routine, that one will die as soon as the GC runs and sees
     // that it's no longer on stack.
@@ -1936,29 +1911,29 @@
         callLinkInfo.remove();
 }
 
-void resetGetByID(RepatchBuffer& repatchBuffer, CodeBlock* codeBlock, StructureStubInfo& stubInfo)
+void resetGetByID(CodeBlock* codeBlock, StructureStubInfo& stubInfo)
 {
-    repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, operationGetByIdOptimize);
+    repatchCall(codeBlock, stubInfo.callReturnLocation, operationGetByIdOptimize);
     CodeLocationDataLabel32 structureLabel = stubInfo.callReturnLocation.dataLabel32AtOffset(-(intptr_t)stubInfo.patch.deltaCheckImmToCall);
     if (MacroAssembler::canJumpReplacePatchableBranch32WithPatch()) {
-        repatchBuffer.revertJumpReplacementToPatchableBranch32WithPatch(
-            RepatchBuffer::startOfPatchableBranch32WithPatchOnAddress(structureLabel),
+        MacroAssembler::revertJumpReplacementToPatchableBranch32WithPatch(
+            MacroAssembler::startOfPatchableBranch32WithPatchOnAddress(structureLabel),
             MacroAssembler::Address(
                 static_cast<MacroAssembler::RegisterID>(stubInfo.patch.baseGPR),
                 JSCell::structureIDOffset()),
             static_cast<int32_t>(unusedPointer));
     }
-    repatchBuffer.repatch(structureLabel, static_cast<int32_t>(unusedPointer));
+    MacroAssembler::repatchInt32(structureLabel, static_cast<int32_t>(unusedPointer));
 #if USE(JSVALUE64)
-    repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToLoadOrStore), 0);
+    MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToLoadOrStore), 0);
 #else
-    repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), 0);
-    repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), 0);
+    MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), 0);
+    MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), 0);
 #endif
-    repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase));
+    MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase));
 }
 
-void resetPutByID(RepatchBuffer& repatchBuffer, CodeBlock* codeBlock, StructureStubInfo& stubInfo)
+void resetPutByID(CodeBlock* codeBlock, StructureStubInfo& stubInfo)
 {
     V_JITOperation_ESsiJJI unoptimizedFunction = bitwise_cast<V_JITOperation_ESsiJJI>(readCallTarget(codeBlock, stubInfo.callReturnLocation).executableAddress());
     V_JITOperation_ESsiJJI optimizedFunction;
@@ -1972,29 +1947,29 @@
         ASSERT(unoptimizedFunction == operationPutByIdDirectNonStrict || unoptimizedFunction == operationPutByIdDirectNonStrictBuildList);
         optimizedFunction = operationPutByIdDirectNonStrictOptimize;
     }
-    repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, optimizedFunction);
+    repatchCall(codeBlock, stubInfo.callReturnLocation, optimizedFunction);
     CodeLocationDataLabel32 structureLabel = stubInfo.callReturnLocation.dataLabel32AtOffset(-(intptr_t)stubInfo.patch.deltaCheckImmToCall);
     if (MacroAssembler::canJumpReplacePatchableBranch32WithPatch()) {
-        repatchBuffer.revertJumpReplacementToPatchableBranch32WithPatch(
-            RepatchBuffer::startOfPatchableBranch32WithPatchOnAddress(structureLabel),
+        MacroAssembler::revertJumpReplacementToPatchableBranch32WithPatch(
+            MacroAssembler::startOfPatchableBranch32WithPatchOnAddress(structureLabel),
             MacroAssembler::Address(
                 static_cast<MacroAssembler::RegisterID>(stubInfo.patch.baseGPR),
                 JSCell::structureIDOffset()),
             static_cast<int32_t>(unusedPointer));
     }
-    repatchBuffer.repatch(structureLabel, static_cast<int32_t>(unusedPointer));
+    MacroAssembler::repatchInt32(structureLabel, static_cast<int32_t>(unusedPointer));
 #if USE(JSVALUE64)
-    repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToLoadOrStore), 0);
+    MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToLoadOrStore), 0);
 #else
-    repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), 0);
-    repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), 0);
+    MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), 0);
+    MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), 0);
 #endif
-    repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase));
+    MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase));
 }
 
-void resetIn(RepatchBuffer& repatchBuffer, CodeBlock*, StructureStubInfo& stubInfo)
+void resetIn(CodeBlock*, StructureStubInfo& stubInfo)
 {
-    repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase));
+    MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase));
 }
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/jit/Repatch.h (189287 => 189288)


--- trunk/Source/_javascript_Core/jit/Repatch.h	2015-09-03 21:11:44 UTC (rev 189287)
+++ trunk/Source/_javascript_Core/jit/Repatch.h	2015-09-03 21:11:59 UTC (rev 189288)
@@ -42,12 +42,12 @@
 void repatchIn(ExecState*, JSCell*, const Identifier&, bool wasFound, const PropertySlot&, StructureStubInfo&);
 void linkFor(ExecState*, CallLinkInfo&, CodeBlock*, JSFunction* callee, MacroAssemblerCodePtr);
 void linkSlowFor(ExecState*, CallLinkInfo&);
-void unlinkFor(VM&, RepatchBuffer&, CallLinkInfo&);
+void unlinkFor(VM&, CallLinkInfo&);
 void linkVirtualFor(ExecState*, CallLinkInfo&);
 void linkPolymorphicCall(ExecState*, CallLinkInfo&, CallVariant);
-void resetGetByID(RepatchBuffer&, CodeBlock*, StructureStubInfo&);
-void resetPutByID(RepatchBuffer&, CodeBlock*, StructureStubInfo&);
-void resetIn(RepatchBuffer&, CodeBlock*, StructureStubInfo&);
+void resetGetByID(CodeBlock*, StructureStubInfo&);
+void resetPutByID(CodeBlock*, StructureStubInfo&);
+void resetIn(CodeBlock*, StructureStubInfo&);
 
 } // namespace JSC
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to