Bug 952650 (part 7) - Remove JSVAL_IS_BOOLEAN. r=njn.
authorRodrigo Rodriguez Jr. <rrodrigue96@hotmail.com>
Sun, 27 Apr 2014 19:44:05 -0700
changeset 180915 061b0af0e45b3a7e74def211dcbc7f517b170209
parent 180914 47e4ad6fbe3cc59e395a032c8cab0b1da4cccd8e
child 180916 bdc9683e85bab7229e24e7345b8bfbd691828c0a
push id26686
push usercbook@mozilla.com
push dateWed, 30 Apr 2014 13:00:57 +0000
treeherdermozilla-central@c8b374bf936b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs952650
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 952650 (part 7) - Remove JSVAL_IS_BOOLEAN. r=njn.
dom/plugins/base/nsJSNPRuntime.cpp
dom/system/gonk/AutoMounterSetting.cpp
js/jsd/jsd_val.cpp
js/jsd/jsd_xpc.cpp
js/public/Value.h
js/src/ctypes/CTypes.cpp
js/src/tests/js1_5/Regress/regress-407024.js
js/src/tests/js1_5/Regress/regress-452573-01.js
js/src/tests/js1_5/Regress/regress-453747.js
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -381,17 +381,17 @@ JSValToNPVariant(NPP npp, JSContext *cx,
 {
   NS_ASSERTION(npp, "Must have an NPP to wrap a jsval!");
 
   if (JSVAL_IS_PRIMITIVE(val)) {
     if (val == JSVAL_VOID) {
       VOID_TO_NPVARIANT(*variant);
     } else if (val.isNull()) {
       NULL_TO_NPVARIANT(*variant);
-    } else if (JSVAL_IS_BOOLEAN(val)) {
+    } else if (val.isBoolean()) {
       BOOLEAN_TO_NPVARIANT(val.toBoolean(), *variant);
     } else if (JSVAL_IS_INT(val)) {
       INT32_TO_NPVARIANT(JSVAL_TO_INT(val), *variant);
     } else if (val.isDouble()) {
       double d = val.toDouble();
       int i;
       if (JS_DoubleIsInt32(d, &i)) {
         INT32_TO_NPVARIANT(i, *variant);
--- a/dom/system/gonk/AutoMounterSetting.cpp
+++ b/dom/system/gonk/AutoMounterSetting.cpp
@@ -64,17 +64,17 @@ class CheckVolumeSettingsCallback MOZ_FI
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
 
   CheckVolumeSettingsCallback(const nsACString& aVolumeName)
   : mVolumeName(aVolumeName) {}
 
   NS_IMETHOD Handle(const nsAString& aName, JS::Handle<JS::Value> aResult)
   {
-    if (JSVAL_IS_BOOLEAN(aResult)) {
+    if (aResult.isBoolean()) {
       bool isSharingEnabled = aResult.toBoolean();
       SetAutoMounterSharingMode(mVolumeName, isSharingEnabled);
     }
     return NS_OK;
   }
 
   NS_IMETHOD HandleError(const nsAString& aName)
   {
--- a/js/jsd/jsd_val.cpp
+++ b/js/jsd/jsd_val.cpp
@@ -85,17 +85,17 @@ bool
 jsd_IsValueString(JSDContext* jsdc, JSDValue* jsdval)
 {
     return jsdval->val.isString();
 }
 
 bool
 jsd_IsValueBoolean(JSDContext* jsdc, JSDValue* jsdval)
 {
-    return JSVAL_IS_BOOLEAN(jsdval->val);
+    return jsdval->val.isBoolean();
 }
 
 bool
 jsd_IsValueNull(JSDContext* jsdc, JSDValue* jsdval)
 {
     return jsdval->val.isNull();
 }
 
@@ -140,17 +140,17 @@ jsd_IsValueNative(JSDContext* jsdc, JSDV
 }
 
 /***************************************************************************/
 
 bool
 jsd_GetValueBoolean(JSDContext* jsdc, JSDValue* jsdval)
 {
     jsval val = jsdval->val;
-    if(!JSVAL_IS_BOOLEAN(val))
+    if(!val.isBoolean())
         return false;
     return val.toBoolean();
 }
 
 int32_t
 jsd_GetValueInt(JSDContext* jsdc, JSDValue* jsdval)
 {
     jsval val = jsdval->val;
--- a/js/jsd/jsd_xpc.cpp
+++ b/js/jsd/jsd_xpc.cpp
@@ -2155,17 +2155,17 @@ jsdValue::GetIsPrimitive (bool *_rval)
 NS_IMETHODIMP
 jsdValue::GetJsType (uint32_t *_rval)
 {
     ASSERT_VALID_EPHEMERAL;
     JS::RootedValue val(JSD_GetJSRuntime(mCx), JSD_GetValueWrappedJSVal (mCx, mValue));
 
     if (val.isNull())
         *_rval = TYPE_NULL;
-    else if (JSVAL_IS_BOOLEAN(val))
+    else if (val.isBoolean())
         *_rval = TYPE_BOOLEAN;
     else if (val.isDouble())
         *_rval = TYPE_DOUBLE;
     else if (JSVAL_IS_INT(val))
         *_rval = TYPE_INT;
     else if (val.isString())
         *_rval = TYPE_STRING;
     else if (val.isUndefined())
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -1900,22 +1900,16 @@ JSVAL_TO_OBJECT(jsval v)
 static inline jsval
 OBJECT_TO_JSVAL(JSObject *obj)
 {
     if (obj)
         return IMPL_TO_JSVAL(OBJECT_TO_JSVAL_IMPL(obj));
     return IMPL_TO_JSVAL(BUILD_JSVAL(JSVAL_TAG_NULL, 0));
 }
 
-static inline bool
-JSVAL_IS_BOOLEAN(jsval v)
-{
-    return JSVAL_IS_BOOLEAN_IMPL(JSVAL_TO_IMPL(v));
-}
-
 static inline jsval
 BOOLEAN_TO_JSVAL(bool b)
 {
     return IMPL_TO_JSVAL(BOOLEAN_TO_JSVAL_IMPL(b));
 }
 
 static inline bool
 JSVAL_IS_PRIMITIVE(jsval v)
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -1570,17 +1570,17 @@ static MOZ_ALWAYS_INLINE bool IsNegative
   return IsNegativeImpl<Type, NumericLimits<Type>::is_signed>::Test(i);
 }
 
 // Implicitly convert val to bool, allowing bool, int, and double
 // arguments numerically equal to 0 or 1.
 static bool
 jsvalToBool(JSContext* cx, jsval val, bool* result)
 {
-  if (JSVAL_IS_BOOLEAN(val)) {
+  if (val.isBoolean()) {
     *result = val.toBoolean();
     return true;
   }
   if (JSVAL_IS_INT(val)) {
     int32_t i = JSVAL_TO_INT(val);
     *result = i != 0;
     return i == 0 || i == 1;
   }
@@ -1668,17 +1668,17 @@ jsvalToInteger(JSContext* cx, jsval val,
       if (!CDataFinalizer::GetValue(cx, obj, innerData.address())) {
         return false; // Nothing to convert
       }
       return jsvalToInteger(cx, innerData, result);
     }
 
     return false;
   }
-  if (JSVAL_IS_BOOLEAN(val)) {
+  if (val.isBoolean()) {
     // Implicitly promote boolean values to 0 or 1, like C.
     *result = val.toBoolean();
     JS_ASSERT(*result == 0 || *result == 1);
     return true;
   }
   // Don't silently convert null to an integer. It's probably a mistake.
   return false;
 }
--- a/js/src/tests/js1_5/Regress/regress-407024.js
+++ b/js/src/tests/js1_5/Regress/regress-407024.js
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //-----------------------------------------------------------------------------
 var BUGNUMBER = 407024;
-var summary = 'Do not assert JSVAL_IS_NUMBER(pn3->pn_val) || pn3->pn_val.isString() || JSVAL_IS_BOOLEAN(pn3->pn_val)';
+var summary = 'Do not assert JSVAL_IS_NUMBER(pn3->pn_val) || pn3->pn_val.isString() || pn3->pn_val.isBoolean()';
 var actual = 'No Crash';
 var expect = 'No Crash';
 
 printBugNumber(BUGNUMBER);
 printStatus (summary);
 
 eval("function f(x) { switch (x) { case Array: return 1; }}");
 var result = f(Array);
--- a/js/src/tests/js1_5/Regress/regress-452573-01.js
+++ b/js/src/tests/js1_5/Regress/regress-452573-01.js
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //-----------------------------------------------------------------------------
 var BUGNUMBER = 452573;
-var summary = 'Do not assert with JIT: boxed.isUndefined() || JSVAL_IS_BOOLEAN(boxed)';
+var summary = 'Do not assert with JIT: boxed.isUndefined() || boxed.isBoolean()';
 var actual = 'No Crash';
 var expect = 'No Crash';
 
 //-----------------------------------------------------------------------------
 test();
 //-----------------------------------------------------------------------------
 
 function test()
--- a/js/src/tests/js1_5/Regress/regress-453747.js
+++ b/js/src/tests/js1_5/Regress/regress-453747.js
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //-----------------------------------------------------------------------------
 var BUGNUMBER = 453747;
-var summary = 'Do not assert with JIT: boxed.isUndefined() || JSVAL_IS_BOOLEAN(boxed)';
+var summary = 'Do not assert with JIT: boxed.isUndefined() || boxed.isBoolean()';
 var actual = 'No Crash';
 var expect = 'No Crash';
 
 //-----------------------------------------------------------------------------
 test();
 //-----------------------------------------------------------------------------
 
 function test()