Bug 1339777 - Collect telemetry for String generics. r=arai,janerik data-review=chutten
authorTom Schuster <evilpies@gmail.com>
Tue, 22 Jan 2019 17:54:12 +0100
changeset 515223 8129ef9863e5cf6f6665dd7772569724c6702dfb
parent 515222 6e2afd71fecdd563e63bdd7a4353f05664e1a8ee
child 515224 d56504db04eae60a686340716dd8e5b95eae31f1
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai, janerik
bugs1339777
milestone66.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 1339777 - Collect telemetry for String generics. r=arai,janerik data-review=chutten Differential Revision: https://phabricator.services.mozilla.com/D17257
js/src/jsfriendapi.h
js/src/vm/SelfHosting.cpp
js/xpconnect/src/XPCJSRuntime.cpp
toolkit/components/telemetry/Histograms.json
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -165,16 +165,17 @@ enum {
   JS_TELEMETRY_GC_MINOR_REASON_LONG,
   JS_TELEMETRY_GC_MINOR_US,
   JS_TELEMETRY_GC_NURSERY_BYTES,
   JS_TELEMETRY_GC_PRETENURE_COUNT,
   JS_TELEMETRY_GC_NURSERY_PROMOTION_RATE,
   JS_TELEMETRY_GC_MARK_RATE,
   JS_TELEMETRY_PRIVILEGED_PARSER_COMPILE_LAZY_AFTER_MS,
   JS_TELEMETRY_WEB_PARSER_COMPILE_LAZY_AFTER_MS,
+  JS_TELEMETRY_DEPRECATED_STRING_GENERICS,
   JS_TELEMETRY_END
 };
 
 typedef void (*JSAccumulateTelemetryDataCallback)(int id, uint32_t sample,
                                                   const char* key);
 
 extern JS_FRIEND_API void JS_SetAccumulateTelemetryCallback(
     JSContext* cx, JSAccumulateTelemetryDataCallback callback);
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -2038,16 +2038,21 @@ static bool intrinsic_WarnDeprecatedStri
     }
     const char16_t* nameChars = stableChars.twoByteRange().begin().get();
 
     if (!JS_ReportErrorFlagsAndNumberUC(cx, JSREPORT_WARNING, GetErrorMessage,
                                         nullptr, JSMSG_DEPRECATED_STRING_METHOD,
                                         nameChars, nameChars)) {
       return false;
     }
+
+    if (!cx->realm()->isProbablySystemCode()) {
+      cx->runtime()->addTelemetry(JS_TELEMETRY_DEPRECATED_STRING_GENERICS, id);
+    }
+
     cx->realm()->warnedAboutStringGenericsMethods |= mask;
   }
 
   args.rval().setUndefined();
   return true;
 }
 
 static bool intrinsic_ThrowArgTypeNotObject(JSContext* cx, unsigned argc,
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -2736,16 +2736,19 @@ static void AccumulateTelemetryCallback(
                             sample);
       break;
     case JS_TELEMETRY_GC_NURSERY_PROMOTION_RATE:
       Telemetry::Accumulate(Telemetry::GC_NURSERY_PROMOTION_RATE, sample);
       break;
     case JS_TELEMETRY_GC_MARK_RATE:
       Telemetry::Accumulate(Telemetry::GC_MARK_RATE, sample);
       break;
+    case JS_TELEMETRY_DEPRECATED_STRING_GENERICS:
+      Telemetry::Accumulate(Telemetry::JS_DEPRECATED_STRING_GENERICS, sample);
+      break;
     default:
       MOZ_ASSERT_UNREACHABLE("Unexpected JS_TELEMETRY id");
   }
 }
 
 static void SetUseCounterCallback(JSObject* obj, JSUseCounter counter) {
   switch (counter) {
     case JSUseCounter::ASMJS:
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -1014,16 +1014,25 @@
     "expires_in_version": "70",
     "bug_numbers": [1343483],
     "kind": "exponential",
     "low": 10,
     "high": 10000,
     "n_buckets": 10,
     "description": "Time elapsed between the moment a function is lazy-parsed (end of parsing of the ScriptSource) and the moment it is recompiled as non-lazy (start of compilation), in milliseconds, for web code."
   },
+  "JS_DEPRECATED_STRING_GENERICS": {
+    "record_in_processes": ["content"],
+    "alert_emails": ["jdemooij@mozilla.com"],
+    "expires_in_version": "72",
+    "bug_numbers": [1339777],
+    "kind": "enumerated",
+    "n_values": 25,
+    "description": "A string generic function was called, like String.join etc. See STRING_GENERICS_* defines in SelfHostingDefines.h for the meaning of values."
+  },
   "XUL_CACHE_DISABLED": {
     "record_in_processes": ["main", "content"],
     "expires_in_version": "default",
     "kind": "flag",
     "description": "XUL cache was disabled"
   },
   "MEMORY_RESIDENT_FAST": {
     "record_in_processes": ["main", "content"],