Bug 1319926 - Part 2: Collect telemetry about deprecated String generics methods. r=jandem
authorAndré Bargull <andre.bargull@gmail.com>
Thu, 08 Dec 2016 16:57:25 -1000
changeset 353602 5a110ad242ead60e71d2186bae78b1fb766ad5ff
parent 353601 07d6bf74b7a2552da91b5e2fce0fa0bc3b457394
child 353603 b1d7f3640ea7b8c7004d50d0001845564c6f71df
push id10621
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 16:02:43 +0000
treeherdermozilla-aurora@dca7b42e6c67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1319926
milestone53.0a1
Bug 1319926 - Part 2: Collect telemetry about deprecated String generics methods. r=jandem
js/src/jscompartment.h
js/src/vm/SelfHosting.cpp
toolkit/components/telemetry/Histograms.json
--- a/js/src/jscompartment.h
+++ b/js/src/jscompartment.h
@@ -878,16 +878,17 @@ struct JSCompartment
         DeprecatedExpressionClosure = 3,    // Added in JS 1.8
         // NO LONGER USING 4
         // NO LONGER USING 5
         // NO LONGER USING 6
         // NO LONGER USING 7
         // NO LONGER USING 8
         // NO LONGER USING 9
         DeprecatedBlockScopeFunRedecl = 10,
+        DeprecatedStringGenerics = 11,
         DeprecatedLanguageExtensionCount
     };
 
     js::ArgumentsObject* getOrCreateArgumentsTemplateObject(JSContext* cx, bool mapped);
 
     js::ArgumentsObject* maybeArgumentsTemplateObject(bool mapped) const;
 
   private:
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -1910,16 +1910,22 @@ intrinsic_WarnDeprecatedStringMethod(JSC
     CallArgs args = CallArgsFromVp(argc, vp);
     MOZ_ASSERT(args.length() == 2);
     MOZ_ASSERT(args[0].isInt32());
     MOZ_ASSERT(args[1].isString());
 
     uint32_t id = uint32_t(args[0].toInt32());
     MOZ_ASSERT(id < STRING_GENERICS_METHODS_LIMIT);
 
+    NonBuiltinScriptFrameIter iter(cx);
+    if (!iter.done()) {
+        const char* filename = iter.filename();
+        iter.compartment()->addTelemetry(filename, JSCompartment::DeprecatedStringGenerics);
+    }
+
     uint32_t mask = (1 << id);
     if (!(cx->compartment()->warnedAboutStringGenericsMethods & mask)) {
         JSFlatString* name = args[1].toString()->ensureFlat(cx);
         if (!name)
             return false;
 
         AutoStableStringChars stableChars(cx);
         if (!stableChars.initTwoByte(cx, name))
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -953,25 +953,25 @@
     "n_buckets": 100,
     "releaseChannelCollection": "opt-out",
     "description": "GPU process launch time in milliseconds"
   },
   "JS_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT": {
     "alert_emails": ["jdemooij@mozilla.com"],
     "expires_in_version": "never",
     "kind": "enumerated",
-    "n_values": 10,
-    "description": "Use of SpiderMonkey's deprecated language extensions in web content: ForEach=0, DestructuringForIn=1 (obsolete), LegacyGenerator=2, ExpressionClosure=3, LetBlock=4 (obsolete), LetExpression=5 (obsolete), NoSuchMethod=6 (obsolete), FlagsArgument=7 (obsolete), RegExpSourceProp=8 (obsolete), RestoredRegExpStatics=9 (obsolete), BlockScopeFunRedecl=10"
+    "n_values": 11,
+    "description": "Use of SpiderMonkey's deprecated language extensions in web content: ForEach=0, DestructuringForIn=1 (obsolete), LegacyGenerator=2, ExpressionClosure=3, LetBlock=4 (obsolete), LetExpression=5 (obsolete), NoSuchMethod=6 (obsolete), FlagsArgument=7 (obsolete), RegExpSourceProp=8 (obsolete), RestoredRegExpStatics=9 (obsolete), BlockScopeFunRedecl=10, StringGenerics=11"
   },
   "JS_DEPRECATED_LANGUAGE_EXTENSIONS_IN_ADDONS": {
     "alert_emails": ["jdemooij@mozilla.com"],
     "expires_in_version": "never",
     "kind": "enumerated",
-    "n_values": 10,
-    "description": "Use of SpiderMonkey's deprecated language extensions in add-ons: ForEach=0, DestructuringForIn=1 (obsolete), LegacyGenerator=2, ExpressionClosure=3, LetBlock=4 (obsolete), LetExpression=5 (obsolete), NoSuchMethod=6 (obsolete), FlagsArgument=7 (obsolete), RegExpSourceProp=8 (obsolete), RestoredRegExpStatics=9 (obsolete), BlockScopeFunRedecl=10"
+    "n_values": 11,
+    "description": "Use of SpiderMonkey's deprecated language extensions in add-ons: ForEach=0, DestructuringForIn=1 (obsolete), LegacyGenerator=2, ExpressionClosure=3, LetBlock=4 (obsolete), LetExpression=5 (obsolete), NoSuchMethod=6 (obsolete), FlagsArgument=7 (obsolete), RegExpSourceProp=8 (obsolete), RestoredRegExpStatics=9 (obsolete), BlockScopeFunRedecl=10, StringGenerics=11"
   },
   "XUL_CACHE_DISABLED": {
     "expires_in_version": "default",
     "kind": "flag",
     "description": "XUL cache was disabled"
   },
   "MEMORY_RESIDENT_FAST": {
     "alert_emails": ["memshrink-telemetry-alerts@mozilla.com"],