Changeset 189288 in webkit
- Timestamp:
- Sep 3, 2015 2:11:59 PM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 1 deleted
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r189284 r189288 1 2015-09-03 Filip Pizlo <fpizlo@apple.com> 2 3 Get rid of RepatchBuffer and replace it with static functions 4 https://bugs.webkit.org/show_bug.cgi?id=148742 5 6 Reviewed by Geoffrey Garen and Mark Lam. 7 8 RepatchBuffer is an object that doesn't have any state. All of its instance methods are 9 just wrappers for methods on MacroAssembler. So, we should make those MacroAssembler 10 methods public and call them directly. 11 12 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: 13 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: 14 * JavaScriptCore.xcodeproj/project.pbxproj: 15 * assembler/AbstractMacroAssembler.h: 16 (JSC::AbstractMacroAssembler::linkJump): 17 (JSC::AbstractMacroAssembler::linkPointer): 18 (JSC::AbstractMacroAssembler::getLinkerAddress): 19 (JSC::AbstractMacroAssembler::getLinkerCallReturnOffset): 20 (JSC::AbstractMacroAssembler::repatchJump): 21 (JSC::AbstractMacroAssembler::repatchNearCall): 22 (JSC::AbstractMacroAssembler::repatchCompact): 23 (JSC::AbstractMacroAssembler::repatchInt32): 24 (JSC::AbstractMacroAssembler::repatchPointer): 25 (JSC::AbstractMacroAssembler::readPointer): 26 (JSC::AbstractMacroAssembler::replaceWithLoad): 27 (JSC::AbstractMacroAssembler::replaceWithAddressComputation): 28 (JSC::AbstractMacroAssembler::AbstractMacroAssembler): 29 * assembler/MacroAssemblerARM64.h: 30 (JSC::MacroAssemblerARM64::revertJumpReplacementToPatchableBranch32WithPatch): 31 (JSC::MacroAssemblerARM64::repatchCall): 32 (JSC::MacroAssemblerARM64::makeBranch): 33 (JSC::MacroAssemblerARM64::linkCall): 34 * assembler/MacroAssemblerARMv7.h: 35 (JSC::MacroAssemblerARMv7::revertJumpReplacementToPatchableBranch32WithPatch): 36 (JSC::MacroAssemblerARMv7::repatchCall): 37 (JSC::MacroAssemblerARMv7::linkCall): 38 (JSC::MacroAssemblerARMv7::trustedImm32FromPtr): 39 * assembler/MacroAssemblerX86.h: 40 (JSC::MacroAssemblerX86::revertJumpReplacementToPatchableBranch32WithPatch): 41 (JSC::MacroAssemblerX86::repatchCall): 42 (JSC::MacroAssemblerX86::linkCall): 43 * assembler/MacroAssemblerX86_64.h: 44 (JSC::MacroAssemblerX86_64::revertJumpReplacementToBranchPtrWithPatch): 45 (JSC::MacroAssemblerX86_64::repatchCall): 46 (JSC::MacroAssemblerX86_64::linkCall): 47 * assembler/RepatchBuffer.h: Removed. 48 * bytecode/CallLinkInfo.cpp: 49 (JSC::CallLinkInfo::clearStub): 50 (JSC::CallLinkInfo::unlink): 51 (JSC::CallLinkInfo::visitWeak): 52 * bytecode/CallLinkInfo.h: 53 (JSC::CallLinkInfo::registerPreservationMode): 54 (JSC::CallLinkInfo::isLinked): 55 (JSC::CallLinkInfo::setUpCall): 56 (JSC::CallLinkInfo::codeOrigin): 57 * bytecode/CodeBlock.cpp: 58 (JSC::CodeBlock::finalizeUnconditionally): 59 (JSC::CodeBlock::resetStub): 60 (JSC::CodeBlock::resetStubInternal): 61 (JSC::CodeBlock::resetStubDuringGCInternal): 62 (JSC::CodeBlock::unlinkIncomingCalls): 63 * bytecode/CodeBlock.h: 64 * bytecode/PolymorphicGetByIdList.cpp: 65 (JSC::GetByIdAccess::fromStructureStubInfo): 66 (JSC::GetByIdAccess::visitWeak): 67 (JSC::PolymorphicGetByIdList::didSelfPatching): 68 (JSC::PolymorphicGetByIdList::visitWeak): 69 * bytecode/PolymorphicGetByIdList.h: 70 (JSC::GetByIdAccess::doesCalls): 71 * bytecode/PolymorphicPutByIdList.cpp: 72 (JSC::PutByIdAccess::fromStructureStubInfo): 73 (JSC::PutByIdAccess::visitWeak): 74 (JSC::PolymorphicPutByIdList::addAccess): 75 (JSC::PolymorphicPutByIdList::visitWeak): 76 * bytecode/PolymorphicPutByIdList.h: 77 (JSC::PutByIdAccess::customSetter): 78 (JSC::PolymorphicPutByIdList::kind): 79 * bytecode/StructureStubInfo.cpp: 80 (JSC::StructureStubInfo::deref): 81 (JSC::StructureStubInfo::visitWeakReferences): 82 * bytecode/StructureStubInfo.h: 83 (JSC::StructureStubInfo::seenOnce): 84 * dfg/DFGOSRExitCompiler.cpp: 85 * ftl/FTLCompile.cpp: 86 (JSC::FTL::mmAllocateDataSection): 87 * ftl/FTLOSRExitCompiler.cpp: 88 (JSC::FTL::compileFTLOSRExit): 89 * jit/AccessorCallJITStubRoutine.cpp: 90 (JSC::AccessorCallJITStubRoutine::~AccessorCallJITStubRoutine): 91 (JSC::AccessorCallJITStubRoutine::visitWeak): 92 * jit/AccessorCallJITStubRoutine.h: 93 * jit/JIT.cpp: 94 (JSC::ctiPatchCallByReturnAddress): 95 (JSC::JIT::JIT): 96 (JSC::ctiPatchNearCallByReturnAddress): Deleted. 97 * jit/JIT.h: 98 * jit/JITCall.cpp: 99 * jit/JITOpcodes.cpp: 100 (JSC::JIT::privateCompileHasIndexedProperty): 101 (JSC::JIT::emit_op_has_indexed_property): 102 * jit/JITOperations.cpp: 103 (JSC::getByVal): 104 * jit/JITPropertyAccess.cpp: 105 (JSC::JIT::privateCompileGetByVal): 106 (JSC::JIT::privateCompileGetByValWithCachedId): 107 (JSC::JIT::privateCompilePutByVal): 108 (JSC::JIT::privateCompilePutByValWithCachedId): 109 * jit/JITPropertyAccess32_64.cpp: 110 * jit/JITStubRoutine.cpp: 111 (JSC::JITStubRoutine::~JITStubRoutine): 112 (JSC::JITStubRoutine::visitWeak): 113 * jit/JITStubRoutine.h: 114 * jit/PolymorphicCallStubRoutine.cpp: 115 (JSC::PolymorphicCallNode::~PolymorphicCallNode): 116 (JSC::PolymorphicCallNode::unlink): 117 (JSC::PolymorphicCallStubRoutine::clearCallNodesFor): 118 (JSC::PolymorphicCallStubRoutine::visitWeak): 119 * jit/PolymorphicCallStubRoutine.h: 120 (JSC::PolymorphicCallNode::hasCallLinkInfo): 121 * jit/Repatch.cpp: 122 (JSC::readCallTarget): 123 (JSC::repatchCall): 124 (JSC::repatchByIdSelfAccess): 125 (JSC::checkObjectPropertyConditions): 126 (JSC::replaceWithJump): 127 (JSC::tryCacheGetByID): 128 (JSC::repatchGetByID): 129 (JSC::patchJumpToGetByIdStub): 130 (JSC::tryBuildGetByIDList): 131 (JSC::tryCachePutByID): 132 (JSC::tryBuildPutByIdList): 133 (JSC::tryRepatchIn): 134 (JSC::repatchIn): 135 (JSC::linkSlowFor): 136 (JSC::linkFor): 137 (JSC::revertCall): 138 (JSC::unlinkFor): 139 (JSC::linkVirtualFor): 140 (JSC::linkPolymorphicCall): 141 (JSC::resetGetByID): 142 (JSC::resetPutByID): 143 (JSC::resetIn): 144 * jit/Repatch.h: 145 1 146 2015-09-03 Sukolsak Sakshuwong <sukolsak@gmail.com> 2 147 -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
r189284 r189288 1 <?xml version="1.0" encoding="utf-8"?>1 <?xml version="1.0" encoding="utf-8"?> 2 2 <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 3 3 <ItemGroup Label="ProjectConfigurations"> … … 994 994 <ClInclude Include="..\assembler\MacroAssemblerX86_64.h" /> 995 995 <ClInclude Include="..\assembler\MaxFrameExtentForSlowPathCall.h" /> 996 <ClInclude Include="..\assembler\RepatchBuffer.h" />997 996 <ClInclude Include="..\assembler\X86Assembler.h" /> 998 997 <ClInclude Include="..\bindings\ScriptFunctionCall.h" /> -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters
r189284 r189288 1 <?xml version="1.0" encoding="utf-8"?>1 <?xml version="1.0" encoding="utf-8"?> 2 2 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 3 3 <ItemGroup> … … 2002 2002 <Filter>assembler</Filter> 2003 2003 </ClInclude> 2004 <ClInclude Include="..\assembler\RepatchBuffer.h">2005 <Filter>assembler</Filter>2006 </ClInclude>2007 2004 <ClInclude Include="..\assembler\X86Assembler.h"> 2008 2005 <Filter>assembler</Filter> -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r189284 r189288 1116 1116 86D3B2C610156BDE002865E7 /* MacroAssemblerARM.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B2C210156BDE002865E7 /* MacroAssemblerARM.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1117 1117 86D3B3C310159D7F002865E7 /* LinkBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B3C110159D7F002865E7 /* LinkBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1118 86D3B3C410159D7F002865E7 /* RepatchBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 86D3B3C210159D7F002865E7 /* RepatchBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };1119 1118 86DB64640F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86DB64630F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp */; }; 1120 1119 86E116B10FE75AC800B512BC /* CodeLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E116B00FE75AC800B512BC /* CodeLocation.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 2964 2963 86D3B2C210156BDE002865E7 /* MacroAssemblerARM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerARM.h; sourceTree = "<group>"; }; 2965 2964 86D3B3C110159D7F002865E7 /* LinkBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkBuffer.h; sourceTree = "<group>"; }; 2966 86D3B3C210159D7F002865E7 /* RepatchBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RepatchBuffer.h; sourceTree = "<group>"; };2967 2965 86DB64630F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExecutableAllocatorFixedVMPool.cpp; sourceTree = "<group>"; }; 2968 2966 86E116B00FE75AC800B512BC /* CodeLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeLocation.h; sourceTree = "<group>"; }; … … 5494 5492 65860177185A8F5E00030EEE /* MaxFrameExtentForSlowPathCall.h */, 5495 5493 86C568DF11A213EE0007F7F0 /* MIPSAssembler.h */, 5496 86D3B3C210159D7F002865E7 /* RepatchBuffer.h */,5497 5494 86AE64A7135E5E1C00963012 /* SH4Assembler.h */, 5498 5495 9688CB140ED12B4E001D649F /* X86Assembler.h */, … … 6739 6736 A5BA15ED182340B400A82E69 /* RemoteInspectorXPCConnection.h in Headers */, 6740 6737 0F24E55117EE274900ABB217 /* Repatch.h in Headers */, 6741 86D3B3C410159D7F002865E7 /* RepatchBuffer.h in Headers */,6742 6738 869EBCB70E8C6D4A008722CC /* ResultType.h in Headers */, 6743 6739 C22B31B9140577D700DB475A /* SamplingCounter.h in Headers */, -
trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
r189130 r189288 936 936 AssemblerType m_assembler; 937 937 938 static void linkJump(void* code, Jump jump, CodeLocationLabel target) 939 { 940 AssemblerType::linkJump(code, jump.m_label, target.dataLocation()); 941 } 942 943 static void linkPointer(void* code, AssemblerLabel label, void* value) 944 { 945 AssemblerType::linkPointer(code, label, value); 946 } 947 948 static void* getLinkerAddress(void* code, AssemblerLabel label) 949 { 950 return AssemblerType::getRelocatedAddress(code, label); 951 } 952 953 static unsigned getLinkerCallReturnOffset(Call call) 954 { 955 return AssemblerType::getCallReturnOffset(call.m_label); 956 } 957 958 static void repatchJump(CodeLocationJump jump, CodeLocationLabel destination) 959 { 960 AssemblerType::relinkJump(jump.dataLocation(), destination.dataLocation()); 961 } 962 963 static void repatchNearCall(CodeLocationNearCall nearCall, CodeLocationLabel destination) 964 { 965 AssemblerType::relinkCall(nearCall.dataLocation(), destination.executableAddress()); 966 } 967 968 static void repatchCompact(CodeLocationDataLabelCompact dataLabelCompact, int32_t value) 969 { 970 AssemblerType::repatchCompact(dataLabelCompact.dataLocation(), value); 971 } 972 973 static void repatchInt32(CodeLocationDataLabel32 dataLabel32, int32_t value) 974 { 975 AssemblerType::repatchInt32(dataLabel32.dataLocation(), value); 976 } 977 978 static void repatchPointer(CodeLocationDataLabelPtr dataLabelPtr, void* value) 979 { 980 AssemblerType::repatchPointer(dataLabelPtr.dataLocation(), value); 981 } 982 983 static void* readPointer(CodeLocationDataLabelPtr dataLabelPtr) 984 { 985 return AssemblerType::readPointer(dataLabelPtr.dataLocation()); 986 } 987 988 static void replaceWithLoad(CodeLocationConvertibleLoad label) 989 { 990 AssemblerType::replaceWithLoad(label.dataLocation()); 991 } 992 993 static void replaceWithAddressComputation(CodeLocationConvertibleLoad label) 994 { 995 AssemblerType::replaceWithAddressComputation(label.dataLocation()); 996 } 997 938 998 protected: 939 999 AbstractMacroAssembler() … … 1032 1092 1033 1093 friend class LinkBuffer; 1034 friend class RepatchBuffer;1035 1036 static void linkJump(void* code, Jump jump, CodeLocationLabel target)1037 {1038 AssemblerType::linkJump(code, jump.m_label, target.dataLocation());1039 }1040 1041 static void linkPointer(void* code, AssemblerLabel label, void* value)1042 {1043 AssemblerType::linkPointer(code, label, value);1044 }1045 1046 static void* getLinkerAddress(void* code, AssemblerLabel label)1047 {1048 return AssemblerType::getRelocatedAddress(code, label);1049 }1050 1051 static unsigned getLinkerCallReturnOffset(Call call)1052 {1053 return AssemblerType::getCallReturnOffset(call.m_label);1054 }1055 1056 static void repatchJump(CodeLocationJump jump, CodeLocationLabel destination)1057 {1058 AssemblerType::relinkJump(jump.dataLocation(), destination.dataLocation());1059 }1060 1061 static void repatchNearCall(CodeLocationNearCall nearCall, CodeLocationLabel destination)1062 {1063 AssemblerType::relinkCall(nearCall.dataLocation(), destination.executableAddress());1064 }1065 1066 static void repatchCompact(CodeLocationDataLabelCompact dataLabelCompact, int32_t value)1067 {1068 AssemblerType::repatchCompact(dataLabelCompact.dataLocation(), value);1069 }1070 1071 static void repatchInt32(CodeLocationDataLabel32 dataLabel32, int32_t value)1072 {1073 AssemblerType::repatchInt32(dataLabel32.dataLocation(), value);1074 }1075 1076 static void repatchPointer(CodeLocationDataLabelPtr dataLabelPtr, void* value)1077 {1078 AssemblerType::repatchPointer(dataLabelPtr.dataLocation(), value);1079 }1080 1081 static void* readPointer(CodeLocationDataLabelPtr dataLabelPtr)1082 {1083 return AssemblerType::readPointer(dataLabelPtr.dataLocation());1084 }1085 1086 static void replaceWithLoad(CodeLocationConvertibleLoad label)1087 {1088 AssemblerType::replaceWithLoad(label.dataLocation());1089 }1090 1091 static void replaceWithAddressComputation(CodeLocationConvertibleLoad label)1092 {1093 AssemblerType::replaceWithAddressComputation(label.dataLocation());1094 }1095 1094 1096 1095 private: -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h
r188135 r189288 2507 2507 } 2508 2508 2509 static void repatchCall(CodeLocationCall call, CodeLocationLabel destination) 2510 { 2511 ARM64Assembler::repatchPointer(call.dataLabelPtrAtOffset(REPATCH_OFFSET_CALL_TO_POINTER).dataLocation(), destination.executableAddress()); 2512 } 2513 2514 static void repatchCall(CodeLocationCall call, FunctionPtr destination) 2515 { 2516 ARM64Assembler::repatchPointer(call.dataLabelPtrAtOffset(REPATCH_OFFSET_CALL_TO_POINTER).dataLocation(), destination.executableAddress()); 2517 } 2518 2509 2519 protected: 2510 2520 ALWAYS_INLINE Jump makeBranch(ARM64Assembler::Condition cond) … … 2879 2889 } 2880 2890 2881 static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)2882 {2883 ARM64Assembler::repatchPointer(call.dataLabelPtrAtOffset(REPATCH_OFFSET_CALL_TO_POINTER).dataLocation(), destination.executableAddress());2884 }2885 2886 static void repatchCall(CodeLocationCall call, FunctionPtr destination)2887 {2888 ARM64Assembler::repatchPointer(call.dataLabelPtrAtOffset(REPATCH_OFFSET_CALL_TO_POINTER).dataLocation(), destination.executableAddress());2889 }2890 2891 2891 CachedTempRegister m_dataMemoryTempRegister; 2892 2892 CachedTempRegister m_cachedMemoryTempRegister; -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h
r189148 r189288 1902 1902 } 1903 1903 1904 static void repatchCall(CodeLocationCall call, CodeLocationLabel destination) 1905 { 1906 ARMv7Assembler::relinkCall(call.dataLocation(), destination.executableAddress()); 1907 } 1908 1909 static void repatchCall(CodeLocationCall call, FunctionPtr destination) 1910 { 1911 ARMv7Assembler::relinkCall(call.dataLocation(), destination.executableAddress()); 1912 } 1913 1904 1914 #if ENABLE(MASM_PROBE) 1905 1915 void probe(ProbeFunction, void* arg1 = 0, void* arg2 = 0); … … 2006 2016 } 2007 2017 2008 static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)2009 {2010 ARMv7Assembler::relinkCall(call.dataLocation(), destination.executableAddress());2011 }2012 2013 static void repatchCall(CodeLocationCall call, FunctionPtr destination)2014 {2015 ARMv7Assembler::relinkCall(call.dataLocation(), destination.executableAddress());2016 }2017 2018 2018 #if ENABLE(MASM_PROBE) 2019 2019 inline TrustedImm32 trustedImm32FromPtr(void* ptr) -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86.h
r176134 r189288 346 346 } 347 347 348 static void repatchCall(CodeLocationCall call, CodeLocationLabel destination) 349 { 350 X86Assembler::relinkCall(call.dataLocation(), destination.executableAddress()); 351 } 352 353 static void repatchCall(CodeLocationCall call, FunctionPtr destination) 354 { 355 X86Assembler::relinkCall(call.dataLocation(), destination.executableAddress()); 356 } 357 348 358 private: 349 359 friend class LinkBuffer; … … 354 364 X86Assembler::linkCall(code, call.m_label, function.value()); 355 365 } 356 357 static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)358 {359 X86Assembler::relinkCall(call.dataLocation(), destination.executableAddress());360 }361 362 static void repatchCall(CodeLocationCall call, FunctionPtr destination)363 {364 X86Assembler::relinkCall(call.dataLocation(), destination.executableAddress());365 }366 366 }; 367 367 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h
r188888 r189288 855 855 } 856 856 857 static void repatchCall(CodeLocationCall call, CodeLocationLabel destination) 858 { 859 X86Assembler::repatchPointer(call.dataLabelPtrAtOffset(-REPATCH_OFFSET_CALL_R11).dataLocation(), destination.executableAddress()); 860 } 861 862 static void repatchCall(CodeLocationCall call, FunctionPtr destination) 863 { 864 X86Assembler::repatchPointer(call.dataLabelPtrAtOffset(-REPATCH_OFFSET_CALL_R11).dataLocation(), destination.executableAddress()); 865 } 866 857 867 private: 858 868 friend class LinkBuffer; … … 866 876 X86Assembler::linkCall(code, call.m_label, function.value()); 867 877 } 868 869 static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)870 {871 X86Assembler::repatchPointer(call.dataLabelPtrAtOffset(-REPATCH_OFFSET_CALL_R11).dataLocation(), destination.executableAddress());872 }873 874 static void repatchCall(CodeLocationCall call, FunctionPtr destination)875 {876 X86Assembler::repatchPointer(call.dataLabelPtrAtOffset(-REPATCH_OFFSET_CALL_R11).dataLocation(), destination.executableAddress());877 }878 878 }; 879 879 -
trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp
r189278 r189288 31 31 #include "JSCInlines.h" 32 32 #include "Repatch.h" 33 #include "RepatchBuffer.h"34 33 #include <wtf/ListDump.h> 35 34 #include <wtf/NeverDestroyed.h> … … 47 46 } 48 47 49 void CallLinkInfo::unlink(VM& vm , RepatchBuffer& repatchBuffer)48 void CallLinkInfo::unlink(VM& vm) 50 49 { 51 50 if (!isLinked()) { … … 56 55 } 57 56 58 unlinkFor(vm, repatchBuffer,*this);57 unlinkFor(vm, *this); 59 58 60 59 // It will be on a list if the callee has a code block. … … 63 62 } 64 63 65 void CallLinkInfo::visitWeak(VM& vm , RepatchBuffer& repatchBuffer)64 void CallLinkInfo::visitWeak(VM& vm) 66 65 { 67 66 auto handleSpecificCallee = [&] (JSFunction* callee) { … … 74 73 if (isLinked()) { 75 74 if (stub()) { 76 if (!stub()->visitWeak(vm , repatchBuffer)) {75 if (!stub()->visitWeak(vm)) { 77 76 if (Options::verboseOSR()) { 78 77 dataLog( … … 81 80 ".\n"); 82 81 } 83 unlink(vm , repatchBuffer);82 unlink(vm); 84 83 m_clearedByGC = true; 85 84 } … … 93 92 } 94 93 handleSpecificCallee(m_callee.get()); 95 unlink(vm , repatchBuffer);94 unlink(vm); 96 95 } 97 96 } -
trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.h
r189278 r189288 40 40 #if ENABLE(JIT) 41 41 42 class RepatchBuffer;43 44 42 class CallLinkInfo : public BasicRawSentinelNode<CallLinkInfo> { 45 43 public: … … 91 89 92 90 bool isLinked() { return m_stub || m_callee; } 93 void unlink(VM& , RepatchBuffer&);91 void unlink(VM&); 94 92 95 93 void setUpCall(CallType callType, CodeOrigin codeOrigin, unsigned calleeGPR) … … 279 277 } 280 278 281 void visitWeak(VM& , RepatchBuffer&);279 void visitWeak(VM&); 282 280 283 281 private: -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r189279 r189288 58 58 #include "ReduceWhitespace.h" 59 59 #include "Repatch.h" 60 #include "RepatchBuffer.h"61 60 #include "SlotVisitorInlines.h" 62 61 #include "StackVisitor.h" … … 2687 2686 // Handle inline caches. 2688 2687 if (!!jitCode()) { 2689 RepatchBuffer repatchBuffer(this);2690 2691 2688 for (auto iter = callLinkInfosBegin(); !!iter; ++iter) 2692 (*iter)->visitWeak(*vm() , repatchBuffer);2689 (*iter)->visitWeak(*vm()); 2693 2690 2694 2691 for (Bag<StructureStubInfo>::iterator iter = m_stubInfos.begin(); !!iter; ++iter) { 2695 2692 StructureStubInfo& stubInfo = **iter; 2696 2693 2697 if (stubInfo.visitWeakReferences(*vm() , repatchBuffer))2694 if (stubInfo.visitWeakReferences(*vm())) 2698 2695 continue; 2699 2696 2700 resetStubDuringGCInternal( repatchBuffer,stubInfo);2697 resetStubDuringGCInternal(stubInfo); 2701 2698 } 2702 2699 } … … 2785 2782 ConcurrentJITLocker locker(m_lock); 2786 2783 2787 RepatchBuffer repatchBuffer(this); 2788 resetStubInternal(repatchBuffer, stubInfo); 2789 } 2790 2791 void CodeBlock::resetStubInternal(RepatchBuffer& repatchBuffer, StructureStubInfo& stubInfo) 2784 resetStubInternal(stubInfo); 2785 } 2786 2787 void CodeBlock::resetStubInternal(StructureStubInfo& stubInfo) 2792 2788 { 2793 2789 AccessType accessType = static_cast<AccessType>(stubInfo.accessType); … … 2802 2798 2803 2799 if (isGetByIdAccess(accessType)) 2804 resetGetByID( repatchBuffer,this, stubInfo);2800 resetGetByID(this, stubInfo); 2805 2801 else if (isPutByIdAccess(accessType)) 2806 resetPutByID( repatchBuffer,this, stubInfo);2802 resetPutByID(this, stubInfo); 2807 2803 else { 2808 2804 RELEASE_ASSERT(isInAccess(accessType)); 2809 resetIn( repatchBuffer,this, stubInfo);2805 resetIn(this, stubInfo); 2810 2806 } 2811 2807 … … 2813 2809 } 2814 2810 2815 void CodeBlock::resetStubDuringGCInternal( RepatchBuffer& repatchBuffer,StructureStubInfo& stubInfo)2816 { 2817 resetStubInternal( repatchBuffer,stubInfo);2811 void CodeBlock::resetStubDuringGCInternal(StructureStubInfo& stubInfo) 2812 { 2813 resetStubInternal(stubInfo); 2818 2814 stubInfo.resetByGC = true; 2819 2815 } … … 3037 3033 if (m_incomingCalls.isEmpty() && m_incomingPolymorphicCalls.isEmpty()) 3038 3034 return; 3039 RepatchBuffer repatchBuffer(this);3040 3035 while (m_incomingCalls.begin() != m_incomingCalls.end()) 3041 m_incomingCalls.begin()->unlink(*vm() , repatchBuffer);3036 m_incomingCalls.begin()->unlink(*vm()); 3042 3037 while (m_incomingPolymorphicCalls.begin() != m_incomingPolymorphicCalls.end()) 3043 m_incomingPolymorphicCalls.begin()->unlink(*vm() , repatchBuffer);3038 m_incomingPolymorphicCalls.begin()->unlink(*vm()); 3044 3039 #endif // ENABLE(JIT) 3045 3040 } -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r189257 r189288 81 81 class ExecState; 82 82 class LLIntOffsetsExtractor; 83 class RepatchBuffer;84 83 class TypeLocation; 85 84 … … 983 982 984 983 #if ENABLE(JIT) 985 void resetStubInternal( RepatchBuffer&,StructureStubInfo&);986 void resetStubDuringGCInternal( RepatchBuffer&,StructureStubInfo&);984 void resetStubInternal(StructureStubInfo&); 985 void resetStubDuringGCInternal(StructureStubInfo&); 987 986 #endif 988 987 WriteBarrier<UnlinkedCodeBlock> m_unlinkedCode; -
trunk/Source/JavaScriptCore/bytecode/PolymorphicGetByIdList.cpp
r189278 r189288 66 66 } 67 67 68 bool GetByIdAccess::visitWeak(VM& vm , RepatchBuffer& repatchBuffer) const68 bool GetByIdAccess::visitWeak(VM& vm) const 69 69 { 70 70 if (m_structure && !Heap::isMarked(m_structure.get())) … … 72 72 if (!m_conditionSet.areStillLive()) 73 73 return false; 74 if (!m_stubRoutine->visitWeak(vm , repatchBuffer))74 if (!m_stubRoutine->visitWeak(vm)) 75 75 return false; 76 76 return true; … … 140 140 } 141 141 142 bool PolymorphicGetByIdList::visitWeak(VM& vm , RepatchBuffer& repatchBuffer) const142 bool PolymorphicGetByIdList::visitWeak(VM& vm) const 143 143 { 144 144 for (unsigned i = size(); i--;) { 145 if (!at(i).visitWeak(vm , repatchBuffer))145 if (!at(i).visitWeak(vm)) 146 146 return false; 147 147 } -
trunk/Source/JavaScriptCore/bytecode/PolymorphicGetByIdList.h
r189278 r189288 83 83 bool doesCalls() const { return type() == Getter || type() == CustomGetter; } 84 84 85 bool visitWeak(VM& , RepatchBuffer&) const;85 bool visitWeak(VM&) const; 86 86 87 87 private: … … 116 116 bool didSelfPatching() const; // Are any of the accesses SimpleInline? 117 117 118 bool visitWeak(VM& , RepatchBuffer&) const;118 bool visitWeak(VM&) const; 119 119 120 120 private: -
trunk/Source/JavaScriptCore/bytecode/PolymorphicPutByIdList.cpp
r189278 r189288 64 64 } 65 65 66 bool PutByIdAccess::visitWeak(VM& vm , RepatchBuffer& repatchBuffer) const66 bool PutByIdAccess::visitWeak(VM& vm) const 67 67 { 68 68 if (!m_conditionSet.areStillLive()) … … 89 89 return false; 90 90 } 91 if (!m_stubRoutine->visitWeak(vm , repatchBuffer))91 if (!m_stubRoutine->visitWeak(vm)) 92 92 return false; 93 93 return true; … … 143 143 } 144 144 145 bool PolymorphicPutByIdList::visitWeak(VM& vm , RepatchBuffer& repatchBuffer) const145 bool PolymorphicPutByIdList::visitWeak(VM& vm) const 146 146 { 147 147 for (unsigned i = 0; i < size(); ++i) { 148 if (!at(i).visitWeak(vm , repatchBuffer))148 if (!at(i).visitWeak(vm)) 149 149 return false; 150 150 } -
trunk/Source/JavaScriptCore/bytecode/PolymorphicPutByIdList.h
r189278 r189288 157 157 } 158 158 159 bool visitWeak(VM& , RepatchBuffer&) const;159 bool visitWeak(VM&) const; 160 160 161 161 private: … … 195 195 PutKind kind() const { return m_kind; } 196 196 197 bool visitWeak(VM& , RepatchBuffer&) const;197 bool visitWeak(VM&) const; 198 198 199 199 private: -
trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp
r189278 r189288 64 64 } 65 65 66 bool StructureStubInfo::visitWeakReferences(VM& vm , RepatchBuffer& repatchBuffer)66 bool StructureStubInfo::visitWeakReferences(VM& vm) 67 67 { 68 68 switch (accessType) { … … 72 72 break; 73 73 case access_get_by_id_list: { 74 if (!u.getByIdList.list->visitWeak(vm , repatchBuffer))74 if (!u.getByIdList.list->visitWeak(vm)) 75 75 return false; 76 76 break; … … 89 89 break; 90 90 case access_put_by_id_list: 91 if (!u.putByIdList.list->visitWeak(vm , repatchBuffer))91 if (!u.putByIdList.list->visitWeak(vm)) 92 92 return false; 93 93 break; -
trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.h
r189278 r189288 166 166 // allowed to accomplish this by either clearing those pointers somehow or by proving that 167 167 // they have already been marked. It is not allowed to mark new objects. 168 bool visitWeakReferences(VM& , RepatchBuffer&);168 bool visitWeakReferences(VM&); 169 169 170 170 bool seenOnce() -
trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompiler.cpp
r181993 r189288 36 36 #include "OperandsInlines.h" 37 37 #include "JSCInlines.h" 38 #include "RepatchBuffer.h"39 38 #include <wtf/StringPrintStream.h> 40 39 … … 168 167 } 169 168 170 { 171 RepatchBuffer repatchBuffer(codeBlock); 172 repatchBuffer.relink(exit.codeLocationForRepatch(codeBlock), CodeLocationLabel(exit.m_code.code())); 173 } 169 MacroAssembler::repatchJump(exit.codeLocationForRepatch(codeBlock), CodeLocationLabel(exit.m_code.code())); 174 170 175 171 vm->osrExitJumpDestination = exit.m_code.code().executableAddress(); -
trunk/Source/JavaScriptCore/ftl/FTLCompile.cpp
r188932 r189288 45 45 #include "LLVMAPI.h" 46 46 #include "LinkBuffer.h" 47 #include "RepatchBuffer.h"48 47 49 48 namespace JSC { namespace FTL { … … 620 619 } 621 620 622 RepatchBuffer repatchBuffer(codeBlock);623 624 621 auto iter = recordMap.find(state.handleStackOverflowExceptionStackmapID); 625 622 // It's sort of remotely possible that we won't have an in-band exception handling … … 634 631 RELEASE_ASSERT(stackOverflowException.isSet()); 635 632 636 repatchBuffer.replaceWithJump(source, state.finalizer->handleExceptionsLinkBuffer->locationOf(stackOverflowException));633 MacroAssembler::replaceWithJump(source, state.finalizer->handleExceptionsLinkBuffer->locationOf(stackOverflowException)); 637 634 } 638 635 } … … 648 645 bitwise_cast<char*>(generatedFunction) + record.instructionOffset); 649 646 650 repatchBuffer.replaceWithJump(source, state.finalizer->handleExceptionsLinkBuffer->entrypoint());647 MacroAssembler::replaceWithJump(source, state.finalizer->handleExceptionsLinkBuffer->entrypoint()); 651 648 } 652 649 } … … 671 668 jitCode->common.jumpReplacements.append(JumpReplacement(source, info.m_thunkAddress)); 672 669 else 673 repatchBuffer.replaceWithJump(source, info.m_thunkAddress);670 MacroAssembler::replaceWithJump(source, info.m_thunkAddress); 674 671 } 675 672 } -
trunk/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp
r186795 r189288 42 42 #include "JSCInlines.h" 43 43 #include "RegisterPreservationWrapperGenerator.h" 44 #include "RepatchBuffer.h"45 44 46 45 namespace JSC { namespace FTL { … … 524 523 compileStub(exitID, jitCode, exit, vm, codeBlock); 525 524 526 RepatchBuffer repatchBuffer(codeBlock); 527 repatchBuffer.relink( 525 MacroAssembler::repatchJump( 528 526 exit.codeLocationForRepatch(codeBlock), CodeLocationLabel(exit.m_code.code())); 529 527 -
trunk/Source/JavaScriptCore/jit/AccessorCallJITStubRoutine.cpp
r189278 r189288 44 44 } 45 45 46 bool AccessorCallJITStubRoutine::visitWeak(VM& vm , RepatchBuffer& repatchBuffer)46 bool AccessorCallJITStubRoutine::visitWeak(VM& vm) 47 47 { 48 m_callLinkInfo->visitWeak(vm , repatchBuffer);48 m_callLinkInfo->visitWeak(vm); 49 49 return true; 50 50 } -
trunk/Source/JavaScriptCore/jit/AccessorCallJITStubRoutine.h
r189278 r189288 45 45 virtual ~AccessorCallJITStubRoutine(); 46 46 47 virtual bool visitWeak(VM& , RepatchBuffer&) override;47 virtual bool visitWeak(VM&) override; 48 48 49 49 std::unique_ptr<CallLinkInfo> m_callLinkInfo; -
trunk/Source/JavaScriptCore/jit/JIT.cpp
r189201 r189288 43 43 #include "JSCInlines.h" 44 44 #include "ProfilerDatabase.h" 45 #include "RepatchBuffer.h"46 45 #include "ResultType.h" 47 46 #include "SamplingTool.h" … … 55 54 namespace JSC { 56 55 57 void ctiPatchNearCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction) 58 { 59 RepatchBuffer repatchBuffer(codeblock); 60 repatchBuffer.relinkNearCallerToTrampoline(returnAddress, newCalleeFunction); 61 } 62 63 void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction) 64 { 65 RepatchBuffer repatchBuffer(codeblock); 66 repatchBuffer.relinkCallerToTrampoline(returnAddress, newCalleeFunction); 67 } 68 69 void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction) 70 { 71 RepatchBuffer repatchBuffer(codeblock); 72 repatchBuffer.relinkCallerToFunction(returnAddress, newCalleeFunction); 56 void ctiPatchCallByReturnAddress(ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction) 57 { 58 MacroAssembler::repatchCall( 59 CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), 60 newCalleeFunction); 73 61 } 74 62 -
trunk/Source/JavaScriptCore/jit/JIT.h
r189279 r189288 181 181 }; 182 182 183 // Near calls can only be patched to other JIT code, regular calls can be patched to JIT code or relinked to stub functions. 184 void ctiPatchNearCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction); 185 void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, MacroAssemblerCodePtr newCalleeFunction); 186 void ctiPatchCallByReturnAddress(CodeBlock* codeblock, ReturnAddressPtr returnAddress, FunctionPtr newCalleeFunction); 183 void ctiPatchCallByReturnAddress(ReturnAddressPtr, FunctionPtr newCalleeFunction); 187 184 188 185 class JIT : private JSInterfaceJIT { -
trunk/Source/JavaScriptCore/jit/JITCall.cpp
r188932 r189288 37 37 #include "JSCInlines.h" 38 38 #include "LinkBuffer.h" 39 #include "RepatchBuffer.h"40 39 #include "ResultType.h" 41 40 #include "SamplingTool.h" -
trunk/Source/JavaScriptCore/jit/JITCall32_64.cpp
r188932 r189288 37 37 #include "JSCInlines.h" 38 38 #include "LinkBuffer.h" 39 #include "RepatchBuffer.h"40 39 #include "ResultType.h" 41 40 #include "SamplingTool.h" -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r189009 r189288 42 42 #include "LinkBuffer.h" 43 43 #include "MaxFrameExtentForSlowPathCall.h" 44 #include "RepatchBuffer.h"45 44 #include "SlowPathCall.h" 46 45 #include "TypeLocation.h" … … 1086 1085 ("Baseline has_indexed_property stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value())); 1087 1086 1088 RepatchBuffer repatchBuffer(m_codeBlock); 1089 repatchBuffer.relink(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code())); 1090 repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(operationHasIndexedPropertyGeneric)); 1087 MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code())); 1088 MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationHasIndexedPropertyGeneric)); 1091 1089 } 1092 1090 -
trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
r188545 r189288 1 1 /* 2 * Copyright (C) 2009, 2012, 2013, 2014 Apple Inc. All rights reserved.2 * Copyright (C) 2009, 2012, 2013, 2014, 2015 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> 4 4 * … … 43 43 #include "LinkBuffer.h" 44 44 #include "MaxFrameExtentForSlowPathCall.h" 45 #include "RepatchBuffer.h"46 45 #include "SlowPathCall.h" 47 46 #include "TypeProfilerLog.h" … … 1066 1065 ("Baseline has_indexed_property stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value())); 1067 1066 1068 RepatchBuffer repatchBuffer(m_codeBlock); 1069 repatchBuffer.relink(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code())); 1070 repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(operationHasIndexedPropertyGeneric)); 1067 MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code())); 1068 MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationHasIndexedPropertyGeneric)); 1071 1069 } 1072 1070 -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r189279 r189288 55 55 #include "PropertyName.h" 56 56 #include "Repatch.h" 57 #include "RepatchBuffer.h"58 57 #include "ScopedArguments.h" 59 58 #include "TestRunnerUtils.h" … … 647 646 // Don't ever try to optimize. 648 647 byValInfo->tookSlowPath = true; 649 ctiPatchCallByReturnAddress( exec->codeBlock(),ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationPutByValGeneric));648 ctiPatchCallByReturnAddress(ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationPutByValGeneric)); 650 649 } 651 650 putByVal(exec, baseValue, subscript, value, byValInfo); … … 729 728 // Don't ever try to optimize. 730 729 byValInfo->tookSlowPath = true; 731 ctiPatchCallByReturnAddress( exec->codeBlock(),ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationDirectPutByValGeneric));730 ctiPatchCallByReturnAddress(ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationDirectPutByValGeneric)); 732 731 } 733 732 … … 1594 1593 if (isJSString(baseValue)) { 1595 1594 if (asString(baseValue)->canGetIndex(i)) { 1596 ctiPatchCallByReturnAddress( exec->codeBlock(),returnAddress, FunctionPtr(operationGetByValString));1595 ctiPatchCallByReturnAddress(returnAddress, FunctionPtr(operationGetByValString)); 1597 1596 return asString(baseValue)->getIndex(exec, i); 1598 1597 } … … 1717 1716 // Don't ever try to optimize. 1718 1717 byValInfo->tookSlowPath = true; 1719 ctiPatchCallByReturnAddress( exec->codeBlock(),returnAddress, FunctionPtr(operationGetByValGeneric));1718 ctiPatchCallByReturnAddress(returnAddress, FunctionPtr(operationGetByValGeneric)); 1720 1719 } 1721 1720 … … 1757 1756 || object->structure(vm)->typeInfo().interceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero()) { 1758 1757 // Don't ever try to optimize. 1759 ctiPatchCallByReturnAddress( exec->codeBlock(),ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationHasIndexedPropertyGeneric));1758 ctiPatchCallByReturnAddress(ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(operationHasIndexedPropertyGeneric)); 1760 1759 } 1761 1760 } … … 1806 1805 if (!isJSString(baseValue)) { 1807 1806 ASSERT(exec->bytecodeOffset()); 1808 ctiPatchCallByReturnAddress( exec->codeBlock(),ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(byValInfo->stubRoutine ? operationGetByValGeneric : operationGetByValOptimize));1807 ctiPatchCallByReturnAddress(ReturnAddressPtr(OUR_RETURN_ADDRESS), FunctionPtr(byValInfo->stubRoutine ? operationGetByValGeneric : operationGetByValOptimize)); 1809 1808 } 1810 1809 } -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
r189279 r189288 39 39 #include "JSFunction.h" 40 40 #include "LinkBuffer.h" 41 #include "RepatchBuffer.h"42 41 #include "ResultType.h" 43 42 #include "SamplingTool.h" … … 1116 1115 ("Baseline get_by_val stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value())); 1117 1116 1118 RepatchBuffer repatchBuffer(m_codeBlock); 1119 repatchBuffer.relink(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code())); 1120 repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(operationGetByValGeneric)); 1117 MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code())); 1118 MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationGetByValGeneric)); 1121 1119 } 1122 1120 … … 1148 1146 byValInfo->stubInfo = gen.stubInfo(); 1149 1147 1150 RepatchBuffer repatchBuffer(m_codeBlock); 1151 repatchBuffer.relink(byValInfo->notIndexJump, CodeLocationLabel(byValInfo->stubRoutine->code().code())); 1152 repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(operationGetByValGeneric)); 1148 MacroAssembler::repatchJump(byValInfo->notIndexJump, CodeLocationLabel(byValInfo->stubRoutine->code().code())); 1149 MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(operationGetByValGeneric)); 1153 1150 } 1154 1151 … … 1216 1213 ("Baseline put_by_val_direct stub for %s, return point %p", toCString(*m_codeBlock).data(), returnAddress.value())); 1217 1214 } 1218 RepatchBuffer repatchBuffer(m_codeBlock); 1219 repatchBuffer.relink(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code())); 1220 repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(isDirect ? operationDirectPutByValGeneric : operationPutByValGeneric)); 1215 MacroAssembler::repatchJump(byValInfo->badTypeJump, CodeLocationLabel(byValInfo->stubRoutine->code().code())); 1216 MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(isDirect ? operationDirectPutByValGeneric : operationPutByValGeneric)); 1221 1217 } 1222 1218 … … 1245 1241 byValInfo->stubInfo = gen.stubInfo(); 1246 1242 1247 RepatchBuffer repatchBuffer(m_codeBlock); 1248 repatchBuffer.relink(byValInfo->notIndexJump, CodeLocationLabel(byValInfo->stubRoutine->code().code())); 1249 repatchBuffer.relinkCallerToFunction(returnAddress, FunctionPtr(putKind == Direct ? operationDirectPutByValGeneric : operationPutByValGeneric)); 1243 MacroAssembler::repatchJump(byValInfo->notIndexJump, CodeLocationLabel(byValInfo->stubRoutine->code().code())); 1244 MacroAssembler::repatchCall(CodeLocationCall(MacroAssemblerCodePtr(returnAddress)), FunctionPtr(putKind == Direct ? operationDirectPutByValGeneric : operationPutByValGeneric)); 1250 1245 } 1251 1246 -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
r189279 r189288 39 39 #include "JSFunction.h" 40 40 #include "LinkBuffer.h" 41 #include "RepatchBuffer.h"42 41 #include "ResultType.h" 43 42 #include "SamplingTool.h" -
trunk/Source/JavaScriptCore/jit/JITStubRoutine.cpp
r189278 r189288 37 37 JITStubRoutine::~JITStubRoutine() { } 38 38 39 bool JITStubRoutine::visitWeak(VM& , RepatchBuffer&)39 bool JITStubRoutine::visitWeak(VM&) 40 40 { 41 41 return true; -
trunk/Source/JavaScriptCore/jit/JITStubRoutine.h
r189278 r189288 145 145 // false, you will usually not do any clearing because the idea is that you will simply be 146 146 // destroyed. 147 virtual bool visitWeak(VM& , RepatchBuffer&);147 virtual bool visitWeak(VM&); 148 148 149 149 protected: -
trunk/Source/JavaScriptCore/jit/PolymorphicCallStubRoutine.cpp
r189278 r189288 42 42 } 43 43 44 void PolymorphicCallNode::unlink(VM& vm , RepatchBuffer& repatchBuffer)44 void PolymorphicCallNode::unlink(VM& vm) 45 45 { 46 46 if (m_callLinkInfo) { … … 48 48 dataLog("Unlinking polymorphic call at ", m_callLinkInfo->callReturnLocation(), ", ", m_callLinkInfo->codeOrigin(), "\n"); 49 49 50 m_callLinkInfo->unlink(vm , repatchBuffer);50 m_callLinkInfo->unlink(vm); 51 51 } 52 52 … … 118 118 } 119 119 120 bool PolymorphicCallStubRoutine::visitWeak(VM& , RepatchBuffer&)120 bool PolymorphicCallStubRoutine::visitWeak(VM&) 121 121 { 122 122 for (auto& variant : m_variants) { -
trunk/Source/JavaScriptCore/jit/PolymorphicCallStubRoutine.h
r189278 r189288 51 51 ~PolymorphicCallNode(); 52 52 53 void unlink(VM& , RepatchBuffer&);53 void unlink(VM&); 54 54 55 55 bool hasCallLinkInfo(CallLinkInfo* info) { return m_callLinkInfo == info; } … … 97 97 void clearCallNodesFor(CallLinkInfo*); 98 98 99 bool visitWeak(VM& , RepatchBuffer&) override;99 bool visitWeak(VM&) override; 100 100 101 101 protected: -
trunk/Source/JavaScriptCore/jit/Repatch.cpp
r189278 r189288 44 44 #include "PolymorphicPutByIdList.h" 45 45 #include "RegExpMatchesArray.h" 46 #include "RepatchBuffer.h"47 46 #include "ScratchRegisterAllocator.h" 48 47 #include "StackAlignment.h" … … 76 75 } 77 76 78 static void repatchCall( RepatchBuffer& repatchBuffer,CodeBlock* codeBlock, CodeLocationCall call, FunctionPtr newCalleeFunction)77 static void repatchCall(CodeBlock* codeBlock, CodeLocationCall call, FunctionPtr newCalleeFunction) 79 78 { 80 79 #if ENABLE(FTL_JIT) … … 92 91 UNUSED_PARAM(codeBlock); 93 92 #endif // ENABLE(FTL_JIT) 94 repatchBuffer.relink(call, newCalleeFunction); 95 } 96 97 static void repatchCall(CodeBlock* codeBlock, CodeLocationCall call, FunctionPtr newCalleeFunction) 98 { 99 RepatchBuffer repatchBuffer(codeBlock); 100 repatchCall(repatchBuffer, codeBlock, call, newCalleeFunction); 93 MacroAssembler::repatchCall(call, newCalleeFunction); 101 94 } 102 95 … … 109 102 vm.registerWatchpointForImpureProperty(propertyName, stubInfo.addWatchpoint(codeBlock)); 110 103 111 RepatchBuffer repatchBuffer(codeBlock);112 113 104 // Only optimize once! 114 repatchCall( repatchBuffer,codeBlock, stubInfo.callReturnLocation, slowPathFunction);105 repatchCall(codeBlock, stubInfo.callReturnLocation, slowPathFunction); 115 106 116 107 // Patch the structure check & the offset of the load. 117 repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(-(intptr_t)stubInfo.patch.deltaCheckImmToCall), bitwise_cast<int32_t>(structure->id())); 118 repatchBuffer.setLoadInstructionIsActive(stubInfo.callReturnLocation.convertibleLoadAtOffset(stubInfo.patch.deltaCallToStorageLoad), isOutOfLineOffset(offset)); 108 MacroAssembler::repatchInt32( 109 stubInfo.callReturnLocation.dataLabel32AtOffset(-(intptr_t)stubInfo.patch.deltaCheckImmToCall), 110 bitwise_cast<int32_t>(structure->id())); 111 CodeLocationConvertibleLoad convertibleLoad = stubInfo.callReturnLocation.convertibleLoadAtOffset(stubInfo.patch.deltaCallToStorageLoad); 112 if (isOutOfLineOffset(offset)) 113 MacroAssembler::replaceWithLoad(convertibleLoad); 114 else 115 MacroAssembler::replaceWithAddressComputation(convertibleLoad); 119 116 #if USE(JSVALUE64) 120 117 if (compact) 121 repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToLoadOrStore), offsetRelativeToPatchedStorage(offset));118 MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToLoadOrStore), offsetRelativeToPatchedStorage(offset)); 122 119 else 123 repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToLoadOrStore), offsetRelativeToPatchedStorage(offset));120 MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToLoadOrStore), offsetRelativeToPatchedStorage(offset)); 124 121 #elif USE(JSVALUE32_64) 125 122 if (compact) { 126 repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag));127 repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));123 MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag)); 124 MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload)); 128 125 } else { 129 repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag));130 repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload));126 MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag)); 127 MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), offsetRelativeToPatchedStorage(offset) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload)); 131 128 } 132 129 #endif … … 162 159 } 163 160 164 static void replaceWithJump( RepatchBuffer& repatchBuffer,StructureStubInfo& stubInfo, const MacroAssemblerCodePtr target)161 static void replaceWithJump(StructureStubInfo& stubInfo, const MacroAssemblerCodePtr target) 165 162 { 166 163 if (MacroAssembler::canJumpReplacePatchableBranch32WithPatch()) { 167 repatchBuffer.replaceWithJump(168 RepatchBuffer::startOfPatchableBranch32WithPatchOnAddress(164 MacroAssembler::replaceWithJump( 165 MacroAssembler::startOfPatchableBranch32WithPatchOnAddress( 169 166 stubInfo.callReturnLocation.dataLabel32AtOffset( 170 167 -(intptr_t)stubInfo.patch.deltaCheckImmToCall)), … … 173 170 } 174 171 175 repatchBuffer.relink(172 MacroAssembler::repatchJump( 176 173 stubInfo.callReturnLocation.jumpAtOffset( 177 174 stubInfo.patch.deltaCallToJump), … … 682 679 stubInfo.patch.deltaCallToDone).executableAddress())); 683 680 684 RepatchBuffer repatchBuffer(codeBlock); 685 replaceWithJump(repatchBuffer, stubInfo, stubInfo.stubRoutine->code().code()); 686 repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, operationGetById); 681 replaceWithJump(stubInfo, stubInfo.stubRoutine->code().code()); 682 repatchCall(codeBlock, stubInfo.callReturnLocation, operationGetById); 687 683 688 684 return RetryCacheLater; … … 715 711 stubInfo.patch.deltaCallToDone).executableAddress())); 716 712 717 RepatchBuffer repatchBuffer(codeBlock); 718 replaceWithJump(repatchBuffer, stubInfo, stubInfo.stubRoutine->code().code()); 719 repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, operationGetById); 713 replaceWithJump(stubInfo, stubInfo.stubRoutine->code().code()); 714 repatchCall(codeBlock, stubInfo.callReturnLocation, operationGetById); 720 715 721 716 return RetryCacheLater; … … 759 754 } 760 755 761 static void patchJumpToGetByIdStub( CodeBlock* codeBlock,StructureStubInfo& stubInfo, JITStubRoutine* stubRoutine)756 static void patchJumpToGetByIdStub(StructureStubInfo& stubInfo, JITStubRoutine* stubRoutine) 762 757 { 763 758 RELEASE_ASSERT(stubInfo.accessType == access_get_by_id_list); 764 RepatchBuffer repatchBuffer(codeBlock);765 759 if (stubInfo.u.getByIdList.list->didSelfPatching()) { 766 repatchBuffer.relink(760 MacroAssembler::repatchJump( 767 761 stubInfo.callReturnLocation.jumpAtOffset( 768 762 stubInfo.patch.deltaCallToJump), … … 771 765 } 772 766 773 replaceWithJump( repatchBuffer,stubInfo, stubRoutine->code().code());767 replaceWithJump(stubInfo, stubRoutine->code().code()); 774 768 } 775 769 … … 853 847 conditionSet)); 854 848 855 patchJumpToGetByIdStub( codeBlock,stubInfo, stubRoutine.get());849 patchJumpToGetByIdStub(stubInfo, stubRoutine.get()); 856 850 857 851 return list->isFull() ? GiveUpOnCache : RetryCacheLater; … … 1258 1252 if (!emitPutTransitionStub(exec, vm, structure, ident, slot, stubInfo, putKind, oldStructure, conditionSet)) 1259 1253 return GiveUpOnCache; 1260 1261 RepatchBuffer repatchBuffer(codeBlock); 1262 repatchBuffer.relink( 1254 1255 MacroAssembler::repatchJump( 1263 1256 stubInfo.callReturnLocation.jumpAtOffset( 1264 1257 stubInfo.patch.deltaCallToJump), 1265 1258 CodeLocationLabel(stubInfo.stubRoutine->code().code())); 1266 repatchCall( repatchBuffer,codeBlock, stubInfo.callReturnLocation, appropriateListBuildingPutByIdFunction(slot, putKind));1259 repatchCall(codeBlock, stubInfo.callReturnLocation, appropriateListBuildingPutByIdFunction(slot, putKind)); 1267 1260 1268 1261 stubInfo.initPutByIdTransition(*vm, codeBlock->ownerExecutable(), oldStructure, structure, conditionSet, putKind == Direct); … … 1321 1314 structure, conditionSet, slot.customSetter(), stubRoutine)); 1322 1315 1323 RepatchBuffer repatchBuffer(codeBlock); 1324 repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code())); 1325 repatchCall(repatchBuffer, codeBlock, stubInfo.callReturnLocation, appropriateListBuildingPutByIdFunction(slot, putKind)); 1316 MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code())); 1317 repatchCall(codeBlock, stubInfo.callReturnLocation, appropriateListBuildingPutByIdFunction(slot, putKind)); 1326 1318 RELEASE_ASSERT(!list->isFull()); 1327 1319 return RetryCacheLater; … … 1394 1386 structure, stubRoutine)); 1395 1387 } 1396 RepatchBuffer repatchBuffer(codeBlock); 1397 repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code())); 1388 MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code())); 1398 1389 if (list->isFull()) 1399 repatchCall( repatchBuffer,codeBlock, stubInfo.callReturnLocation, appropriateGenericPutByIdFunction(slot, putKind));1390 repatchCall(codeBlock, stubInfo.callReturnLocation, appropriateGenericPutByIdFunction(slot, putKind)); 1400 1391 1401 1392 return RetryCacheLater; … … 1443 1434 structure, conditionSet, slot.customSetter(), stubRoutine)); 1444 1435 1445 RepatchBuffer repatchBuffer(codeBlock); 1446 repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code())); 1436 MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code())); 1447 1437 if (list->isFull()) 1448 repatchCall( repatchBuffer,codeBlock, stubInfo.callReturnLocation, appropriateGenericPutByIdFunction(slot, putKind));1438 repatchCall(codeBlock, stubInfo.callReturnLocation, appropriateGenericPutByIdFunction(slot, putKind)); 1449 1439 1450 1440 return RetryCacheLater; … … 1574 1564 stubInfo.u.inList.listSize++; 1575 1565 1576 RepatchBuffer repatchBuffer(codeBlock); 1577 repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code())); 1566 MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), CodeLocationLabel(stubRoutine->code().code())); 1578 1567 1579 1568 return listIndex < (POLYMORPHIC_LIST_CACHE_SIZE - 1) ? RetryCacheLater : GiveUpOnCache; … … 1588 1577 } 1589 1578 1590 static void linkSlowFor( 1591 RepatchBuffer& repatchBuffer, VM*, CallLinkInfo& callLinkInfo, MacroAssemblerCodeRef codeRef) 1592 { 1593 repatchBuffer.relink( 1594 callLinkInfo.callReturnLocation(), codeRef.code()); 1595 } 1596 1597 static void linkSlowFor( 1598 RepatchBuffer& repatchBuffer, VM* vm, CallLinkInfo& callLinkInfo, ThunkGenerator generator) 1599 { 1600 linkSlowFor(repatchBuffer, vm, callLinkInfo, vm->getCTIStub(generator)); 1601 } 1602 1603 static void linkSlowFor( 1604 RepatchBuffer& repatchBuffer, VM* vm, CallLinkInfo& callLinkInfo) 1579 static void linkSlowFor(VM*, CallLinkInfo& callLinkInfo, MacroAssemblerCodeRef codeRef) 1580 { 1581 MacroAssembler::repatchNearCall(callLinkInfo.callReturnLocation(), CodeLocationLabel(codeRef.code())); 1582 } 1583 1584 static void linkSlowFor(VM* vm, CallLinkInfo& callLinkInfo, ThunkGenerator generator) 1585 { 1586 linkSlowFor(vm, callLinkInfo, vm->getCTIStub(generator)); 1587 } 1588 1589 static void linkSlowFor(VM* vm, CallLinkInfo& callLinkInfo) 1605 1590 { 1606 1591 MacroAssemblerCodeRef virtualThunk = virtualThunkFor(vm, callLinkInfo); 1607 linkSlowFor( repatchBuffer,vm, callLinkInfo, virtualThunk);1592 linkSlowFor(vm, callLinkInfo, virtualThunk); 1608 1593 callLinkInfo.setSlowStub(createJITStubRoutine(virtualThunk, *vm, nullptr, true)); 1609 1594 } … … 1618 1603 1619 1604 VM* vm = callerCodeBlock->vm(); 1620 1621 RepatchBuffer repatchBuffer(callerCodeBlock);1622 1605 1623 1606 ASSERT(!callLinkInfo.isLinked()); … … 1626 1609 if (shouldShowDisassemblyFor(callerCodeBlock)) 1627 1610 dataLog("Linking call in ", *callerCodeBlock, " at ", callLinkInfo.codeOrigin(), " to ", pointerDump(calleeCodeBlock), ", entrypoint at ", codePtr, "\n"); 1628 repatchBuffer.relink(callLinkInfo.hotPathOther(), codePtr);1611 MacroAssembler::repatchNearCall(callLinkInfo.hotPathOther(), CodeLocationLabel(codePtr)); 1629 1612 1630 1613 if (calleeCodeBlock) … … 1632 1615 1633 1616 if (callLinkInfo.specializationKind() == CodeForCall) { 1634 linkSlowFor( 1635 repatchBuffer, vm, callLinkInfo, linkPolymorphicCallThunkGenerator); 1617 linkSlowFor(vm, callLinkInfo, linkPolymorphicCallThunkGenerator); 1636 1618 return; 1637 1619 } 1638 1620 1639 1621 ASSERT(callLinkInfo.specializationKind() == CodeForConstruct); 1640 linkSlowFor( repatchBuffer,vm, callLinkInfo);1622 linkSlowFor(vm, callLinkInfo); 1641 1623 } 1642 1624 … … 1647 1629 VM* vm = callerCodeBlock->vm(); 1648 1630 1649 RepatchBuffer repatchBuffer(callerCodeBlock); 1650 1651 linkSlowFor(repatchBuffer, vm, callLinkInfo); 1652 } 1653 1654 static void revertCall( 1655 RepatchBuffer& repatchBuffer, VM* vm, CallLinkInfo& callLinkInfo, MacroAssemblerCodeRef codeRef) 1656 { 1657 repatchBuffer.revertJumpReplacementToBranchPtrWithPatch( 1658 RepatchBuffer::startOfBranchPtrWithPatchOnRegister(callLinkInfo.hotPathBegin()), 1631 linkSlowFor(vm, callLinkInfo); 1632 } 1633 1634 static void revertCall(VM* vm, CallLinkInfo& callLinkInfo, MacroAssemblerCodeRef codeRef) 1635 { 1636 MacroAssembler::revertJumpReplacementToBranchPtrWithPatch( 1637 MacroAssembler::startOfBranchPtrWithPatchOnRegister(callLinkInfo.hotPathBegin()), 1659 1638 static_cast<MacroAssembler::RegisterID>(callLinkInfo.calleeGPR()), 0); 1660 linkSlowFor( repatchBuffer,vm, callLinkInfo, codeRef);1639 linkSlowFor(vm, callLinkInfo, codeRef); 1661 1640 callLinkInfo.clearSeen(); 1662 1641 callLinkInfo.clearCallee(); … … 1667 1646 } 1668 1647 1669 void unlinkFor( 1670 VM& vm, RepatchBuffer& repatchBuffer, CallLinkInfo& callLinkInfo) 1648 void unlinkFor(VM& vm, CallLinkInfo& callLinkInfo) 1671 1649 { 1672 1650 if (Options::showDisassembly()) 1673 1651 dataLog("Unlinking call from ", callLinkInfo.callReturnLocation(), "\n"); 1674 1652 1675 revertCall( repatchBuffer,&vm, callLinkInfo, vm.getCTIStub(linkCallThunkGenerator));1653 revertCall(&vm, callLinkInfo, vm.getCTIStub(linkCallThunkGenerator)); 1676 1654 } 1677 1655 … … 1685 1663 dataLog("Linking virtual call at ", *callerCodeBlock, " ", exec->callerFrame()->codeOrigin(), "\n"); 1686 1664 1687 RepatchBuffer repatchBuffer(callerCodeBlock);1688 1665 MacroAssemblerCodeRef virtualThunk = virtualThunkFor(vm, callLinkInfo); 1689 revertCall( repatchBuffer,vm, callLinkInfo, virtualThunk);1666 revertCall(vm, callLinkInfo, virtualThunk); 1690 1667 callLinkInfo.setSlowStub(createJITStubRoutine(virtualThunk, *vm, nullptr, true)); 1691 1668 } … … 1917 1894 WTF::move(fastCounts))); 1918 1895 1919 RepatchBuffer repatchBuffer(callerCodeBlock); 1920 1921 repatchBuffer.replaceWithJump( 1922 RepatchBuffer::startOfBranchPtrWithPatchOnRegister(callLinkInfo.hotPathBegin()), 1896 MacroAssembler::replaceWithJump( 1897 MacroAssembler::startOfBranchPtrWithPatchOnRegister(callLinkInfo.hotPathBegin()), 1923 1898 CodeLocationLabel(stubRoutine->code().code())); 1924 1899 // The original slow path is unreachable on 64-bits, but still 1925 1900 // reachable on 32-bits since a non-cell callee will always 1926 1901 // trigger the slow path 1927 linkSlowFor( repatchBuffer,vm, callLinkInfo);1902 linkSlowFor(vm, callLinkInfo); 1928 1903 1929 1904 // If there had been a previous stub routine, that one will die as soon as the GC runs and sees … … 1937 1912 } 1938 1913 1939 void resetGetByID( RepatchBuffer& repatchBuffer,CodeBlock* codeBlock, StructureStubInfo& stubInfo)1940 { 1941 repatchCall( repatchBuffer,codeBlock, stubInfo.callReturnLocation, operationGetByIdOptimize);1914 void resetGetByID(CodeBlock* codeBlock, StructureStubInfo& stubInfo) 1915 { 1916 repatchCall(codeBlock, stubInfo.callReturnLocation, operationGetByIdOptimize); 1942 1917 CodeLocationDataLabel32 structureLabel = stubInfo.callReturnLocation.dataLabel32AtOffset(-(intptr_t)stubInfo.patch.deltaCheckImmToCall); 1943 1918 if (MacroAssembler::canJumpReplacePatchableBranch32WithPatch()) { 1944 repatchBuffer.revertJumpReplacementToPatchableBranch32WithPatch(1945 RepatchBuffer::startOfPatchableBranch32WithPatchOnAddress(structureLabel),1919 MacroAssembler::revertJumpReplacementToPatchableBranch32WithPatch( 1920 MacroAssembler::startOfPatchableBranch32WithPatchOnAddress(structureLabel), 1946 1921 MacroAssembler::Address( 1947 1922 static_cast<MacroAssembler::RegisterID>(stubInfo.patch.baseGPR), … … 1949 1924 static_cast<int32_t>(unusedPointer)); 1950 1925 } 1951 repatchBuffer.repatch(structureLabel, static_cast<int32_t>(unusedPointer));1926 MacroAssembler::repatchInt32(structureLabel, static_cast<int32_t>(unusedPointer)); 1952 1927 #if USE(JSVALUE64) 1953 repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToLoadOrStore), 0);1928 MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToLoadOrStore), 0); 1954 1929 #else 1955 repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), 0);1956 repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), 0);1957 #endif 1958 repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase));1959 } 1960 1961 void resetPutByID( RepatchBuffer& repatchBuffer,CodeBlock* codeBlock, StructureStubInfo& stubInfo)1930 MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), 0); 1931 MacroAssembler::repatchCompact(stubInfo.callReturnLocation.dataLabelCompactAtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), 0); 1932 #endif 1933 MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase)); 1934 } 1935 1936 void resetPutByID(CodeBlock* codeBlock, StructureStubInfo& stubInfo) 1962 1937 { 1963 1938 V_JITOperation_ESsiJJI unoptimizedFunction = bitwise_cast<V_JITOperation_ESsiJJI>(readCallTarget(codeBlock, stubInfo.callReturnLocation).executableAddress()); … … 1973 1948 optimizedFunction = operationPutByIdDirectNonStrictOptimize; 1974 1949 } 1975 repatchCall( repatchBuffer,codeBlock, stubInfo.callReturnLocation, optimizedFunction);1950 repatchCall(codeBlock, stubInfo.callReturnLocation, optimizedFunction); 1976 1951 CodeLocationDataLabel32 structureLabel = stubInfo.callReturnLocation.dataLabel32AtOffset(-(intptr_t)stubInfo.patch.deltaCheckImmToCall); 1977 1952 if (MacroAssembler::canJumpReplacePatchableBranch32WithPatch()) { 1978 repatchBuffer.revertJumpReplacementToPatchableBranch32WithPatch(1979 RepatchBuffer::startOfPatchableBranch32WithPatchOnAddress(structureLabel),1953 MacroAssembler::revertJumpReplacementToPatchableBranch32WithPatch( 1954 MacroAssembler::startOfPatchableBranch32WithPatchOnAddress(structureLabel), 1980 1955 MacroAssembler::Address( 1981 1956 static_cast<MacroAssembler::RegisterID>(stubInfo.patch.baseGPR), … … 1983 1958 static_cast<int32_t>(unusedPointer)); 1984 1959 } 1985 repatchBuffer.repatch(structureLabel, static_cast<int32_t>(unusedPointer));1960 MacroAssembler::repatchInt32(structureLabel, static_cast<int32_t>(unusedPointer)); 1986 1961 #if USE(JSVALUE64) 1987 repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToLoadOrStore), 0);1962 MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToLoadOrStore), 0); 1988 1963 #else 1989 repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), 0);1990 repatchBuffer.repatch(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), 0);1991 #endif 1992 repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase));1993 } 1994 1995 void resetIn( RepatchBuffer& repatchBuffer,CodeBlock*, StructureStubInfo& stubInfo)1996 { 1997 repatchBuffer.relink(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase));1964 MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToTagLoadOrStore), 0); 1965 MacroAssembler::repatchInt32(stubInfo.callReturnLocation.dataLabel32AtOffset(stubInfo.patch.deltaCallToPayloadLoadOrStore), 0); 1966 #endif 1967 MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase)); 1968 } 1969 1970 void resetIn(CodeBlock*, StructureStubInfo& stubInfo) 1971 { 1972 MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase)); 1998 1973 } 1999 1974 -
trunk/Source/JavaScriptCore/jit/Repatch.h
r189278 r189288 43 43 void linkFor(ExecState*, CallLinkInfo&, CodeBlock*, JSFunction* callee, MacroAssemblerCodePtr); 44 44 void linkSlowFor(ExecState*, CallLinkInfo&); 45 void unlinkFor(VM&, RepatchBuffer&,CallLinkInfo&);45 void unlinkFor(VM&, CallLinkInfo&); 46 46 void linkVirtualFor(ExecState*, CallLinkInfo&); 47 47 void linkPolymorphicCall(ExecState*, CallLinkInfo&, CallVariant); 48 void resetGetByID( RepatchBuffer&,CodeBlock*, StructureStubInfo&);49 void resetPutByID( RepatchBuffer&,CodeBlock*, StructureStubInfo&);50 void resetIn( RepatchBuffer&,CodeBlock*, StructureStubInfo&);48 void resetGetByID(CodeBlock*, StructureStubInfo&); 49 void resetPutByID(CodeBlock*, StructureStubInfo&); 50 void resetIn(CodeBlock*, StructureStubInfo&); 51 51 52 52 } // namespace JSC
Note: See TracChangeset
for help on using the changeset viewer.