⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 100171 in webkit


Ignore:
Timestamp:
Nov 14, 2011, 11:44:32 AM (15 years ago)
Author:
ggaren@apple.com
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):

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r100168 r100171  
     12011-11-14  Geoffrey Garen  <ggaren@apple.com>
     2
     3        32-bit Build fix: declare virtual register indices to be int rather than
     4        unsigned, since they can be positive or negative.
     5       
     6        For better clarity, explicitly use ReturnPC instead of -1 as the "invalid"
     7        state, since we'll never load and operate on the ReturnPC as a JS value.
     8
     9        * jit/JIT.cpp:
     10        (JSC::JIT::JIT):
     11        * jit/JIT.h:
     12        * jit/JITInlineMethods.h:
     13        (JSC::JIT::emitLoadTag):
     14        (JSC::JIT::emitLoadPayload):
     15        (JSC::JIT::emitLoad):
     16        (JSC::JIT::emitLoad2):
     17        (JSC::JIT::emitLoadDouble):
     18        (JSC::JIT::emitLoadInt32ToDouble):
     19        (JSC::JIT::emitStore):
     20        (JSC::JIT::emitStoreInt32):
     21        (JSC::JIT::emitStoreAndMapInt32):
     22        (JSC::JIT::emitStoreCell):
     23        (JSC::JIT::emitStoreBool):
     24        (JSC::JIT::emitStoreDouble):
     25        (JSC::JIT::map):
     26        (JSC::JIT::unmap):
     27        (JSC::JIT::isMapped):
     28        (JSC::JIT::getMappedPayload):
     29        (JSC::JIT::getMappedTag):
     30        (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
     31
    1322011-11-14  Michael Saboff  <msaboff@apple.com>
    233
  • trunk/Source/JavaScriptCore/jit/JIT.cpp

    r100165 r100171  
    7979    , m_jumpTargetIndex(0)
    8080    , m_mappedBytecodeOffset((unsigned)-1)
    81     , m_mappedVirtualRegisterIndex((unsigned)-1)
     81    , m_mappedVirtualRegisterIndex(RegisterFile::ReturnPC)
    8282    , m_mappedTag((RegisterID)-1)
    8383    , m_mappedPayload((RegisterID)-1)
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r100165 r100171  
    313313        bool isOperandConstantImmediateDouble(unsigned src);
    314314       
    315         void emitLoadDouble(unsigned index, FPRegisterID value);
    316         void emitLoadInt32ToDouble(unsigned index, FPRegisterID value);
     315        void emitLoadDouble(int index, FPRegisterID value);
     316        void emitLoadInt32ToDouble(int index, FPRegisterID value);
    317317        Jump emitJumpIfNotObject(RegisterID structureReg);
    318318        Jump emitJumpIfNotType(RegisterID baseReg, RegisterID scratchReg, JSType);
     
    342342        bool getOperandConstantImmediateInt(unsigned op1, unsigned op2, unsigned& op, int32_t& constant);
    343343
    344         void emitLoadTag(unsigned index, RegisterID tag);
    345         void emitLoadPayload(unsigned index, RegisterID payload);
     344        void emitLoadTag(int index, RegisterID tag);
     345        void emitLoadPayload(int index, RegisterID payload);
    346346
    347347        void emitLoad(const JSValue& v, RegisterID tag, RegisterID payload);
    348         void emitLoad(unsigned index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
    349         void emitLoad2(unsigned index1, RegisterID tag1, RegisterID payload1, unsigned index2, RegisterID tag2, RegisterID payload2);
    350 
    351         void emitStore(unsigned index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
    352         void emitStore(unsigned index, const JSValue constant, RegisterID base = callFrameRegister);
    353         void emitStoreInt32(unsigned index, RegisterID payload, bool indexIsInt32 = false);
    354         void emitStoreInt32(unsigned index, TrustedImm32 payload, bool indexIsInt32 = false);
    355         void emitStoreAndMapInt32(unsigned index, RegisterID tag, RegisterID payload, bool indexIsInt32, size_t opcodeLength);
    356         void emitStoreCell(unsigned index, RegisterID payload, bool indexIsCell = false);
    357         void emitStoreBool(unsigned index, RegisterID payload, bool indexIsBool = false);
    358         void emitStoreDouble(unsigned index, FPRegisterID value);
     348        void emitLoad(int index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
     349        void emitLoad2(int index1, RegisterID tag1, RegisterID payload1, int index2, RegisterID tag2, RegisterID payload2);
     350
     351        void emitStore(int index, RegisterID tag, RegisterID payload, RegisterID base = callFrameRegister);
     352        void emitStore(int index, const JSValue constant, RegisterID base = callFrameRegister);
     353        void emitStoreInt32(int index, RegisterID payload, bool indexIsInt32 = false);
     354        void emitStoreInt32(int index, TrustedImm32 payload, bool indexIsInt32 = false);
     355        void emitStoreAndMapInt32(int index, RegisterID tag, RegisterID payload, bool indexIsInt32, size_t opcodeLength);
     356        void emitStoreCell(int index, RegisterID payload, bool indexIsCell = false);
     357        void emitStoreBool(int index, RegisterID payload, bool indexIsBool = false);
     358        void emitStoreDouble(int index, FPRegisterID value);
    359359
    360360        bool isLabeled(unsigned bytecodeOffset);
    361         void map(unsigned bytecodeOffset, unsigned virtualRegisterIndex, RegisterID tag, RegisterID payload);
     361        void map(unsigned bytecodeOffset, int virtualRegisterIndex, RegisterID tag, RegisterID payload);
    362362        void unmap(RegisterID);
    363363        void unmap();
    364         bool isMapped(unsigned virtualRegisterIndex);
    365         bool getMappedPayload(unsigned virtualRegisterIndex, RegisterID& payload);
    366         bool getMappedTag(unsigned virtualRegisterIndex, RegisterID& tag);
    367 
    368         void emitJumpSlowCaseIfNotJSCell(unsigned virtualRegisterIndex);
    369         void emitJumpSlowCaseIfNotJSCell(unsigned virtualRegisterIndex, RegisterID tag);
    370         void linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator&, unsigned virtualRegisterIndex);
     364        bool isMapped(int virtualRegisterIndex);
     365        bool getMappedPayload(int virtualRegisterIndex, RegisterID& payload);
     366        bool getMappedTag(int virtualRegisterIndex, RegisterID& tag);
     367
     368        void emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex);
     369        void emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex, RegisterID tag);
    371370
    372371        void compileGetByIdHotPath();
     
    985984            ++iter;
    986985        }
    987         void linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator&, int vReg);
     986        void linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator&, int virtualRegisterIndex);
    988987
    989988        Jump checkStructure(RegisterID reg, Structure* structure);
     
    10661065        unsigned m_jumpTargetIndex;
    10671066        unsigned m_mappedBytecodeOffset;
    1068         unsigned m_mappedVirtualRegisterIndex;
     1067        int m_mappedVirtualRegisterIndex;
    10691068        RegisterID m_mappedTag;
    10701069        RegisterID m_mappedPayload;
  • trunk/Source/JavaScriptCore/jit/JITInlineMethods.h

    r99888 r100171  
    500500#if USE(JSVALUE32_64)
    501501
    502 inline void JIT::emitLoadTag(unsigned index, RegisterID tag)
     502inline void JIT::emitLoadTag(int index, RegisterID tag)
    503503{
    504504    RegisterID mappedTag;
     
    519519}
    520520
    521 inline void JIT::emitLoadPayload(unsigned index, RegisterID payload)
     521inline void JIT::emitLoadPayload(int index, RegisterID payload)
    522522{
    523523    RegisterID mappedPayload;
     
    544544}
    545545
    546 inline void JIT::emitLoad(unsigned index, RegisterID tag, RegisterID payload, RegisterID base)
     546inline void JIT::emitLoad(int index, RegisterID tag, RegisterID payload, RegisterID base)
    547547{
    548548    ASSERT(tag != payload);
     
    565565}
    566566
    567 inline void JIT::emitLoad2(unsigned index1, RegisterID tag1, RegisterID payload1, unsigned index2, RegisterID tag2, RegisterID payload2)
     567inline void JIT::emitLoad2(int index1, RegisterID tag1, RegisterID payload1, int index2, RegisterID tag2, RegisterID payload2)
    568568{
    569569    if (isMapped(index1)) {
     
    576576}
    577577
    578 inline void JIT::emitLoadDouble(unsigned index, FPRegisterID value)
     578inline void JIT::emitLoadDouble(int index, FPRegisterID value)
    579579{
    580580    if (m_codeBlock->isConstantRegisterIndex(index)) {
     
    585585}
    586586
    587 inline void JIT::emitLoadInt32ToDouble(unsigned index, FPRegisterID value)
     587inline void JIT::emitLoadInt32ToDouble(int index, FPRegisterID value)
    588588{
    589589    if (m_codeBlock->isConstantRegisterIndex(index)) {
     
    595595}
    596596
    597 inline void JIT::emitStore(unsigned index, RegisterID tag, RegisterID payload, RegisterID base)
     597inline void JIT::emitStore(int index, RegisterID tag, RegisterID payload, RegisterID base)
    598598{
    599599    store32(payload, payloadFor(index, base));
     
    601601}
    602602
    603 inline void JIT::emitStoreInt32(unsigned index, RegisterID payload, bool indexIsInt32)
     603inline void JIT::emitStoreInt32(int index, RegisterID payload, bool indexIsInt32)
    604604{
    605605    store32(payload, payloadFor(index, callFrameRegister));
     
    608608}
    609609
    610 inline void JIT::emitStoreAndMapInt32(unsigned index, RegisterID tag, RegisterID payload, bool indexIsInt32, size_t opcodeLength)
     610inline void JIT::emitStoreAndMapInt32(int index, RegisterID tag, RegisterID payload, bool indexIsInt32, size_t opcodeLength)
    611611{
    612612    emitStoreInt32(index, payload, indexIsInt32);
     
    614614}
    615615
    616 inline void JIT::emitStoreInt32(unsigned index, TrustedImm32 payload, bool indexIsInt32)
     616inline void JIT::emitStoreInt32(int index, TrustedImm32 payload, bool indexIsInt32)
    617617{
    618618    store32(payload, payloadFor(index, callFrameRegister));
     
    621621}
    622622
    623 inline void JIT::emitStoreCell(unsigned index, RegisterID payload, bool indexIsCell)
     623inline void JIT::emitStoreCell(int index, RegisterID payload, bool indexIsCell)
    624624{
    625625    store32(payload, payloadFor(index, callFrameRegister));
     
    628628}
    629629
    630 inline void JIT::emitStoreBool(unsigned index, RegisterID payload, bool indexIsBool)
     630inline void JIT::emitStoreBool(int index, RegisterID payload, bool indexIsBool)
    631631{
    632632    store32(payload, payloadFor(index, callFrameRegister));
     
    635635}
    636636
    637 inline void JIT::emitStoreDouble(unsigned index, FPRegisterID value)
     637inline void JIT::emitStoreDouble(int index, FPRegisterID value)
    638638{
    639639    storeDouble(value, addressFor(index));
    640640}
    641641
    642 inline void JIT::emitStore(unsigned index, const JSValue constant, RegisterID base)
     642inline void JIT::emitStore(int index, const JSValue constant, RegisterID base)
    643643{
    644644    store32(Imm32(constant.payload()), payloadFor(index, base));
     
    663663}
    664664
    665 inline void JIT::map(unsigned bytecodeOffset, unsigned virtualRegisterIndex, RegisterID tag, RegisterID payload)
     665inline void JIT::map(unsigned bytecodeOffset, int virtualRegisterIndex, RegisterID tag, RegisterID payload)
    666666{
    667667    if (isLabeled(bytecodeOffset))
     
    685685{
    686686    m_mappedBytecodeOffset = (unsigned)-1;
    687     m_mappedVirtualRegisterIndex = (unsigned)-1;
     687    m_mappedVirtualRegisterIndex = RegisterFile::ReturnPC;
    688688    m_mappedTag = (RegisterID)-1;
    689689    m_mappedPayload = (RegisterID)-1;
    690690}
    691691
    692 inline bool JIT::isMapped(unsigned virtualRegisterIndex)
     692inline bool JIT::isMapped(int virtualRegisterIndex)
    693693{
    694694    if (m_mappedBytecodeOffset != m_bytecodeOffset)
     
    699699}
    700700
    701 inline bool JIT::getMappedPayload(unsigned virtualRegisterIndex, RegisterID& payload)
     701inline bool JIT::getMappedPayload(int virtualRegisterIndex, RegisterID& payload)
    702702{
    703703    if (m_mappedBytecodeOffset != m_bytecodeOffset)
     
    711711}
    712712
    713 inline bool JIT::getMappedTag(unsigned virtualRegisterIndex, RegisterID& tag)
     713inline bool JIT::getMappedTag(int virtualRegisterIndex, RegisterID& tag)
    714714{
    715715    if (m_mappedBytecodeOffset != m_bytecodeOffset)
     
    723723}
    724724
    725 inline void JIT::emitJumpSlowCaseIfNotJSCell(unsigned virtualRegisterIndex)
     725inline void JIT::emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex)
    726726{
    727727    if (!m_codeBlock->isKnownNotImmediate(virtualRegisterIndex)) {
     
    733733}
    734734
    735 inline void JIT::emitJumpSlowCaseIfNotJSCell(unsigned virtualRegisterIndex, RegisterID tag)
     735inline void JIT::emitJumpSlowCaseIfNotJSCell(int virtualRegisterIndex, RegisterID tag)
    736736{
    737737    if (!m_codeBlock->isKnownNotImmediate(virtualRegisterIndex)) {
     
    741741            addSlowCase(branch32(NotEqual, tag, TrustedImm32(JSValue::CellTag)));
    742742    }
    743 }
    744 
    745 inline void JIT::linkSlowCaseIfNotJSCell(Vector<SlowCaseEntry>::iterator& iter, unsigned virtualRegisterIndex)
    746 {
    747     if (!m_codeBlock->isKnownNotImmediate(virtualRegisterIndex))
    748         linkSlowCase(iter);
    749743}
    750744
     
    878872#if USE(JSVALUE64)
    879873
    880 inline void JIT::emitLoadDouble(unsigned index, FPRegisterID value)
     874inline void JIT::emitLoadDouble(int index, FPRegisterID value)
    881875{
    882876    if (m_codeBlock->isConstantRegisterIndex(index)) {
     
    887881}
    888882
    889 inline void JIT::emitLoadInt32ToDouble(unsigned index, FPRegisterID value)
     883inline void JIT::emitLoadInt32ToDouble(int index, FPRegisterID value)
    890884{
    891885    if (m_codeBlock->isConstantRegisterIndex(index)) {
Note: See TracChangeset for help on using the changeset viewer.