Ignore:
Timestamp:
Sep 4, 2015, 9:39:31 AM (10 years ago)
Author:
[email protected]
Message:

Add a bunch of operators
https://bugs.webkit.org/show_bug.cgi?id=148337

Reviewed by Saam Barati.

  • jit/GPRInfo.h:

(JSC::JSValueRegs::operator bool):
(JSC::JSValueRegs::operator==):
(JSC::JSValueRegs::operator!=):
(JSC::JSValueSource::operator bool):
(JSC::JSValueRegs::operator!):
(JSC::JSValueSource::operator!):

  • jit/Reg.h:

(JSC::Reg::operator bool):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/GPRInfo.h

    r189293 r189351  
    6666   
    6767    bool operator!() const { return m_gpr == InvalidGPRReg; }
     68    explicit operator bool() const { return m_gpr != InvalidGPRReg; }
     69
     70    bool operator==(JSValueRegs other) { return m_gpr == other.m_gpr; }
     71    bool operator!=(JSValueRegs other) { return !(*this == other); }
    6872   
    6973    GPRReg gpr() const { return m_gpr; }
     
    111115   
    112116    bool operator!() const { return m_base == InvalidGPRReg; }
     117    explicit operator bool() const { return m_base != InvalidGPRReg; }
    113118   
    114119    bool isAddress() const { return m_offset != notAddress(); }
     
    167172    }
    168173   
    169     bool operator!() const
    170     {
    171         return static_cast<GPRReg>(m_tagGPR) == InvalidGPRReg
    172             && static_cast<GPRReg>(m_payloadGPR) == InvalidGPRReg;
    173     }
     174    bool operator!() const { return !static_cast<bool>(*this); }
     175    explicit operator bool() const
     176    {
     177        return static_cast<GPRReg>(m_tagGPR) != InvalidGPRReg
     178            || static_cast<GPRReg>(m_payloadGPR) != InvalidGPRReg;
     179    }
     180
     181    bool operator==(JSValueRegs other) const
     182    {
     183        return m_tagGPR == other.m_tagGPR
     184            && m_payloadGPR == other.m_payloadGPR;
     185    }
     186    bool operator!=(JSValueRegs other) const { return !(*this == other); }
    174187   
    175188    GPRReg tagGPR() const { return static_cast<GPRReg>(m_tagGPR); }
     
    239252        return result;
    240253    }
    241    
    242     bool operator!() const
    243     {
    244         return static_cast<GPRReg>(m_baseOrTag) == InvalidGPRReg
    245             && static_cast<GPRReg>(m_payload) == InvalidGPRReg;
     254
     255    bool operator!() const { return !static_cast<bool>(*this); }
     256    explicit operator bool() const
     257    {
     258        return static_cast<GPRReg>(m_baseOrTag) != InvalidGPRReg
     259            || static_cast<GPRReg>(m_payload) != InvalidGPRReg;
    246260    }
    247261   
Note: See TracChangeset for help on using the changeset viewer.