Title: [100171] trunk/Source/_javascript_Core
Revision
100171
Author
gga...@apple.com
Date
2011-11-14 11:44:32 -0800 (Mon, 14 Nov 2011)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (100170 => 100171)


--- trunk/Source/_javascript_Core/ChangeLog	2011-11-14 19:39:30 UTC (rev 100170)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-11-14 19:44:32 UTC (rev 100171)
@@ -1,3 +1,34 @@
+2011-11-14  Geoffrey Garen  <gga...@apple.com>
+
+        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):
+
 2011-11-14  Michael Saboff  <msab...@apple.com>
 
         Remove unused m_data member from UStringSourceProvider

Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (100170 => 100171)


--- trunk/Source/_javascript_Core/jit/JIT.cpp	2011-11-14 19:39:30 UTC (rev 100170)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp	2011-11-14 19:44:32 UTC (rev 100171)
@@ -78,7 +78,7 @@
 #if USE(JSVALUE32_64)
     , m_jumpTargetIndex(0)
     , m_mappedBytecodeOffset((unsigned)-1)
-    , m_mappedVirtualRegisterIndex((unsigned)-1)
+    , m_mappedVirtualRegisterIndex(RegisterFile::ReturnPC)
     , m_mappedTag((RegisterID)-1)
     , m_mappedPayload((RegisterID)-1)
 #else

Modified: trunk/Source/_javascript_Core/jit/JIT.h (100170 => 100171)


--- trunk/Source/_javascript_Core/jit/JIT.h	2011-11-14 19:39:30 UTC (rev 100170)
+++ trunk/Source/_javascript_Core/jit/JIT.h	2011-11-14 19:44:32 UTC (rev 100171)
@@ -312,8 +312,8 @@
         void compileOpStrictEq(Instruction* instruction, CompileOpStrictEqType type);
         bool isOperandConstantImmediateDouble(unsigned src);
         
-        void emitLoadDouble(unsigned index, FPRegisterID value);
-        void emitLoadInt32ToDouble(unsigned index, FPRegisterID value);
+        void emitLoadDouble(int index, FPRegisterID value);
+        void emitLoadInt32ToDouble(int index, FPRegisterID value);
         Jump emitJumpIfNotObject(RegisterID structureReg);
         Jump emitJumpIfNotType(RegisterID baseReg, RegisterID scratchReg, JSType);
 
@@ -341,33 +341,32 @@
 #if USE(JSVALUE32_64)
         bool getOperandConstantImmediateInt(unsigned op1, unsigned op2, unsigned& op, int32_t& constant);
 
-        void emitLoadTag(unsigned index, RegisterID tag);
-        void emitLoadPayload(unsigned index, RegisterID payload);
+        void emitLoadTag(int index, RegisterID tag);
+        void emitLoadPayload(int index, RegisterID payload);
 
         void emitLoad(const JSValue& v, RegisterID tag, RegisterID payload);
-        void emitLoad(unsigned index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
-        void emitLoad2(unsigned index1, RegisterID tag1, RegisterID payload1, unsigned index2, RegisterID tag2, RegisterID payload2);
+        void emitLoad(int index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
+        void emitLoad2(int index1, RegisterID tag1, RegisterID payload1, int index2, RegisterID tag2, RegisterID payload2);
 
-        void emitStore(unsigned index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
-        void emitStore(unsigned index, const JSValue constant, RegisterID base = callFrameRegister);
-        void emitStoreInt32(unsigned index, RegisterID payload, bool indexIsInt32 = false);
-        void emitStoreInt32(unsigned index, TrustedImm32 payload, bool indexIsInt32 = false);
-        void emitStoreAndMapInt32(unsigned index, RegisterID tag, RegisterID payload, bool indexIsInt32, size_t opcodeLength);
-        void emitStoreCell(unsigned index, RegisterID payload, bool indexIsCell = false);
-        void emitStoreBool(unsigned index, RegisterID payload, bool indexIsBool = false);
-        void emitStoreDouble(unsigned index, FPRegisterID value);
+        void emitStore(int index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
+        void emitStore(int index, const JSValue constant, RegisterID base = callFrameRegister);
+        void emitStoreInt32(int index, RegisterID payload, bool indexIsInt32 = false);
+        void emitStoreInt32(int index, TrustedImm32 payload, bool indexIsInt32 = false);
+        void emitStoreAndMapInt32(int index, RegisterID tag, RegisterID payload, bool indexIsInt32, size_t opcodeLength);
+        void emitStoreCell(int index, RegisterID payload, bool indexIsCell = false);
+        void emitStoreBool(int index, RegisterID payload, bool indexIsBool = false);
+        void emitStoreDouble(int index, FPRegisterID value);
 
         bool isLabeled(unsigned bytecodeOffset);
-        void map(unsigned bytecodeOffset, unsigned virtualRegisterIndex, RegisterID tag, RegisterID payload);
+        void map(unsigned bytecodeOffset, int virtualRegisterIndex, RegisterID tag, RegisterID payload);
         void unmap(RegisterID);
         void unmap();
-        bool isMapped(unsigned virtualRegisterIndex);
-        bool getMappedPayload(unsigned virtualRegisterIndex, RegisterID& payload);
-        bool getMappedTag(unsigned virtualRegisterIndex, RegisterID& tag);
+        bool isMapped(int virtualRegisterIndex);
+        bool getMappedPayload(int virtualRegisterIndex, RegisterID& payload);
+        bool getMappedTag(int virtualRegisterIndex, RegisterID& tag);
 
-        void emitJumpSlowCaseIfNotJSCell(unsigned virtualRegisterIndex);
-        void emitJumpSlowCaseIfNotJSCell(unsigned virtualRegisterIndex, RegisterID tag);
-        void linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator&, unsigned virtualRegisterIndex);
+        void emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex);
+        void emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex, RegisterID tag);
 
         void compileGetByIdHotPath();
         void compileGetByIdSlowCase(int resultVReg, int baseVReg, Identifier* ident, Vector<SlowCaseEntry>::iterator& iter, bool isMethodCheck = false);
@@ -984,7 +983,7 @@
             ASSERT(!iter->from.isSet());
             ++iter;
         }
-        void linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator&, int vReg);
+        void linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator&, int virtualRegisterIndex);
 
         Jump checkStructure(RegisterID reg, Structure* structure);
 
@@ -1065,7 +1064,7 @@
 #if USE(JSVALUE32_64)
         unsigned m_jumpTargetIndex;
         unsigned m_mappedBytecodeOffset;
-        unsigned m_mappedVirtualRegisterIndex;
+        int m_mappedVirtualRegisterIndex;
         RegisterID m_mappedTag;
         RegisterID m_mappedPayload;
 #else

Modified: trunk/Source/_javascript_Core/jit/JITInlineMethods.h (100170 => 100171)


--- trunk/Source/_javascript_Core/jit/JITInlineMethods.h	2011-11-14 19:39:30 UTC (rev 100170)
+++ trunk/Source/_javascript_Core/jit/JITInlineMethods.h	2011-11-14 19:44:32 UTC (rev 100171)
@@ -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));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to