Bug 1056332 - Remove cross-global adopt telemetry. r=gabor
authorBobby Holley <bobbyholley@gmail.com>
Sat, 23 Aug 2014 09:01:50 +0200
changeset 201213 e7236c73a81c1746d2137bd3060a5a1b18bd428e
parent 201212 6478460e5dd0d51be2b7f7e65cead08b91f52ecb
child 201214 1ed271ffb59cabf5349ed5f08a5799aff60a34ab
push id48109
push usergkrizsanits@mozilla.com
push dateSat, 23 Aug 2014 07:03:40 +0000
treeherdermozilla-inbound@e7236c73a81c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgabor
bugs1056332
milestone34.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 1056332 - Remove cross-global adopt telemetry. r=gabor
dom/bindings/BindingUtils.cpp
js/xpconnect/src/XPCJSRuntime.cpp
js/xpconnect/src/xpcprivate.h
js/xpconnect/src/xpcpublic.h
toolkit/components/telemetry/Histograms.json
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -1783,20 +1783,16 @@ ReparentWrapper(JSContext* aCx, JS::Hand
   JSCompartment* newCompartment = js::GetObjectCompartment(newParent);
   if (oldCompartment == newCompartment) {
     if (!JS_SetParent(aCx, aObj, newParent)) {
       MOZ_CRASH();
     }
     return NS_OK;
   }
 
-  // Telemetry.
-  xpc::RecordDonatedNode(oldCompartment);
-  xpc::RecordAdoptedNode(newCompartment);
-
   nsISupports* native = UnwrapDOMObjectToISupports(aObj);
   if (!native) {
     return NS_OK;
   }
 
   bool isProxy = js::IsProxy(aObj);
   JS::Rooted<JSObject*> expandoObject(aCx);
   if (isProxy) {
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -253,42 +253,19 @@ public:
 
 public:
   bool mContinuation;
   bool mActive;
 };
 
 namespace xpc {
 
-static uint32_t kLivingAdopters = 0;
-
-void
-RecordAdoptedNode(JSCompartment *c)
-{
-    CompartmentPrivate *priv = CompartmentPrivate::Get(c);
-    if (!priv->adoptedNode) {
-        priv->adoptedNode = true;
-        ++kLivingAdopters;
-    }
-}
-
-void
-RecordDonatedNode(JSCompartment *c)
-{
-    CompartmentPrivate::Get(c)->donatedNode = true;
-}
-
 CompartmentPrivate::~CompartmentPrivate()
 {
     MOZ_COUNT_DTOR(xpc::CompartmentPrivate);
-
-    Telemetry::Accumulate(Telemetry::COMPARTMENT_ADOPTED_NODE, adoptedNode);
-    Telemetry::Accumulate(Telemetry::COMPARTMENT_DONATED_NODE, donatedNode);
-    if (adoptedNode)
-        --kLivingAdopters;
 }
 
 static bool
 TryParseLocationURICandidate(const nsACString& uristr,
                              CompartmentPrivate::LocationHint aLocationHint,
                              nsIURI** aURI)
 {
     static NS_NAMED_LITERAL_CSTRING(kGRE, "resource://gre/");
@@ -774,23 +751,16 @@ XPCJSRuntime::GCSliceCallback(JSRuntime 
 
     if (self->mPrevGCSliceCallback)
         (*self->mPrevGCSliceCallback)(rt, progress, desc);
 }
 
 void
 XPCJSRuntime::CustomGCCallback(JSGCStatus status)
 {
-    // Record kLivingAdopters once per GC to approximate time sampling during
-    // periods of activity.
-    if (status == JSGC_BEGIN) {
-        Telemetry::Accumulate(Telemetry::COMPARTMENT_LIVING_ADOPTERS,
-                              kLivingAdopters);
-    }
-
     nsTArray<xpcGCCallback> callbacks(extraGCCallbacks);
     for (uint32_t i = 0; i < callbacks.Length(); ++i)
         callbacks[i](status);
 }
 
 /* static */ void
 XPCJSRuntime::FinalizeCallback(JSFreeOp *fop,
                                JSFinalizeStatus status,
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -3597,18 +3597,16 @@ public:
     };
 
     explicit CompartmentPrivate(JSCompartment *c)
         : wantXrays(false)
         , writeToGlobalPrototype(false)
         , skipWriteToGlobalPrototype(false)
         , universalXPConnectEnabled(false)
         , forcePermissiveCOWs(false)
-        , adoptedNode(false)
-        , donatedNode(false)
         , warnedAboutXrays(false)
         , scriptability(c)
         , scope(nullptr)
     {
         MOZ_COUNT_CTOR(xpc::CompartmentPrivate);
     }
 
     ~CompartmentPrivate();
@@ -3651,20 +3649,16 @@ public:
     // This is only ever set during mochitest runs when enablePrivilege is called.
     // It allows the SpecialPowers scope to waive the normal chrome security
     // wrappers and expose properties directly to content. This lets us avoid a
     // bunch of overhead and complexity in our SpecialPowers automation glue.
     //
     // Using it in production is inherently unsafe.
     bool forcePermissiveCOWs;
 
-    // for telemetry. See bug 928476.
-    bool adoptedNode;
-    bool donatedNode;
-
     // Whether we've emitted a warning about a property that was filtered out
     // by XrayWrappers. See XrayWrapper.cpp.
     bool warnedAboutXrays;
 
     // The scriptability of this compartment.
     Scriptability scriptability;
 
     // Our XPCWrappedNativeScope. This is non-null if and only if this is an
--- a/js/xpconnect/src/xpcpublic.h
+++ b/js/xpconnect/src/xpcpublic.h
@@ -474,22 +474,16 @@ WindowGlobalOrNull(JSObject *aObj);
 // Error reporter used when there is no associated DOM window on to which to
 // report errors and warnings.
 void
 SystemErrorReporter(JSContext *cx, const char *message, JSErrorReport *rep);
 
 void
 SimulateActivityCallback(bool aActive);
 
-void
-RecordAdoptedNode(JSCompartment *c);
-
-void
-RecordDonatedNode(JSCompartment *c);
-
 // This function may be used off-main-thread, in which case it is benignly
 // racey.
 bool
 ShouldDiscardSystemSource();
 
 bool
 SetAddonInterposition(const nsACString &addonId, nsIAddonInterposition *interposition);
 
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -77,32 +77,16 @@
     "description": "Maximum number of concurrent threads reached during a given download session"
   },
   "BLOCKLIST_SYNC_FILE_LOAD": {
     "alert_emails": ["rvitillo@mozilla.com"],
     "expires_in_version": "35",
     "kind": "boolean",
     "description": "blocklist.xml has been loaded synchronously"
   },
-  "COMPARTMENT_DONATED_NODE": {
-    "expires_in_version": "never",
-    "kind": "boolean",
-    "description": "When a compartment is destroyed, we record whether one of its nodes was ever adopted into another compartment"
-  },
-  "COMPARTMENT_ADOPTED_NODE": {
-    "expires_in_version": "never",
-    "kind": "boolean",
-    "description": "When a compartment is destroyed, we record whether it had ever adopted a node from another compartment"
-  },
-  "COMPARTMENT_LIVING_ADOPTERS": {
-    "expires_in_version": "never",
-    "kind": "enumerated",
-    "n_values": 10,
-    "description": "The number of living compartments for which COMPARTMENT_ADOPTED_NODE is true"
-  },
   "CYCLE_COLLECTOR": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": "10000",
     "n_buckets": 50,
     "description": "Time spent on one cycle collection (ms)"
   },
   "CYCLE_COLLECTOR_WORKER": {