2008-12-15  Gavin Barraclough  <barraclough@apple.com>

        Rubber stamped by Mark Rowe.

        Revert r39226 / Bug 22818: Unify JIT callback argument access OS X / Windows
        This causes Acid3 failures – reverting for now & will revisit later.
        https://bugs.webkit.org/show_bug.cgi?id=22873

        * interpreter/Interpreter.h:
        * jit/JIT.cpp:
        (JSC::JIT::privateCompileCTIMachineTrampolines):
        * jit/JIT.h:
        * jit/JITInlineMethods.h:
        (JSC::JIT::restoreArgumentReference):
        (JSC::JIT::restoreArgumentReferenceForTrampoline):
        (JSC::JIT::emitCTICall_internal):
        * jit/JITPropertyAccess.cpp:
        (JSC::JIT::privateCompilePutByIdTransition):
        * wtf/Platform.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@39325 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/jit/JITInlineMethods.h b/JavaScriptCore/jit/JITInlineMethods.h
index d3d4755..a6d8f99 100644
--- a/JavaScriptCore/jit/JITInlineMethods.h
+++ b/JavaScriptCore/jit/JITInlineMethods.h
@@ -203,6 +203,26 @@
     return nakedCall;
 }
 
+ALWAYS_INLINE void JIT::restoreArgumentReference()
+{
+#if USE(CTI_ARGUMENT)
+#if USE(FAST_CALL_CTI_ARGUMENT)
+    m_assembler.movl_rr(X86::esp, X86::ecx);
+#else
+    m_assembler.movl_rm(X86::esp, 0, X86::esp);
+#endif
+#endif
+}
+
+ALWAYS_INLINE void JIT::restoreArgumentReferenceForTrampoline()
+{
+#if USE(CTI_ARGUMENT) && USE(FAST_CALL_CTI_ARGUMENT)
+    m_assembler.movl_rr(X86::esp, X86::ecx);
+    m_assembler.addl_ir(4, X86::ecx);
+#endif
+}
+
+
 ALWAYS_INLINE JIT::Jump JIT::emitCTICall_internal(void* helper)
 {
     ASSERT(m_bytecodeIndex != (unsigned)-1); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set.
@@ -210,6 +230,7 @@
 #if ENABLE(OPCODE_SAMPLING)
     store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + m_bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
 #endif
+    restoreArgumentReference();
     emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
     Jump ctiCall = call();
     m_calls.append(CallRecord(ctiCall, m_bytecodeIndex, helper));