Bug 1466083 part 7 - Replace GetCompartmentZone with GetRealmZone. r=luke
authorJan de Mooij <jdemooij@mozilla.com>
Wed, 06 Jun 2018 12:55:50 +0200
changeset 475803 eff5e370cb33c11fd6fea6768e872675eb0e72ac
parent 475802 5dcfede51bc7da4da0f26d67e76ab3d38db3b8fc
child 475804 bf5be9b21c3c33949a6a855a8a5a559cd888a496
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1466083
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 1466083 part 7 - Replace GetCompartmentZone with GetRealmZone. r=luke
dom/workers/WorkerPrivate.cpp
js/src/jsfriendapi.cpp
js/src/jsfriendapi.h
js/src/vm/JSContext.h
js/xpconnect/src/XPCJSRuntime.cpp
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -1202,20 +1202,19 @@ public:
   {
     MOZ_ASSERT(!aRealmStats->extra);
 
     // ReportJSRuntimeExplicitTreeStats expects that
     // aRealmStats->extra is a xpc::RealmStatsExtras pointer.
     xpc::RealmStatsExtras* extras = new xpc::RealmStatsExtras;
 
     // This is the |jsPathPrefix|.  Each worker has exactly one realm.
-    JSCompartment* compartment = JS::GetCompartmentForRealm(aRealm);
     extras->jsPathPrefix.Assign(mRtPath);
     extras->jsPathPrefix += nsPrintfCString("zone(0x%p)/",
-                                            (void *)js::GetCompartmentZone(compartment));
+                                            (void *)js::GetRealmZone(aRealm));
     extras->jsPathPrefix += NS_LITERAL_CSTRING("realm(web-worker)/");
 
     // This should never be used when reporting with workers (hence the "?!").
     extras->domPathPrefix.AssignLiteral("explicit/workers/?!/");
 
     MOZ_ASSERT(StartsWithExplicit(extras->jsPathPrefix));
     MOZ_ASSERT(StartsWithExplicit(extras->domPathPrefix));
 
--- a/js/src/jsfriendapi.cpp
+++ b/js/src/jsfriendapi.cpp
@@ -333,19 +333,19 @@ js::GetBuiltinClass(JSContext* cx, Handl
 JS_FRIEND_API(const char*)
 js::ObjectClassName(JSContext* cx, HandleObject obj)
 {
     assertSameCompartment(cx, obj);
     return GetObjectClassName(cx, obj);
 }
 
 JS_FRIEND_API(JS::Zone*)
-js::GetCompartmentZone(JSCompartment* comp)
+js::GetRealmZone(JS::Realm* realm)
 {
-    return comp->zone();
+    return realm->zone();
 }
 
 JS_FRIEND_API(bool)
 js::IsSystemCompartment(JSCompartment* comp)
 {
     return JS::GetRealmForCompartment(comp)->isSystem();
 }
 
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -453,17 +453,17 @@ EnqueueJob(JSContext* cx, JS::HandleObje
  */
 extern JS_FRIEND_API(void)
 StopDrainingJobQueue(JSContext* cx);
 
 extern JS_FRIEND_API(void)
 RunJobs(JSContext* cx);
 
 extern JS_FRIEND_API(JS::Zone*)
-GetCompartmentZone(JSCompartment* comp);
+GetRealmZone(JS::Realm* realm);
 
 typedef bool
 (* PreserveWrapperCallback)(JSContext* cx, JSObject* obj);
 
 typedef enum  {
     CollectNurseryBeforeDump,
     IgnoreNurseryObjects
 } DumpHeapNurseryBehaviour;
--- a/js/src/vm/JSContext.h
+++ b/js/src/vm/JSContext.h
@@ -251,17 +251,17 @@ struct JSContext : public JS::RootingCon
     }
 
 #ifdef DEBUG
     bool inAtomsZone() const;
 #endif
 
     JS::Zone* zone() const {
         MOZ_ASSERT_IF(!realm() && zone_, inAtomsZone());
-        MOZ_ASSERT_IF(realm(), js::GetCompartmentZone(GetCompartmentForRealm(realm())) == zone_);
+        MOZ_ASSERT_IF(realm(), js::GetRealmZone(realm()) == zone_);
         return zoneRaw();
     }
 
     // For use when the context's zone is being read by another thread and the
     // compartment and zone pointers might not be in sync.
     JS::Zone* zoneRaw() const {
         return zone_;
     }
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -2222,20 +2222,18 @@ class XPCJSRuntimeStats : public JS::Run
                 extras->jsPathPrefix.AssignLiteral("explicit/js-non-window/zones/");
                 extras->domPathPrefix.AssignLiteral("explicit/dom/non-window-global?!/");
             }
         } else {
             extras->jsPathPrefix.AssignLiteral("explicit/js-non-window/zones/");
             extras->domPathPrefix.AssignLiteral("explicit/dom/no-global?!/");
         }
 
-        if (needZone) {
-            JSCompartment* c = JS::GetCompartmentForRealm(realm);
-            extras->jsPathPrefix += nsPrintfCString("zone(0x%p)/", (void*)js::GetCompartmentZone(c));
-        }
+        if (needZone)
+            extras->jsPathPrefix += nsPrintfCString("zone(0x%p)/", (void*)js::GetRealmZone(realm));
 
         extras->jsPathPrefix += NS_LITERAL_CSTRING("realm(") + rName + NS_LITERAL_CSTRING(")/");
 
         // extras->jsPathPrefix is used for almost all the realm-specific
         // reports. At this point it has the form
         // "<something>realm(<rname>)/".
         //
         // extras->domPathPrefix is used for DOM orphan nodes, which are