Title: [189351] trunk/Source/_javascript_Core
Revision
189351
Author
[email protected]
Date
2015-09-04 09:39:31 -0700 (Fri, 04 Sep 2015)

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

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (189350 => 189351)


--- trunk/Source/_javascript_Core/ChangeLog	2015-09-04 16:32:34 UTC (rev 189350)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-09-04 16:39:31 UTC (rev 189351)
@@ -1,3 +1,20 @@
+2015-08-24  Basile Clement  <[email protected]>
+
+        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):
+
 2015-09-04  Basile Clement  <[email protected]>
 
         Since r189341, es6.yaml/es6/arrow_functions_no_prototype_property.js is expected to succeed

Modified: trunk/Source/_javascript_Core/jit/GPRInfo.h (189350 => 189351)


--- trunk/Source/_javascript_Core/jit/GPRInfo.h	2015-09-04 16:32:34 UTC (rev 189350)
+++ trunk/Source/_javascript_Core/jit/GPRInfo.h	2015-09-04 16:39:31 UTC (rev 189351)
@@ -65,6 +65,10 @@
     }
     
     bool operator!() const { return m_gpr == InvalidGPRReg; }
+    explicit operator bool() const { return m_gpr != InvalidGPRReg; }
+
+    bool operator==(JSValueRegs other) { return m_gpr == other.m_gpr; }
+    bool operator!=(JSValueRegs other) { return !(*this == other); }
     
     GPRReg gpr() const { return m_gpr; }
     GPRReg tagGPR() const { return InvalidGPRReg; }
@@ -110,6 +114,7 @@
     }
     
     bool operator!() const { return m_base == InvalidGPRReg; }
+    explicit operator bool() const { return m_base != InvalidGPRReg; }
     
     bool isAddress() const { return m_offset != notAddress(); }
     
@@ -166,11 +171,19 @@
         return JSValueRegs(InvalidGPRReg, gpr);
     }
     
-    bool operator!() const
+    bool operator!() const { return !static_cast<bool>(*this); }
+    explicit operator bool() const
     {
-        return static_cast<GPRReg>(m_tagGPR) == InvalidGPRReg
-            && static_cast<GPRReg>(m_payloadGPR) == InvalidGPRReg;
+        return static_cast<GPRReg>(m_tagGPR) != InvalidGPRReg
+            || static_cast<GPRReg>(m_payloadGPR) != InvalidGPRReg;
     }
+
+    bool operator==(JSValueRegs other) const
+    {
+        return m_tagGPR == other.m_tagGPR
+            && m_payloadGPR == other.m_payloadGPR;
+    }
+    bool operator!=(JSValueRegs other) const { return !(*this == other); }
     
     GPRReg tagGPR() const { return static_cast<GPRReg>(m_tagGPR); }
     GPRReg payloadGPR() const { return static_cast<GPRReg>(m_payloadGPR); }
@@ -238,11 +251,12 @@
         result.m_tagType = static_cast<int8_t>(JSValue::CellTag);
         return result;
     }
-    
-    bool operator!() const
+
+    bool operator!() const { return !static_cast<bool>(*this); }
+    explicit operator bool() const
     {
-        return static_cast<GPRReg>(m_baseOrTag) == InvalidGPRReg
-            && static_cast<GPRReg>(m_payload) == InvalidGPRReg;
+        return static_cast<GPRReg>(m_baseOrTag) != InvalidGPRReg
+            || static_cast<GPRReg>(m_payload) != InvalidGPRReg;
     }
     
     bool isAddress() const

Modified: trunk/Source/_javascript_Core/jit/Reg.h (189350 => 189351)


--- trunk/Source/_javascript_Core/jit/Reg.h	2015-09-04 16:32:34 UTC (rev 189350)
+++ trunk/Source/_javascript_Core/jit/Reg.h	2015-09-04 16:39:31 UTC (rev 189351)
@@ -101,6 +101,7 @@
     
     bool isSet() const { return m_index != invalid(); }
     bool operator!() const { return !isSet(); }
+    explicit operator bool() const { return isSet(); }
     
     bool isGPR() const
     {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to