]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - assembler/RepatchBuffer.h
JavaScriptCore-1218.34.tar.gz
[apple/javascriptcore.git] / assembler / RepatchBuffer.h
index 72cf6b27f09e3507e9cdfec0c7cff904260cc03f..dbb56f9ad5a76c394c5611365dc3a26d43c8623f 100644 (file)
@@ -26,8 +26,9 @@
 #ifndef RepatchBuffer_h
 #define RepatchBuffer_h
 
-#if ENABLE(ASSEMBLER)
+#if ENABLE(JIT)
 
+#include "CodeBlock.h"
 #include <MacroAssembler.h>
 #include <wtf/Noncopyable.h>
 
@@ -87,14 +88,14 @@ public:
         MacroAssembler::repatchInt32(dataLabel32, value);
     }
 
-    void repatch(CodeLocationDataLabelPtr dataLabelPtr, void* value)
+    void repatch(CodeLocationDataLabelCompact dataLabelCompact, int32_t value)
     {
-        MacroAssembler::repatchPointer(dataLabelPtr, value);
+        MacroAssembler::repatchCompact(dataLabelCompact, value);
     }
 
-    void repatchLoadPtrToLEA(CodeLocationInstruction instruction)
+    void repatch(CodeLocationDataLabelPtr dataLabelPtr, void* value)
     {
-        MacroAssembler::repatchLoadPtrToLEA(instruction);
+        MacroAssembler::repatchPointer(dataLabelPtr, value);
     }
 
     void relinkCallerToTrampoline(ReturnAddressPtr returnAddress, CodeLocationLabel label)
@@ -121,6 +122,52 @@ public:
     {
         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);
+    }
+    
+    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);
+    }
 
 private:
     void* m_start;