On X86, switch bucketCount into a register, timeoutCheck into memory
https://bugs.webkit.org/show_bug.cgi?id=69299

Reviewed by Geoff Garen.

We don't have sufficient registers to keep both in registers, and DFG JIT will trample esi;
it doesn't matter if the bucketCount gets stomped on (in fact it may add to randomness!),
but it if the timeoutCheck gets trashed we may make calls out to the timout_check stub
function too frequently (regressing performance). This patch has no perf impact on sunspider.

* JavaScriptCore.xcodeproj/project.pbxproj:
* assembler/MacroAssemblerX86.h:
(JSC::MacroAssemblerX86::branchAdd32):
(JSC::MacroAssemblerX86::branchSub32):
    - Added branchSub32 with AbsoluteAddress.
* jit/JIT.cpp:
(JSC::JIT::emitTimeoutCheck):
    - Keep timeout count in memory on X86.
* jit/JITInlineMethods.h:
(JSC::JIT::emitValueProfilingSite):
    - remove X86 specific code, switch bucket count back into a register.
* jit/JITStubs.cpp:
    - Stop initializing esi (it is no longer the timeoutCheck!)
* jit/JSInterfaceJIT.h:
    - change definition of esi to be the bucketCountRegister.
* runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::JSGlobalData):
* runtime/JSGlobalData.h:
    - Add timeoutCount as a property to global data (the counter should be per-thread).



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96563 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerX86.h b/Source/JavaScriptCore/assembler/MacroAssemblerX86.h
index 64a1437..db701f1 100644
--- a/Source/JavaScriptCore/assembler/MacroAssemblerX86.h
+++ b/Source/JavaScriptCore/assembler/MacroAssemblerX86.h
@@ -44,6 +44,7 @@
     using MacroAssemblerX86Common::add32;
     using MacroAssemblerX86Common::and32;
     using MacroAssemblerX86Common::branchAdd32;
+    using MacroAssemblerX86Common::branchSub32;
     using MacroAssemblerX86Common::sub32;
     using MacroAssemblerX86Common::or32;
     using MacroAssemblerX86Common::load32;
@@ -122,9 +123,15 @@
         m_assembler.movl_rm(src, address);
     }
 
-    Jump branchAdd32(ResultCondition cond, TrustedImm32 src, AbsoluteAddress dest)
+    Jump branchAdd32(ResultCondition cond, TrustedImm32 imm, AbsoluteAddress dest)
     {
-        m_assembler.addl_im(src.m_value, dest.m_ptr);
+        m_assembler.addl_im(imm.m_value, dest.m_ptr);
+        return Jump(m_assembler.jCC(x86Condition(cond)));
+    }
+
+    Jump branchSub32(ResultCondition cond, TrustedImm32 imm, AbsoluteAddress dest)
+    {
+        m_assembler.subl_im(imm.m_value, dest.m_ptr);
         return Jump(m_assembler.jCC(x86Condition(cond)));
     }