DFG::OSRExit::m_patchableCodeOffset should not be an int
authorsbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Sep 2018 04:46:50 +0000 (04:46 +0000)
committersbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 28 Sep 2018 04:46:50 +0000 (04:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=190066
<rdar://problem/39498244>

Reviewed by Mark Lam.

* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::linkOSRExits):
(JSC::DFG::JITCompiler::link):
* dfg/DFGOSRExit.cpp:
(JSC::DFG::OSRExit::codeLocationForRepatch const):
(JSC::DFG::OSRExit::compileOSRExit):
(JSC::DFG::OSRExit::setPatchableCodeOffset): Deleted.
(JSC::DFG::OSRExit::getPatchableCodeOffsetAsJump const): Deleted.
(JSC::DFG::OSRExit::correctJump): Deleted.
* dfg/DFGOSRExit.h:
* dfg/DFGOSRExitCompilationInfo.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236585 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGJITCompiler.cpp
Source/JavaScriptCore/dfg/DFGOSRExit.cpp
Source/JavaScriptCore/dfg/DFGOSRExit.h
Source/JavaScriptCore/dfg/DFGOSRExitCompilationInfo.h

index 56e3e4f..79a60d5 100644 (file)
@@ -1,5 +1,25 @@
 2018-09-27  Saam barati  <sbarati@apple.com>
 
+        DFG::OSRExit::m_patchableCodeOffset should not be an int
+        https://bugs.webkit.org/show_bug.cgi?id=190066
+        <rdar://problem/39498244>
+
+        Reviewed by Mark Lam.
+
+        * dfg/DFGJITCompiler.cpp:
+        (JSC::DFG::JITCompiler::linkOSRExits):
+        (JSC::DFG::JITCompiler::link):
+        * dfg/DFGOSRExit.cpp:
+        (JSC::DFG::OSRExit::codeLocationForRepatch const):
+        (JSC::DFG::OSRExit::compileOSRExit):
+        (JSC::DFG::OSRExit::setPatchableCodeOffset): Deleted.
+        (JSC::DFG::OSRExit::getPatchableCodeOffsetAsJump const): Deleted.
+        (JSC::DFG::OSRExit::correctJump): Deleted.
+        * dfg/DFGOSRExit.h:
+        * dfg/DFGOSRExitCompilationInfo.h:
+
+2018-09-27  Saam barati  <sbarati@apple.com>
+
         Don't use int offsets in StructureStubInfo
         https://bugs.webkit.org/show_bug.cgi?id=190064
         <rdar://problem/44784719>
index 9b1dd9b..4337642 100644 (file)
@@ -102,10 +102,8 @@ void JITCompiler::linkOSRExits()
             addLinkTask([target, osrExitThunkLabel] (LinkBuffer& linkBuffer) {
                 linkBuffer.link(target, osrExitThunkLabel);
             });
-        } else {
-            OSRExit& exit = m_jitCode->osrExit[i];
-            exit.setPatchableCodeOffset(patchableJump());
-        }
+        } else
+            info.m_patchableJump = patchableJump();
     }
 }
 
@@ -300,9 +298,9 @@ void JITCompiler::link(LinkBuffer& linkBuffer)
     for (unsigned i = 0; i < m_jitCode->osrExit.size(); ++i) {
         OSRExitCompilationInfo& info = m_exitCompilationInfo[i];
         if (!Options::useProbeOSRExit()) {
+            linkBuffer.link(info.m_patchableJump.m_jump, target);
             OSRExit& exit = m_jitCode->osrExit[i];
-            linkBuffer.link(exit.getPatchableCodeOffsetAsJump(), target);
-            exit.correctJump(linkBuffer);
+            exit.m_patchableJumpLocation = linkBuffer.locationOf<JSInternalPtrTag>(info.m_patchableJump);
         }
         if (info.m_replacementSource.isSet()) {
             m_jitCode->common.jumpReplacements.append(JumpReplacement(
index 3883bc7..f921abf 100644 (file)
@@ -921,26 +921,9 @@ OSRExit::OSRExit(ExitKind kind, JSValueSource jsValueSource, MethodOfGettingAVal
     DFG_ASSERT(jit->m_jit.graph(), jit->m_currentNode, canExit);
 }
 
-void OSRExit::setPatchableCodeOffset(MacroAssembler::PatchableJump check)
+CodeLocationJump<JSInternalPtrTag> OSRExit::codeLocationForRepatch() const
 {
-    m_patchableCodeOffset = check.m_jump.m_label.m_offset;
-}
-
-MacroAssembler::Jump OSRExit::getPatchableCodeOffsetAsJump() const
-{
-    return MacroAssembler::Jump(AssemblerLabel(m_patchableCodeOffset));
-}
-
-CodeLocationJump<JSInternalPtrTag> OSRExit::codeLocationForRepatch(CodeBlock* dfgCodeBlock) const
-{
-    return CodeLocationJump<JSInternalPtrTag>(tagCodePtr<JSInternalPtrTag>(dfgCodeBlock->jitCode()->dataAddressAtOffset(m_patchableCodeOffset)));
-}
-
-void OSRExit::correctJump(LinkBuffer& linkBuffer)
-{
-    MacroAssembler::Label label;
-    label.m_label.m_offset = m_patchableCodeOffset;
-    m_patchableCodeOffset = linkBuffer.offsetOf(label);
+    return CodeLocationJump<JSInternalPtrTag>(m_patchableJumpLocation);
 }
 
 void OSRExit::emitRestoreArguments(CCallHelpers& jit, const Operands<ValueRecovery>& operands)
@@ -1082,7 +1065,7 @@ void JIT_OPERATION OSRExit::compileOSRExit(ExecState* exec)
                 toCString(ignoringContext<DumpContext>(operands)).data());
     }
 
-    MacroAssembler::repatchJump(exit.codeLocationForRepatch(codeBlock), CodeLocationLabel<OSRExitPtrTag>(exit.m_code.code()));
+    MacroAssembler::repatchJump(exit.codeLocationForRepatch(), CodeLocationLabel<OSRExitPtrTag>(exit.m_code.code()));
 
     vm->osrExitJumpDestination = exit.m_code.code().executableAddress();
 }
index 4554975..ca913ca 100644 (file)
@@ -145,8 +145,7 @@ struct OSRExit : public OSRExitBase {
     static void JIT_OPERATION compileOSRExit(ExecState*) WTF_INTERNAL;
     static void executeOSRExit(Probe::Context&);
 
-    // FIXME: <rdar://problem/39498244>.
-    unsigned m_patchableCodeOffset { 0 };
+    CodeLocationLabel<JSInternalPtrTag> m_patchableJumpLocation;
     MacroAssemblerCodeRef<OSRExitPtrTag> m_code;
 
     RefPtr<OSRExitState> exitState;
@@ -156,10 +155,7 @@ struct OSRExit : public OSRExitBase {
     
     unsigned m_recoveryIndex;
 
-    void setPatchableCodeOffset(MacroAssembler::PatchableJump);
-    MacroAssembler::Jump getPatchableCodeOffsetAsJump() const;
-    CodeLocationJump<JSInternalPtrTag> codeLocationForRepatch(CodeBlock*) const;
-    void correctJump(LinkBuffer&);
+    CodeLocationJump<JSInternalPtrTag> codeLocationForRepatch() const;
 
     unsigned m_streamIndex;
     void considerAddingAsFrequentExitSite(CodeBlock* profiledCodeBlock)
index 544d213..4d038ea 100644 (file)
@@ -35,6 +35,7 @@ struct OSRExitCompilationInfo {
     MacroAssembler::JumpList m_failureJumps;
     MacroAssembler::Label m_replacementSource;
     MacroAssembler::Label m_replacementDestination;
+    MacroAssembler::PatchableJump m_patchableJump;
 };
 
 } } // namespace JSC::DFG