32-bit Build fix: declare virtual register indices to be int rather than
unsigned, since they can be positive or negative.
        
For better clarity, explicitly use ReturnPC instead of -1 as the "invalid"
state, since we'll never load and operate on the ReturnPC as a JS value.

* jit/JIT.cpp:
(JSC::JIT::JIT):
* jit/JIT.h:
* jit/JITInlineMethods.h:
(JSC::JIT::emitLoadTag):
(JSC::JIT::emitLoadPayload):
(JSC::JIT::emitLoad):
(JSC::JIT::emitLoad2):
(JSC::JIT::emitLoadDouble):
(JSC::JIT::emitLoadInt32ToDouble):
(JSC::JIT::emitStore):
(JSC::JIT::emitStoreInt32):
(JSC::JIT::emitStoreAndMapInt32):
(JSC::JIT::emitStoreCell):
(JSC::JIT::emitStoreBool):
(JSC::JIT::emitStoreDouble):
(JSC::JIT::map):
(JSC::JIT::unmap):
(JSC::JIT::isMapped):
(JSC::JIT::getMappedPayload):
(JSC::JIT::getMappedTag):
(JSC::JIT::emitJumpSlowCaseIfNotJSCell):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@100171 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/jit/JITInlineMethods.h b/Source/JavaScriptCore/jit/JITInlineMethods.h
index 6e9e3c6..efe7080 100644
--- a/Source/JavaScriptCore/jit/JITInlineMethods.h
+++ b/Source/JavaScriptCore/jit/JITInlineMethods.h
@@ -499,7 +499,7 @@
 
 #if USE(JSVALUE32_64)
 
-inline void JIT::emitLoadTag(unsigned index, RegisterID tag)
+inline void JIT::emitLoadTag(int index, RegisterID tag)
 {
     RegisterID mappedTag;
     if (getMappedTag(index, mappedTag)) {
@@ -518,7 +518,7 @@
     unmap(tag);
 }
 
-inline void JIT::emitLoadPayload(unsigned index, RegisterID payload)
+inline void JIT::emitLoadPayload(int index, RegisterID payload)
 {
     RegisterID mappedPayload;
     if (getMappedPayload(index, mappedPayload)) {
@@ -543,7 +543,7 @@
     move(Imm32(v.tag()), tag);
 }
 
-inline void JIT::emitLoad(unsigned index, RegisterID tag, RegisterID payload, RegisterID base)
+inline void JIT::emitLoad(int index, RegisterID tag, RegisterID payload, RegisterID base)
 {
     ASSERT(tag != payload);
 
@@ -564,7 +564,7 @@
     load32(tagFor(index, base), tag);
 }
 
-inline void JIT::emitLoad2(unsigned index1, RegisterID tag1, RegisterID payload1, unsigned index2, RegisterID tag2, RegisterID payload2)
+inline void JIT::emitLoad2(int index1, RegisterID tag1, RegisterID payload1, int index2, RegisterID tag2, RegisterID payload2)
 {
     if (isMapped(index1)) {
         emitLoad(index1, tag1, payload1);
@@ -575,7 +575,7 @@
     emitLoad(index1, tag1, payload1);
 }
 
-inline void JIT::emitLoadDouble(unsigned index, FPRegisterID value)
+inline void JIT::emitLoadDouble(int index, FPRegisterID value)
 {
     if (m_codeBlock->isConstantRegisterIndex(index)) {
         WriteBarrier<Unknown>& inConstantPool = m_codeBlock->constantRegister(index);
@@ -584,7 +584,7 @@
         loadDouble(addressFor(index), value);
 }
 
-inline void JIT::emitLoadInt32ToDouble(unsigned index, FPRegisterID value)
+inline void JIT::emitLoadInt32ToDouble(int index, FPRegisterID value)
 {
     if (m_codeBlock->isConstantRegisterIndex(index)) {
         WriteBarrier<Unknown>& inConstantPool = m_codeBlock->constantRegister(index);
@@ -594,52 +594,52 @@
         convertInt32ToDouble(payloadFor(index), value);
 }
 
-inline void JIT::emitStore(unsigned index, RegisterID tag, RegisterID payload, RegisterID base)
+inline void JIT::emitStore(int index, RegisterID tag, RegisterID payload, RegisterID base)
 {
     store32(payload, payloadFor(index, base));
     store32(tag, tagFor(index, base));
 }
 
-inline void JIT::emitStoreInt32(unsigned index, RegisterID payload, bool indexIsInt32)
+inline void JIT::emitStoreInt32(int index, RegisterID payload, bool indexIsInt32)
 {
     store32(payload, payloadFor(index, callFrameRegister));
     if (!indexIsInt32)
         store32(TrustedImm32(JSValue::Int32Tag), tagFor(index, callFrameRegister));
 }
 
-inline void JIT::emitStoreAndMapInt32(unsigned index, RegisterID tag, RegisterID payload, bool indexIsInt32, size_t opcodeLength)
+inline void JIT::emitStoreAndMapInt32(int index, RegisterID tag, RegisterID payload, bool indexIsInt32, size_t opcodeLength)
 {
     emitStoreInt32(index, payload, indexIsInt32);
     map(m_bytecodeOffset + opcodeLength, index, tag, payload);
 }
 
-inline void JIT::emitStoreInt32(unsigned index, TrustedImm32 payload, bool indexIsInt32)
+inline void JIT::emitStoreInt32(int index, TrustedImm32 payload, bool indexIsInt32)
 {
     store32(payload, payloadFor(index, callFrameRegister));
     if (!indexIsInt32)
         store32(TrustedImm32(JSValue::Int32Tag), tagFor(index, callFrameRegister));
 }
 
-inline void JIT::emitStoreCell(unsigned index, RegisterID payload, bool indexIsCell)
+inline void JIT::emitStoreCell(int index, RegisterID payload, bool indexIsCell)
 {
     store32(payload, payloadFor(index, callFrameRegister));
     if (!indexIsCell)
         store32(TrustedImm32(JSValue::CellTag), tagFor(index, callFrameRegister));
 }
 
-inline void JIT::emitStoreBool(unsigned index, RegisterID payload, bool indexIsBool)
+inline void JIT::emitStoreBool(int index, RegisterID payload, bool indexIsBool)
 {
     store32(payload, payloadFor(index, callFrameRegister));
     if (!indexIsBool)
         store32(TrustedImm32(JSValue::BooleanTag), tagFor(index, callFrameRegister));
 }
 
-inline void JIT::emitStoreDouble(unsigned index, FPRegisterID value)
+inline void JIT::emitStoreDouble(int index, FPRegisterID value)
 {
     storeDouble(value, addressFor(index));
 }
 
-inline void JIT::emitStore(unsigned index, const JSValue constant, RegisterID base)
+inline void JIT::emitStore(int index, const JSValue constant, RegisterID base)
 {
     store32(Imm32(constant.payload()), payloadFor(index, base));
     store32(Imm32(constant.tag()), tagFor(index, base));
@@ -662,7 +662,7 @@
     return false;
 }
 
-inline void JIT::map(unsigned bytecodeOffset, unsigned virtualRegisterIndex, RegisterID tag, RegisterID payload)
+inline void JIT::map(unsigned bytecodeOffset, int virtualRegisterIndex, RegisterID tag, RegisterID payload)
 {
     if (isLabeled(bytecodeOffset))
         return;
@@ -684,12 +684,12 @@
 inline void JIT::unmap()
 {
     m_mappedBytecodeOffset = (unsigned)-1;
-    m_mappedVirtualRegisterIndex = (unsigned)-1;
+    m_mappedVirtualRegisterIndex = RegisterFile::ReturnPC;
     m_mappedTag = (RegisterID)-1;
     m_mappedPayload = (RegisterID)-1;
 }
 
-inline bool JIT::isMapped(unsigned virtualRegisterIndex)
+inline bool JIT::isMapped(int virtualRegisterIndex)
 {
     if (m_mappedBytecodeOffset != m_bytecodeOffset)
         return false;
@@ -698,7 +698,7 @@
     return true;
 }
 
-inline bool JIT::getMappedPayload(unsigned virtualRegisterIndex, RegisterID& payload)
+inline bool JIT::getMappedPayload(int virtualRegisterIndex, RegisterID& payload)
 {
     if (m_mappedBytecodeOffset != m_bytecodeOffset)
         return false;
@@ -710,7 +710,7 @@
     return true;
 }
 
-inline bool JIT::getMappedTag(unsigned virtualRegisterIndex, RegisterID& tag)
+inline bool JIT::getMappedTag(int virtualRegisterIndex, RegisterID& tag)
 {
     if (m_mappedBytecodeOffset != m_bytecodeOffset)
         return false;
@@ -722,7 +722,7 @@
     return true;
 }
 
-inline void JIT::emitJumpSlowCaseIfNotJSCell(unsigned virtualRegisterIndex)
+inline void JIT::emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex)
 {
     if (!m_codeBlock->isKnownNotImmediate(virtualRegisterIndex)) {
         if (m_codeBlock->isConstantRegisterIndex(virtualRegisterIndex))
@@ -732,7 +732,7 @@
     }
 }
 
-inline void JIT::emitJumpSlowCaseIfNotJSCell(unsigned virtualRegisterIndex, RegisterID tag)
+inline void JIT::emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex, RegisterID tag)
 {
     if (!m_codeBlock->isKnownNotImmediate(virtualRegisterIndex)) {
         if (m_codeBlock->isConstantRegisterIndex(virtualRegisterIndex))
@@ -742,12 +742,6 @@
     }
 }
 
-inline void JIT::linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator& iter, unsigned virtualRegisterIndex)
-{
-    if (!m_codeBlock->isKnownNotImmediate(virtualRegisterIndex))
-        linkSlowCase(iter);
-}
-
 ALWAYS_INLINE bool JIT::isOperandConstantImmediateInt(unsigned src)
 {
     return m_codeBlock->isConstantRegisterIndex(src) && getConstantOperand(src).isInt32();
@@ -877,7 +871,7 @@
 
 #if USE(JSVALUE64)
 
-inline void JIT::emitLoadDouble(unsigned index, FPRegisterID value)
+inline void JIT::emitLoadDouble(int index, FPRegisterID value)
 {
     if (m_codeBlock->isConstantRegisterIndex(index)) {
         WriteBarrier<Unknown>& inConstantPool = m_codeBlock->constantRegister(index);
@@ -886,7 +880,7 @@
         loadDouble(addressFor(index), value);
 }
 
-inline void JIT::emitLoadInt32ToDouble(unsigned index, FPRegisterID value)
+inline void JIT::emitLoadInt32ToDouble(int index, FPRegisterID value)
 {
     if (m_codeBlock->isConstantRegisterIndex(index)) {
         ASSERT(isOperandConstantImmediateInt(index));