Backed out changesets ad58c270ce87 and 849151330d60 (bug 1177892) for B2G bustage.
authorRyan VanderMeulen <ryanvm@gmail.com>
Tue, 30 Jun 2015 15:48:11 -0400
changeset 250768 0fe58c22707232406df9ecf33cc30c8279c881ec
parent 250767 049144705ae2aa4239637383717a15874ea86d28
child 250769 da4e8214484b7465cb66c6bfb7045d2ee1f29a1c
push id28968
push userkwierso@gmail.com
push dateTue, 30 Jun 2015 23:40:44 +0000
treeherdermozilla-central@e5ef71b73fec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1177892
milestone42.0a1
backs outad58c270ce872251841ee75713a4d239169cc9df
849151330d603d6e1c73585722ea446e334aa5e4
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
Backed out changesets ad58c270ce87 and 849151330d60 (bug 1177892) for B2G bustage. CLOSED TREE
dom/base/EventSource.cpp
dom/base/WebSocket.cpp
dom/base/nsDOMDataChannel.cpp
dom/base/nsJSEnvironment.cpp
dom/bindings/BindingUtils.h
dom/mobilemessage/MobileMessageCallback.cpp
dom/plugins/base/nsJSNPRuntime.cpp
dom/system/OSFileConstants.cpp
dom/workers/XMLHttpRequest.cpp
dom/xbl/nsXBLBinding.cpp
js/ipc/JavaScriptShared.cpp
js/public/Value.h
js/src/ctypes/CTypes.cpp
js/src/ctypes/Library.cpp
js/src/gdb/tests/test-Root.cpp
js/src/jsapi-tests/testParseJSON.cpp
js/src/jsapi.cpp
js/src/shell/js.cpp
js/xpconnect/src/XPCJSRuntime.cpp
js/xpconnect/src/XPCLocale.cpp
js/xpconnect/src/XPCShellImpl.cpp
js/xpconnect/src/XPCWrappedNativeJSOps.cpp
js/xpconnect/wrappers/XrayWrapper.cpp
storage/mozStorageStatementJSHelper.cpp
storage/mozStorageStatementRow.cpp
--- a/dom/base/EventSource.cpp
+++ b/dom/base/EventSource.cpp
@@ -1266,17 +1266,17 @@ EventSource::DispatchAllMessageEvents()
     JS::Rooted<JS::Value> jsData(cx);
     {
       JSString* jsString;
       jsString = JS_NewUCStringCopyN(cx,
                                      message->mData.get(),
                                      message->mData.Length());
       NS_ENSURE_TRUE_VOID(jsString);
 
-      jsData.setString(jsString);
+      jsData = STRING_TO_JSVAL(jsString);
     }
 
     // create an event that uses the MessageEvent interface,
     // which does not bubble, is not cancelable, and has no default action
 
     nsCOMPtr<nsIDOMEvent> event;
     rv = NS_NewDOMMessageEvent(getter_AddRefs(event), this, nullptr, nullptr);
     if (NS_FAILED(rv)) {
--- a/dom/base/WebSocket.cpp
+++ b/dom/base/WebSocket.cpp
@@ -1771,17 +1771,17 @@ WebSocket::CreateAndDispatchMessageEvent
     }
   } else {
     // JS string
     NS_ConvertUTF8toUTF16 utf16Data(aData);
     JSString* jsString;
     jsString = JS_NewUCStringCopyN(aCx, utf16Data.get(), utf16Data.Length());
     NS_ENSURE_TRUE(jsString, NS_ERROR_FAILURE);
 
-    jsData.setString(jsString);
+    jsData = STRING_TO_JSVAL(jsString);
   }
 
   // create an event that uses the MessageEvent interface,
   // which does not bubble, is not cancelable, and has no default action
 
   nsCOMPtr<nsIDOMEvent> event;
   rv = NS_NewDOMMessageEvent(getter_AddRefs(event), this, nullptr, nullptr);
   NS_ENSURE_SUCCESS(rv, rv);
--- a/dom/base/nsDOMDataChannel.cpp
+++ b/dom/base/nsDOMDataChannel.cpp
@@ -394,17 +394,17 @@ nsDOMDataChannel::DoOnMessageAvailable(c
       NS_RUNTIMEABORT("Unknown binary type!");
       return NS_ERROR_UNEXPECTED;
     }
   } else {
     NS_ConvertUTF8toUTF16 utf16data(aData);
     JSString* jsString = JS_NewUCStringCopyN(cx, utf16data.get(), utf16data.Length());
     NS_ENSURE_TRUE(jsString, NS_ERROR_FAILURE);
 
-    jsData.setString(jsString);
+    jsData = STRING_TO_JSVAL(jsString);
   }
 
   nsCOMPtr<nsIDOMEvent> event;
   rv = NS_NewDOMMessageEvent(getter_AddRefs(event), this, nullptr, nullptr);
   NS_ENSURE_SUCCESS(rv,rv);
 
   nsCOMPtr<nsIDOMMessageEvent> messageEvent = do_QueryInterface(event);
   rv = messageEvent->InitMessageEvent(NS_LITERAL_STRING("message"),
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -926,17 +926,17 @@ nsJSContext::AddSupportsPrimitiveTojsval
       nsAutoCString data;
 
       p->GetData(data);
 
 
       JSString *str = ::JS_NewStringCopyN(cx, data.get(), data.Length());
       NS_ENSURE_TRUE(str, NS_ERROR_OUT_OF_MEMORY);
 
-      aArgv->setString(str);
+      *aArgv = STRING_TO_JSVAL(str);
 
       break;
     }
     case nsISupportsPrimitive::TYPE_STRING : {
       nsCOMPtr<nsISupportsString> p(do_QueryInterface(argPrimitive));
       NS_ENSURE_TRUE(p, NS_ERROR_UNEXPECTED);
 
       nsAutoString data;
@@ -944,28 +944,28 @@ nsJSContext::AddSupportsPrimitiveTojsval
       p->GetData(data);
 
       // cast is probably safe since wchar_t and char16_t are expected
       // to be equivalent; both unsigned 16-bit entities
       JSString *str =
         ::JS_NewUCStringCopyN(cx, data.get(), data.Length());
       NS_ENSURE_TRUE(str, NS_ERROR_OUT_OF_MEMORY);
 
-      aArgv->setString(str);
+      *aArgv = STRING_TO_JSVAL(str);
       break;
     }
     case nsISupportsPrimitive::TYPE_PRBOOL : {
       nsCOMPtr<nsISupportsPRBool> p(do_QueryInterface(argPrimitive));
       NS_ENSURE_TRUE(p, NS_ERROR_UNEXPECTED);
 
       bool data;
 
       p->GetData(&data);
 
-      aArgv->setBoolean(data);
+      *aArgv = BOOLEAN_TO_JSVAL(data);
 
       break;
     }
     case nsISupportsPrimitive::TYPE_PRUINT8 : {
       nsCOMPtr<nsISupportsPRUint8> p(do_QueryInterface(argPrimitive));
       NS_ENSURE_TRUE(p, NS_ERROR_UNEXPECTED);
 
       uint8_t data;
@@ -1006,17 +1006,17 @@ nsJSContext::AddSupportsPrimitiveTojsval
 
       char data;
 
       p->GetData(&data);
 
       JSString *str = ::JS_NewStringCopyN(cx, &data, 1);
       NS_ENSURE_TRUE(str, NS_ERROR_OUT_OF_MEMORY);
 
-      aArgv->setString(str);
+      *aArgv = STRING_TO_JSVAL(str);
 
       break;
     }
     case nsISupportsPrimitive::TYPE_PRINT16 : {
       nsCOMPtr<nsISupportsPRInt16> p(do_QueryInterface(argPrimitive));
       NS_ENSURE_TRUE(p, NS_ERROR_UNEXPECTED);
 
       int16_t data;
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -3023,17 +3023,17 @@ CreateGlobal(JSContext* aCx, T* aNative,
   if (!aGlobal) {
     NS_WARNING("Failed to create global");
     return nullptr;
   }
 
   JSAutoCompartment ac(aCx, aGlobal);
 
   {
-    js::SetReservedSlot(aGlobal, DOM_OBJECT_SLOT, JS::PrivateValue(aNative));
+    js::SetReservedSlot(aGlobal, DOM_OBJECT_SLOT, PRIVATE_TO_JSVAL(aNative));
     NS_ADDREF(aNative);
 
     aCache->SetWrapper(aGlobal);
 
     dom::AllocateProtoAndIfaceCache(aGlobal,
                                     CreateGlobalOptions<T>::ProtoAndIfaceCacheKind);
 
     if (!CreateGlobalOptions<T>::PostCreateGlobal(aCx, aGlobal)) {
--- a/dom/mobilemessage/MobileMessageCallback.cpp
+++ b/dom/mobilemessage/MobileMessageCallback.cpp
@@ -285,17 +285,17 @@ MobileMessageCallback::NotifyGetSmscAddr
   JSContext* cx = jsapi.cx();
   JSString* smsc = JS_NewUCStringCopyN(cx, aSmscAddress.BeginReading(),
                                        aSmscAddress.Length());
 
   if (!smsc) {
     return NotifyError(nsIMobileMessageCallback::INTERNAL_ERROR);
   }
 
-  JS::Rooted<JS::Value> val(cx, JS::StringValue(smsc));
+  JS::Rooted<JS::Value> val(cx, STRING_TO_JSVAL(smsc));
   return NotifySuccess(val);
 }
 
 NS_IMETHODIMP
 MobileMessageCallback::NotifyGetSmscAddressFailed(int32_t aError)
 {
   return NotifyError(aError);
 }
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -484,17 +484,17 @@ static JS::Value
 NPVariantToJSVal(NPP npp, JSContext *cx, const NPVariant *variant)
 {
   switch (variant->type) {
   case NPVariantType_Void :
     return JS::UndefinedValue();
   case NPVariantType_Null :
     return JS::NullValue();
   case NPVariantType_Bool :
-    return JS::BooleanValue(NPVARIANT_TO_BOOLEAN(*variant));
+    return BOOLEAN_TO_JSVAL(NPVARIANT_TO_BOOLEAN(*variant));
   case NPVariantType_Int32 :
     {
       // Don't use INT_TO_JSVAL directly to prevent bugs when dealing
       // with ints larger than what fits in a integer JS::Value.
       return ::JS_NumberValue(NPVARIANT_TO_INT32(*variant));
     }
   case NPVariantType_Double :
     {
@@ -504,17 +504,17 @@ NPVariantToJSVal(NPP npp, JSContext *cx,
     {
       const NPString *s = &NPVARIANT_TO_STRING(*variant);
       NS_ConvertUTF8toUTF16 utf16String(s->UTF8Characters, s->UTF8Length);
 
       JSString *str =
         ::JS_NewUCStringCopyN(cx, utf16String.get(), utf16String.Length());
 
       if (str) {
-        return JS::StringValue(str);
+        return STRING_TO_JSVAL(str);
       }
 
       break;
     }
   case NPVariantType_Object:
     {
       if (npp) {
         JSObject *obj =
--- a/dom/system/OSFileConstants.cpp
+++ b/dom/system/OSFileConstants.cpp
@@ -819,17 +819,17 @@ JSObject *GetOrCreateObjectProperty(JSCo
 bool SetStringProperty(JSContext *cx, JS::Handle<JSObject*> aObject, const char *aProperty,
                        const nsString aValue)
 {
   if (aValue.IsVoid()) {
     return true;
   }
   JSString* strValue = JS_NewUCStringCopyZ(cx, aValue.get());
   NS_ENSURE_TRUE(strValue, false);
-  JS::Rooted<JS::Value> valValue(cx, JS::StringValue(strValue));
+  JS::Rooted<JS::Value> valValue(cx, STRING_TO_JSVAL(strValue));
   return JS_SetProperty(cx, aObject, aProperty, valValue);
 }
 
 /**
  * Define OS-specific constants.
  *
  * This function creates or uses JS object |OS.Constants| to store
  * all its constants.
@@ -886,33 +886,33 @@ bool DefineOSFileConstants(JSContext *cx
     return false;
   }
 
 #if defined(MOZ_WIDGET_GONK)
     JSString* strVersion = JS_NewStringCopyZ(cx, "Gonk");
     if (!strVersion){
       return false;
     }
-    JS::Rooted<JS::Value> valVersion(cx, JS::StringValue(strVersion));
+    JS::Rooted<JS::Value> valVersion(cx, STRING_TO_JSVAL(strVersion));
     if (!JS_SetProperty(cx, objSys, "Name", valVersion)) {
       return false;
   }
 #else
   nsCOMPtr<nsIXULRuntime> runtime = do_GetService(XULRUNTIME_SERVICE_CONTRACTID);
   if (runtime) {
     nsAutoCString os;
     DebugOnly<nsresult> rv = runtime->GetOS(os);
     MOZ_ASSERT(NS_SUCCEEDED(rv));
 
     JSString* strVersion = JS_NewStringCopyZ(cx, os.get());
     if (!strVersion) {
       return false;
     }
 
-    JS::Rooted<JS::Value> valVersion(cx, JS::StringValue(strVersion));
+    JS::Rooted<JS::Value> valVersion(cx, STRING_TO_JSVAL(strVersion));
     if (!JS_SetProperty(cx, objSys, "Name", valVersion)) {
       return false;
     }
   }
 #endif // defined(MOZ_WIDGET_GONK)
 
 #if defined(DEBUG)
   JS::Rooted<JS::Value> valDebug(cx, JS::TrueValue());
--- a/dom/workers/XMLHttpRequest.cpp
+++ b/dom/workers/XMLHttpRequest.cpp
@@ -2452,17 +2452,17 @@ XMLHttpRequest::GetResponse(JSContext* /
                             mStateData.mResponseText.get(),
                             mStateData.mResponseText.Length());
 
       if (!str) {
         aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
         return;
       }
 
-      mStateData.mResponse.setString(str);
+      mStateData.mResponse = STRING_TO_JSVAL(str);
     }
   }
 
   JS::ExposeValueToActiveJS(mStateData.mResponse);
   aRv = mStateData.mResponseResult;
   aResponse.set(mStateData.mResponse);
 }
 
--- a/dom/xbl/nsXBLBinding.cpp
+++ b/dom/xbl/nsXBLBinding.cpp
@@ -1024,17 +1024,17 @@ nsXBLBinding::DoInitJSClass(JSContext *c
     // we can guarantee that in XBLFinalize this will be non-null.
     // Note that we can't just store aProtoBinding in the private and
     // addref/release the nsXBLDocumentInfo through it, because cycle
     // collection doesn't seem to work right if the private is not an
     // nsISupports.
     nsXBLDocumentInfo* docInfo = aProtoBinding->XBLDocumentInfo();
     ::JS_SetPrivate(proto, docInfo);
     NS_ADDREF(docInfo);
-    JS_SetReservedSlot(proto, 0, JS::PrivateValue(aProtoBinding));
+    JS_SetReservedSlot(proto, 0, PRIVATE_TO_JSVAL(aProtoBinding));
 
     // Next, enter the compartment of the property holder, wrap the proto, and
     // stick it on.
     JSAutoCompartment ac3(cx, holder);
     if (!JS_WrapObject(cx, &proto) ||
         !JS_DefineUCProperty(cx, holder, aClassName.get(), -1, proto,
                              JSPROP_READONLY | JSPROP_PERMANENT,
                              JS_STUBGETTER, JS_STUBSETTER))
--- a/js/ipc/JavaScriptShared.cpp
+++ b/js/ipc/JavaScriptShared.cpp
@@ -357,17 +357,17 @@ JavaScriptShared::fromVariant(JSContext*
           return true;
         }
 
         case JSVariant::Tdouble:
           to.set(JS_NumberValue(from.get_double()));
           return true;
 
         case JSVariant::Tbool:
-          to.setBoolean(from.get_bool());
+          to.set(BOOLEAN_TO_JSVAL(from.get_bool()));
           return true;
 
         case JSVariant::TnsString:
         {
           const nsString& old = from.get_nsString();
           JSString* str = JS_NewUCStringCopyN(cx, old.BeginReading(), old.Length());
           if (!str)
               return false;
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -1967,23 +1967,43 @@ static inline JS_VALUE_CONSTEXPR jsval
 UINT_TO_JSVAL(uint32_t i)
 {
     return i <= JSVAL_INT_MAX
            ? INT_TO_JSVAL((int32_t)i)
            : DOUBLE_TO_JSVAL((double)i);
 }
 
 static inline jsval
+STRING_TO_JSVAL(JSString* str)
+{
+    return IMPL_TO_JSVAL(STRING_TO_JSVAL_IMPL(str));
+}
+
+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 jsval
+BOOLEAN_TO_JSVAL(bool b)
+{
+    return IMPL_TO_JSVAL(BOOLEAN_TO_JSVAL_IMPL(b));
+}
+
+/* To be GC-safe, privates are tagged as doubles. */
+
+static inline jsval
+PRIVATE_TO_JSVAL(void* ptr)
+{
+    return IMPL_TO_JSVAL(PRIVATE_PTR_TO_JSVAL_IMPL(ptr));
+}
+
 namespace JS {
 
 extern JS_PUBLIC_DATA(const HandleValue) NullHandleValue;
 extern JS_PUBLIC_DATA(const HandleValue) UndefinedHandleValue;
 extern JS_PUBLIC_DATA(const HandleValue) TrueHandleValue;
 extern JS_PUBLIC_DATA(const HandleValue) FalseHandleValue;
 
 }
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -2005,17 +2005,17 @@ JS_InitCTypesClass(JSContext* cx, Handle
 JS_PUBLIC_API(void)
 JS_SetCTypesCallbacks(JSObject* ctypesObj, const JSCTypesCallbacks* callbacks)
 {
   MOZ_ASSERT(callbacks);
   MOZ_ASSERT(IsCTypesGlobal(ctypesObj));
 
   // Set the callbacks on a reserved slot.
   JS_SetReservedSlot(ctypesObj, SLOT_CALLBACKS,
-                     PrivateValue(const_cast<JSCTypesCallbacks*>(callbacks)));
+                     PRIVATE_TO_JSVAL(const_cast<JSCTypesCallbacks*>(callbacks)));
 }
 
 namespace js {
 
 JS_FRIEND_API(size_t)
 SizeOfDataIfCDataObject(mozilla::MallocSizeOf mallocSizeOf, JSObject* obj)
 {
     if (!CData::IsCData(obj))
@@ -3924,19 +3924,19 @@ CType::Create(JSContext* cx,
   //       specific type instance 't'.
   RootedObject typeObj(cx, JS_NewObjectWithGivenProto(cx, &sCTypeClass, typeProto));
   if (!typeObj)
     return nullptr;
 
   // Set up the reserved slots.
   JS_SetReservedSlot(typeObj, SLOT_TYPECODE, INT_TO_JSVAL(type));
   if (ffiType)
-    JS_SetReservedSlot(typeObj, SLOT_FFITYPE, PrivateValue(ffiType));
+    JS_SetReservedSlot(typeObj, SLOT_FFITYPE, PRIVATE_TO_JSVAL(ffiType));
   if (name)
-    JS_SetReservedSlot(typeObj, SLOT_NAME, StringValue(name));
+    JS_SetReservedSlot(typeObj, SLOT_NAME, STRING_TO_JSVAL(name));
   JS_SetReservedSlot(typeObj, SLOT_SIZE, size);
   JS_SetReservedSlot(typeObj, SLOT_ALIGN, align);
 
   if (dataProto) {
     // Set up the 'prototype' and 'prototype.constructor' properties.
     RootedObject prototype(cx, JS_NewObjectWithGivenProto(cx, &sCDataProtoClass, dataProto));
     if (!prototype)
       return nullptr;
@@ -4269,34 +4269,34 @@ CType::GetFFIType(JSContext* cx, JSObjec
     break;
 
   default:
     MOZ_CRASH("simple types must have an ffi_type");
   }
 
   if (!result)
     return nullptr;
-  JS_SetReservedSlot(obj, SLOT_FFITYPE, PrivateValue(result.get()));
+  JS_SetReservedSlot(obj, SLOT_FFITYPE, PRIVATE_TO_JSVAL(result.get()));
   return result.release();
 }
 
 JSString*
 CType::GetName(JSContext* cx, HandleObject obj)
 {
   MOZ_ASSERT(CType::IsCType(obj));
 
   jsval string = JS_GetReservedSlot(obj, SLOT_NAME);
   if (!string.isUndefined())
     return string.toString();
 
   // Build the type name lazily.
   JSString* name = BuildTypeName(cx, obj);
   if (!name)
     return nullptr;
-  JS_SetReservedSlot(obj, SLOT_NAME, StringValue(name));
+  JS_SetReservedSlot(obj, SLOT_NAME, STRING_TO_JSVAL(name));
   return name;
 }
 
 JSObject*
 CType::GetProtoFromCtor(JSObject* obj, CTypeProtoSlot slot)
 {
   // Get ctypes.{Pointer,Array,Struct}Type.prototype from a reserved slot
   // on the type constructor.
@@ -5631,17 +5631,17 @@ StructType::DefineInternal(JSContext* cx
     structSize = 1;
     structAlign = 1;
   }
 
   RootedValue sizeVal(cx);
   if (!SizeTojsval(cx, structSize, &sizeVal))
     return false;
 
-  JS_SetReservedSlot(typeObj, SLOT_FIELDINFO, PrivateValue(fields.release()));
+  JS_SetReservedSlot(typeObj, SLOT_FIELDINFO, PRIVATE_TO_JSVAL(fields.release()));
 
   JS_SetReservedSlot(typeObj, SLOT_SIZE, sizeVal);
   JS_SetReservedSlot(typeObj, SLOT_ALIGN, INT_TO_JSVAL(structAlign));
   //if (!JS_FreezeObject(cx, prototype)0 // XXX fixme - see bug 541212!
   //  return false;
   JS_SetReservedSlot(typeObj, SLOT_PROTO, OBJECT_TO_JSVAL(prototype));
   return true;
 }
@@ -6292,17 +6292,17 @@ CreateFunctionInfo(JSContext* cx,
 {
   FunctionInfo* fninfo(cx->new_<FunctionInfo>());
   if (!fninfo) {
     JS_ReportOutOfMemory(cx);
     return false;
   }
 
   // Stash the FunctionInfo in a reserved slot.
-  JS_SetReservedSlot(typeObj, SLOT_FNINFO, PrivateValue(fninfo));
+  JS_SetReservedSlot(typeObj, SLOT_FNINFO, PRIVATE_TO_JSVAL(fninfo));
 
   ffi_abi abi;
   if (!GetABI(cx, abiType, &abi)) {
     JS_ReportError(cx, "Invalid ABI specification");
     return false;
   }
   fninfo->mABI = abiType.toObjectOrNull();
 
@@ -6835,17 +6835,17 @@ CClosure::Create(JSContext* cx,
   // Copy the important bits of context into cinfo.
   cinfo->errResult = errResult.release();
   cinfo->closureObj = result;
   cinfo->typeObj = typeObj;
   cinfo->thisObj = thisObj;
   cinfo->jsfnObj = fnObj;
 
   // Stash the ClosureInfo struct on our new object.
-  JS_SetReservedSlot(result, SLOT_CLOSUREINFO, PrivateValue(cinfo));
+  JS_SetReservedSlot(result, SLOT_CLOSUREINFO, PRIVATE_TO_JSVAL(cinfo));
 
   // Create an ffi_closure object and initialize it.
   void* code;
   cinfo->closure =
     static_cast<ffi_closure*>(ffi_closure_alloc(sizeof(ffi_closure), &code));
   if (!cinfo->closure || !code) {
     JS_ReportError(cx, "couldn't create closure - libffi error");
     return nullptr;
@@ -7081,17 +7081,17 @@ CData::Create(JSContext* cx,
   // set the CData's associated type
   JS_SetReservedSlot(dataObj, SLOT_CTYPE, OBJECT_TO_JSVAL(typeObj));
 
   // Stash the referent object, if any, for GC safety.
   if (refObj)
     JS_SetReservedSlot(dataObj, SLOT_REFERENT, OBJECT_TO_JSVAL(refObj));
 
   // Set our ownership flag.
-  JS_SetReservedSlot(dataObj, SLOT_OWNS, BooleanValue(ownResult));
+  JS_SetReservedSlot(dataObj, SLOT_OWNS, BOOLEAN_TO_JSVAL(ownResult));
 
   // attach the buffer. since it might not be 2-byte aligned, we need to
   // allocate an aligned space for it and store it there. :(
   char** buffer = cx->new_<char*>();
   if (!buffer) {
     JS_ReportOutOfMemory(cx);
     return nullptr;
   }
@@ -7112,17 +7112,17 @@ CData::Create(JSContext* cx,
 
     if (!source)
       memset(data, 0, size);
     else
       memcpy(data, source, size);
   }
 
   *buffer = data;
-  JS_SetReservedSlot(dataObj, SLOT_DATA, PrivateValue(buffer));
+  JS_SetReservedSlot(dataObj, SLOT_DATA, PRIVATE_TO_JSVAL(buffer));
 
   return dataObj;
 }
 
 void
 CData::Finalize(JSFreeOp* fop, JSObject* obj)
 {
   // Delete our buffer, and the data it contains if we own it.
@@ -8056,17 +8056,17 @@ Int64Base::Construct(JSContext* cx,
 
   // attach the Int64's data
   uint64_t* buffer = cx->new_<uint64_t>(data);
   if (!buffer) {
     JS_ReportOutOfMemory(cx);
     return nullptr;
   }
 
-  JS_SetReservedSlot(result, SLOT_INT64, PrivateValue(buffer));
+  JS_SetReservedSlot(result, SLOT_INT64, PRIVATE_TO_JSVAL(buffer));
 
   if (!JS_FreezeObject(cx, result))
     return nullptr;
 
   return result;
 }
 
 void
--- a/js/src/ctypes/Library.cpp
+++ b/js/src/ctypes/Library.cpp
@@ -84,17 +84,17 @@ JSObject*
 Library::Create(JSContext* cx, jsval path_, const JSCTypesCallbacks* callbacks)
 {
   RootedValue path(cx, path_);
   RootedObject libraryObj(cx, JS_NewObject(cx, &sLibraryClass));
   if (!libraryObj)
     return nullptr;
 
   // initialize the library
-  JS_SetReservedSlot(libraryObj, SLOT_LIBRARY, PrivateValue(nullptr));
+  JS_SetReservedSlot(libraryObj, SLOT_LIBRARY, PRIVATE_TO_JSVAL(nullptr));
 
   // attach API functions
   if (!JS_DefineFunctions(cx, libraryObj, sLibraryFunctions))
     return nullptr;
 
   if (!path.isString()) {
     JS_ReportError(cx, "open takes a string argument");
     return nullptr;
@@ -161,17 +161,17 @@ Library::Create(JSContext* cx, jsval pat
     return nullptr;
   }
 
 #ifndef XP_WIN
   JS_free(cx, pathBytes);
 #endif
 
   // stash the library
-  JS_SetReservedSlot(libraryObj, SLOT_LIBRARY, PrivateValue(library));
+  JS_SetReservedSlot(libraryObj, SLOT_LIBRARY, PRIVATE_TO_JSVAL(library));
 
   return libraryObj;
 }
 
 bool
 Library::IsLibrary(JSObject* obj)
 {
   return JS_GetClass(obj) == &sLibraryClass;
@@ -239,17 +239,17 @@ Library::Close(JSContext* cx, unsigned a
 
   if (args.length() != 0) {
     JS_ReportError(cx, "close doesn't take any arguments");
     return false;
   }
 
   // delete our internal objects
   UnloadLibrary(obj);
-  JS_SetReservedSlot(obj, SLOT_LIBRARY, PrivateValue(nullptr));
+  JS_SetReservedSlot(obj, SLOT_LIBRARY, PRIVATE_TO_JSVAL(nullptr));
 
   args.rval().setUndefined();
   return true;
 }
 
 bool
 Library::Declare(JSContext* cx, unsigned argc, jsval* vp)
 {
--- a/js/src/gdb/tests/test-Root.cpp
+++ b/js/src/gdb/tests/test-Root.cpp
@@ -23,17 +23,17 @@ void callee(JS::Handle<JSObject*> obj, J
 
 FRAGMENT(Root, handle) {
   JS::Rooted<JSObject*> global(cx, JS::CurrentGlobalOrNull(cx));
   callee(global, &global);
   (void) global;
 }
 
 FRAGMENT(Root, HeapSlot) {
-  JS::Rooted<jsval> plinth(cx, JS::StringValue(JS_NewStringCopyZ(cx, "plinth")));
+  JS::Rooted<jsval> plinth(cx, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, "plinth")));
   JS::Rooted<JSObject*> array(cx, JS_NewArrayObject(cx, JS::HandleValueArray(plinth)));
 
   breakpoint();
 
   (void) plinth;
   (void) array;
 }
 
--- a/js/src/jsapi-tests/testParseJSON.cpp
+++ b/js/src/jsapi-tests/testParseJSON.cpp
@@ -69,36 +69,36 @@ BEGIN_TEST(testParseJSON_success)
     expected = DOUBLE_TO_JSVAL(std::numeric_limits<double>::infinity());
     CHECK(TryParse(cx, "9e99999", expected));
 
     JS::Rooted<JSFlatString*> str(cx);
 
     const char16_t emptystr[] = { '\0' };
     str = js::NewStringCopyN<CanGC>(cx, emptystr, 0);
     CHECK(str);
-    expected = JS::StringValue(str);
+    expected = STRING_TO_JSVAL(str);
     CHECK(TryParse(cx, "\"\"", expected));
 
     const char16_t nullstr[] = { '\0' };
     str = NewString(cx, nullstr);
     CHECK(str);
-    expected = JS::StringValue(str);
+    expected = STRING_TO_JSVAL(str);
     CHECK(TryParse(cx, "\"\\u0000\"", expected));
 
     const char16_t backstr[] = { '\b' };
     str = NewString(cx, backstr);
     CHECK(str);
-    expected = JS::StringValue(str);
+    expected = STRING_TO_JSVAL(str);
     CHECK(TryParse(cx, "\"\\b\"", expected));
     CHECK(TryParse(cx, "\"\\u0008\"", expected));
 
     const char16_t newlinestr[] = { '\n', };
     str = NewString(cx, newlinestr);
     CHECK(str);
-    expected = JS::StringValue(str);
+    expected = STRING_TO_JSVAL(str);
     CHECK(TryParse(cx, "\"\\n\"", expected));
     CHECK(TryParse(cx, "\"\\u000A\"", expected));
 
 
     // Arrays
     JS::RootedValue v(cx), v2(cx);
     JS::RootedObject obj(cx);
 
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -282,17 +282,17 @@ JS_PUBLIC_API(jsval)
 JS_GetPositiveInfinityValue(JSContext* cx)
 {
     return cx->runtime()->positiveInfinityValue;
 }
 
 JS_PUBLIC_API(jsval)
 JS_GetEmptyStringValue(JSContext* cx)
 {
-    return StringValue(cx->runtime()->emptyString);
+    return STRING_TO_JSVAL(cx->runtime()->emptyString);
 }
 
 JS_PUBLIC_API(JSString*)
 JS_GetEmptyString(JSRuntime* rt)
 {
     MOZ_ASSERT(rt->hasContexts());
     return rt->emptyString;
 }
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -5431,17 +5431,17 @@ dom_genericMethod(JSContext* cx, unsigne
     JSJitMethodOp method = info->method;
     return method(cx, obj, val.toPrivate(), JSJitMethodCallArgs(args));
 }
 
 static void
 InitDOMObject(HandleObject obj)
 {
     /* Fow now just initialize to a constant we can check. */
-    SetReservedSlot(obj, DOM_OBJECT_SLOT, PrivateValue((void*)0x1234));
+    SetReservedSlot(obj, DOM_OBJECT_SLOT, PRIVATE_TO_JSVAL((void*)0x1234));
 }
 
 static bool
 dom_constructor(JSContext* cx, unsigned argc, JS::Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     RootedObject callee(cx, &args.callee());
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -3527,17 +3527,17 @@ XPCJSRuntime::OnJSContextNew(JSContext* 
         RootedString str(cx);
         for (unsigned i = 0; i < IDX_TOTAL_COUNT; i++) {
             str = JS_InternString(cx, mStrings[i]);
             if (!str) {
                 mStrIDs[0] = JSID_VOID;
                 return false;
             }
             mStrIDs[i] = INTERNED_STRING_TO_JSID(cx, str);
-            mStrJSVals[i].setString(str);
+            mStrJSVals[i] = STRING_TO_JSVAL(str);
         }
 
         if (!mozilla::dom::DefineStaticJSVals(cx)) {
             return false;
         }
     }
 
     XPCContext* xpc = new XPCContext(this, cx);
--- a/js/xpconnect/src/XPCLocale.cpp
+++ b/js/xpconnect/src/XPCLocale.cpp
@@ -110,17 +110,17 @@ private:
     changeCaseFnc(autoStr, result);
 
     JSString* ucstr =
       JS_NewUCStringCopyN(cx, result.get(), result.Length());
     if (!ucstr) {
       return false;
     }
 
-    rval.setString(ucstr);
+    rval.set(STRING_TO_JSVAL(ucstr));
     return true;
   }
 
   bool
   Compare(JSContext* cx, HandleString src1, HandleString src2, MutableHandleValue rval)
   {
     nsresult rv;
 
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -707,17 +707,17 @@ env_setProperty(JSContext* cx, HandleObj
     }
 #else
     rv = setenv(name.ptr(), value.ptr(), 1);
 #endif
     if (rv < 0) {
         JS_ReportError(cx, "can't set envariable %s to %s", name.ptr(), value.ptr());
         return false;
     }
-    vp.setString(valstr);
+    vp.set(STRING_TO_JSVAL(valstr));
 #endif /* !defined SOLARIS */
     return result.succeed();
 }
 
 static bool
 env_enumerate(JSContext* cx, HandleObject obj)
 {
     static bool reflected;
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -56,17 +56,17 @@ ToStringGuts(XPCCallContext& ccx)
         return false;
     }
 
     JSString* str = JS_NewStringCopyZ(ccx, sz);
     JS_smprintf_free(sz);
     if (!str)
         return false;
 
-    ccx.SetRetVal(JS::StringValue(str));
+    ccx.SetRetVal(STRING_TO_JSVAL(str));
     return true;
 }
 
 /***************************************************************************/
 
 static bool
 XPC_WN_Shared_ToString(JSContext* cx, unsigned argc, jsval* vp)
 {
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -993,17 +993,17 @@ XrayTraits::attachExpandoObject(JSContex
     // Create the expando object.
     RootedObject expandoObject(cx,
       JS_NewObjectWithGivenProto(cx, &ExpandoObjectClass, nullptr));
     if (!expandoObject)
         return nullptr;
 
     // AddRef and store the principal.
     NS_ADDREF(origin);
-    JS_SetReservedSlot(expandoObject, JSSLOT_EXPANDO_ORIGIN, JS::PrivateValue(origin));
+    JS_SetReservedSlot(expandoObject, JSSLOT_EXPANDO_ORIGIN, PRIVATE_TO_JSVAL(origin));
 
     // Note the exclusive global, if any.
     JS_SetReservedSlot(expandoObject, JSSLOT_EXPANDO_EXCLUSIVE_GLOBAL,
                        OBJECT_TO_JSVAL(exclusiveGlobal));
 
     // If this is our first expando object, take the opportunity to preserve
     // the wrapper. This keeps our expandos alive even if the Xray wrapper gets
     // collected.
--- a/storage/mozStorageStatementJSHelper.cpp
+++ b/storage/mozStorageStatementJSHelper.cpp
@@ -66,17 +66,17 @@ stepFunc(JSContext *aCtx,
     return true;
   }
 
   if (NS_FAILED(rv)) {
     ::JS_ReportError(aCtx, "mozIStorageStatement::step() returned an error");
     return false;
   }
 
-  _vp->setBoolean(hasMore);
+  *_vp = BOOLEAN_TO_JSVAL(hasMore);
   return true;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// StatementJSHelper
 
 nsresult
 StatementJSHelper::getRow(Statement *aStatement,
--- a/storage/mozStorageStatementRow.cpp
+++ b/storage/mozStorageStatementRow.cpp
@@ -75,17 +75,17 @@ StatementRow::GetProperty(nsIXPConnectWr
         static_cast<mozIStorageStatement *>(mStatement)->
           AsSharedWString(idx, &bytes)
       );
       JSString *str = ::JS_NewUCStringCopyN(aCtx, sval, bytes / 2);
       if (!str) {
         *_retval = false;
         return NS_OK;
       }
-      _vp->setString(str);
+      *_vp = STRING_TO_JSVAL(str);
     }
     else if (type == mozIStorageValueArray::VALUE_TYPE_BLOB) {
       uint32_t length;
       const uint8_t *blob = static_cast<mozIStorageStatement *>(mStatement)->
         AsSharedBlob(idx, &length);
       JSObject *obj = ::JS_NewArrayObject(aCtx, length);
       if (!obj) {
         *_retval = false;