Bug 1343620 - Use JS_HAZ_ROOTED everywhere instead of programmatic annotations, r=pbone
authorSteve Fink <sfink@mozilla.com>
Wed, 06 Jun 2018 16:28:38 -0700
changeset 422565 b15524c982e924e0732f56c4b9ca170ffcd10a30
parent 422564 9496b052a5d18a752ad186fa3c28dd182342f1b7
child 422566 9c8ca5323b16bf17c39b783d6e50b1748e8c8697
push id104300
push usersfink@mozilla.com
push dateThu, 14 Jun 2018 23:14:06 +0000
treeherdermozilla-inbound@b15524c982e9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbone
bugs1343620
milestone62.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 1343620 - Use JS_HAZ_ROOTED everywhere instead of programmatic annotations, r=pbone
dom/bindings/ErrorResult.h
js/src/devtools/rootAnalysis/annotations.js
js/src/wasm/AsmJS.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
--- a/dom/bindings/ErrorResult.h
+++ b/dom/bindings/ErrorResult.h
@@ -561,17 +561,17 @@ private:
   // The thread that created this TErrorResult
   NS_DECL_OWNINGTHREAD;
 #endif
 
   // Not to be implemented, to make sure people always pass this by
   // reference, not by value.
   TErrorResult(const TErrorResult&) = delete;
   void operator=(const TErrorResult&) = delete;
-};
+} JS_HAZ_ROOTED;
 
 struct JustAssertCleanupPolicy {
   static const bool assertHandled = true;
   static const bool suppress = false;
   static const bool assertSameThread = true;
 };
 
 struct AssertAndSuppressCleanupPolicy {
@@ -833,17 +833,17 @@ class MOZ_TEMPORARY_CLASS IgnoreErrors {
 public:
   operator ErrorResult&() && { return mInner; }
   operator OOMReporter&() && { return mInner; }
 private:
   // We don't use an ErrorResult member here so we don't make two separate calls
   // to SuppressException (one from us, one from the ErrorResult destructor
   // after asserting).
   binding_danger::TErrorResult<binding_danger::JustSuppressCleanupPolicy> mInner;
-};
+} JS_HAZ_ROOTED;
 
 /******************************************************************************
  ** Macros for checking results
  ******************************************************************************/
 
 #define ENSURE_SUCCESS(res, ret)                                          \
   do {                                                                    \
     if (res.Failed()) {                                                   \
--- a/js/src/devtools/rootAnalysis/annotations.js
+++ b/js/src/devtools/rootAnalysis/annotations.js
@@ -317,29 +317,20 @@ function stripUCSAndNamespace(name)
 function extraRootedGCThings()
 {
     return [ 'JSAddonId' ];
 }
 
 function extraRootedPointers()
 {
     return [
-        'ModuleValidator',
-        'JSErrorResult',
-        'WrappableJSErrorResult',
-
         // These are not actually rooted, but are only used in the context of
         // AutoKeepAtoms.
         'js::frontend::TokenStream',
         'js::frontend::TokenStreamAnyChars',
-
-        'mozilla::ErrorResult',
-        'mozilla::IgnoredErrorResult',
-        'mozilla::IgnoreErrors',
-        'mozilla::dom::binding_detail::FastErrorResult',
     ];
 }
 
 function isRootedGCPointerTypeName(name)
 {
     name = stripUCSAndNamespace(name);
 
     if (name.startsWith('MaybeRooted<'))
--- a/js/src/wasm/AsmJS.cpp
+++ b/js/src/wasm/AsmJS.cpp
@@ -1379,17 +1379,17 @@ static const unsigned VALIDATION_LIFO_DE
 // Rooting note: ModuleValidator is a stack class that contains unrooted
 // PropertyName (JSAtom) pointers.  This is safe because it cannot be
 // constructed without a TokenStream reference.  TokenStream is itself a stack
 // class that cannot be constructed without an AutoKeepAtoms being live on the
 // stack, which prevents collection of atoms.
 //
 // ModuleValidator is marked as rooted in the rooting analysis.  Don't add
 // non-JSAtom pointers, or this will break!
-class MOZ_STACK_CLASS ModuleValidator
+class MOZ_STACK_CLASS JS_HAZ_ROOTED ModuleValidator
 {
   public:
     class Func
     {
         PropertyName* name_;
         uint32_t sigIndex_;
         uint32_t firstUse_;
         uint32_t funcDefIndex_;
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -74,16 +74,17 @@
 #include "nsContentUtils.h"
 #include "nsDOMJSUtils.h"
 #include "nsIScriptError.h"
 #include "nsPrintfCString.h"
 #include "nsURLHelper.h"
 #include "nsNetUtil.h"
 #include "nsIURLParser.h"
 #include "NullPrincipal.h"
+#include "js/GCAnnotations.h"
 #include "mozilla/PeerIdentity.h"
 #include "mozilla/dom/RTCCertificate.h"
 #include "mozilla/dom/RTCConfigurationBinding.h"
 #include "mozilla/dom/RTCDTMFSenderBinding.h"
 #include "mozilla/dom/RTCDTMFToneChangeEvent.h"
 #include "mozilla/dom/RTCRtpReceiverBinding.h"
 #include "mozilla/dom/RTCRtpSenderBinding.h"
 #include "mozilla/dom/RTCStatsReportBinding.h"
@@ -150,17 +151,17 @@ namespace {
 class JSErrorResult :
     public binding_danger::TErrorResult<binding_danger::JustAssertCleanupPolicy>
 {
 public:
   ~JSErrorResult()
   {
     SuppressException();
   }
-};
+} JS_HAZ_ROOTED;
 
 // The WrapRunnable() macros copy passed-in args and passes them to the function
 // later on the other thread. ErrorResult cannot be passed like this because it
 // disallows copy-semantics.
 //
 // This WrappableJSErrorResult hack solves this by not actually copying the
 // ErrorResult, but creating a new one instead, which works because we don't
 // care about the result.
@@ -179,17 +180,17 @@ public:
     if (isCopy) {
       MOZ_ASSERT(NS_IsMainThread());
     }
   }
   operator ErrorResult &() { return *mRv; }
 private:
   mozilla::UniquePtr<JSErrorResult> mRv;
   bool isCopy;
-};
+} JS_HAZ_ROOTED;
 
 }
 
 static nsresult InitNSSInContent()
 {
   NS_ENSURE_TRUE(NS_IsMainThread(), NS_ERROR_NOT_SAME_THREAD);
 
   if (!XRE_IsContentProcess()) {