2009-07-21  Gavin Barraclough  <barraclough@apple.com>

        Reviewed by Sam Weinig.

        Move call linking / repatching down from AbstractMacroAssembler into MacroAssemblerARCH classes.
        ( https://bugs.webkit.org/show_bug.cgi?id=27527 )

        This allows the implementation to be defined per architecture.  Specifically this addresses the
        fact that x86-64 MacroAssembler implements far calls as a load to register, followed by a call
        to register.  Patching the call actually requires the pointer load to be patched, rather than
        the call to be patched.  This is implementation detail specific to MacroAssemblerX86_64, and as
        such is best handled there.

        * assembler/AbstractMacroAssembler.h:
        * assembler/MacroAssemblerARM.h:
        (JSC::MacroAssemblerARM::linkCall):
        (JSC::MacroAssemblerARM::repatchCall):
        * assembler/MacroAssemblerARMv7.h:
        (JSC::MacroAssemblerARMv7::linkCall):
        (JSC::MacroAssemblerARMv7::repatchCall):
        * assembler/MacroAssemblerX86.h:
        (JSC::MacroAssemblerX86::linkCall):
        (JSC::MacroAssemblerX86::repatchCall):
        * assembler/MacroAssemblerX86_64.h:
        (JSC::MacroAssemblerX86_64::linkCall):
        (JSC::MacroAssemblerX86_64::repatchCall):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@46209 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/assembler/MacroAssemblerX86.h b/JavaScriptCore/assembler/MacroAssemblerX86.h
index aaf98fd..0b9ff35 100644
--- a/JavaScriptCore/assembler/MacroAssemblerX86.h
+++ b/JavaScriptCore/assembler/MacroAssemblerX86.h
@@ -164,6 +164,24 @@
 
 private:
     const bool m_isSSE2Present;
+
+    friend class LinkBuffer;
+    friend class RepatchBuffer;
+
+    static void linkCall(void* code, Call call, FunctionPtr function)
+    {
+        X86Assembler::linkCall(code, call.m_jmp, function.value());
+    }
+
+    static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)
+    {
+        X86Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
+    }
+
+    static void repatchCall(CodeLocationCall call, FunctionPtr destination)
+    {
+        X86Assembler::relinkCall(call.dataLocation(), destination.executableAddress());
+    }
 };
 
 } // namespace JSC