2008-10-17  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Cameron Zwarich.
        
        - Avoid restoring the caller's 'r' value in op_ret
        https://bugs.webkit.org/show_bug.cgi?id=21319

        This patch stops writing the call frame at call and return points;
        instead it does so immediately before any CTI call.
        
        0.5% speedup or so on the v8 benchmark
               
        * VM/CTI.cpp:
        (JSC::CTI::emitCTICall):
        (JSC::CTI::compileOpCall):
        (JSC::CTI::emitSlowScriptCheck):
        (JSC::CTI::compileBinaryArithOpSlowCase):
        (JSC::CTI::privateCompileMainPass):
        (JSC::CTI::privateCompileSlowCases):
        (JSC::CTI::privateCompile):
        * VM/CTI.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37650 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/VM/CTI.h b/JavaScriptCore/VM/CTI.h
index 4b6cbda..26338dc 100644
--- a/JavaScriptCore/VM/CTI.h
+++ b/JavaScriptCore/VM/CTI.h
@@ -44,8 +44,8 @@
 #define CTI_ARGS_exception 0x0F
 #define CTI_ARGS_profilerReference 0x10
 #define CTI_ARGS_globalData 0x11
-#define ARG_registerFile ((RegisterFile*)(ARGS)[CTI_ARGS_registerFile])
 #define ARG_callFrame ((CallFrame*)(ARGS)[CTI_ARGS_callFrame])
+#define ARG_registerFile ((RegisterFile*)(ARGS)[CTI_ARGS_registerFile])
 #define ARG_exception ((JSValue**)(ARGS)[CTI_ARGS_exception])
 #define ARG_profilerReference ((Profiler**)(ARGS)[CTI_ARGS_profilerReference])
 #define ARG_globalData ((JSGlobalData*)(ARGS)[CTI_ARGS_globalData])
@@ -253,9 +253,9 @@
         static const int repatchOffsetGetByIdBranchToSlowCase = 25;
         static const int repatchOffsetGetByIdPropertyMapOffset = 34;
 #if ENABLE(SAMPLING_TOOL)
-        static const int repatchOffsetGetByIdSlowCaseCall = 27 + ctiArgumentInitSize;
+        static const int repatchOffsetGetByIdSlowCaseCall = 27 + 4 + ctiArgumentInitSize;
 #else
-        static const int repatchOffsetGetByIdSlowCaseCall = 17 + ctiArgumentInitSize;
+        static const int repatchOffsetGetByIdSlowCaseCall = 17 + 4 + ctiArgumentInitSize;
 #endif
 
     public:
@@ -389,12 +389,12 @@
         void emitTagAsBoolImmediate(X86Assembler::RegisterID reg);
 
         X86Assembler::JmpSrc emitCall(unsigned opcodeIndex, X86::RegisterID);
-        X86Assembler::JmpSrc emitCall(unsigned opcodeIndex, CTIHelper_j);
-        X86Assembler::JmpSrc emitCall(unsigned opcodeIndex, CTIHelper_p);
-        X86Assembler::JmpSrc emitCall(unsigned opcodeIndex, CTIHelper_v);
-        X86Assembler::JmpSrc emitCall(unsigned opcodeIndex, CTIHelper_s);
-        X86Assembler::JmpSrc emitCall(unsigned opcodeIndex, CTIHelper_b);
-        X86Assembler::JmpSrc emitCall(unsigned opcodeIndex, CTIHelper_2);
+        X86Assembler::JmpSrc emitCTICall(unsigned opcodeIndex, CTIHelper_j);
+        X86Assembler::JmpSrc emitCTICall(unsigned opcodeIndex, CTIHelper_p);
+        X86Assembler::JmpSrc emitCTICall(unsigned opcodeIndex, CTIHelper_v);
+        X86Assembler::JmpSrc emitCTICall(unsigned opcodeIndex, CTIHelper_s);
+        X86Assembler::JmpSrc emitCTICall(unsigned opcodeIndex, CTIHelper_b);
+        X86Assembler::JmpSrc emitCTICall(unsigned opcodeIndex, CTIHelper_2);
 
         void emitGetVariableObjectRegister(X86Assembler::RegisterID variableObject, int index, X86Assembler::RegisterID dst);
         void emitPutVariableObjectRegister(X86Assembler::RegisterID src, X86Assembler::RegisterID variableObject, int index);