Bug 1054630 - Part 5b: Collect telemetry on usage of SpiderMonkey's deprecated expression closures. r=till

This commit is contained in:
Chris Peterson 2014-08-17 17:22:42 -07:00
parent 7c3b7c0a5a
commit 4b88986141
4 changed files with 11 additions and 2 deletions

View File

@ -433,6 +433,7 @@ Parser<ParseHandler>::Parser(ExclusiveContext *cx, LifoAlloc *alloc,
sawDeprecatedForEach(false),
sawDeprecatedDestructuringForIn(false),
sawDeprecatedLegacyGenerator(false),
sawDeprecatedExpressionClosure(false),
handler(cx, *alloc, tokenStream, foldConstants, syntaxParser, lazyOuterFunction)
{
{
@ -2273,6 +2274,10 @@ Parser<ParseHandler>::functionArgsAndBodyGeneric(Node pn, HandleFunction fun, Fu
report(ParseError, false, null(), JSMSG_CURLY_BEFORE_BODY);
return false;
}
if (kind != Arrow)
sawDeprecatedExpressionClosure = true;
tokenStream.ungetToken();
bodyType = ExpressionBody;
fun->setIsExprClosure();
@ -7600,6 +7605,7 @@ Parser<ParseHandler>::accumulateTelemetry()
DeprecatedForEach = 0, // JS 1.6+
DeprecatedDestructuringForIn = 1, // JS 1.7 only
DeprecatedLegacyGenerator = 2, // JS 1.7+
DeprecatedExpressionClosure = 3, // Added in JS 1.8, but not version-gated
};
// TODO: Call back into Firefox's Telemetry reporter.
@ -7609,6 +7615,8 @@ Parser<ParseHandler>::accumulateTelemetry()
(*cb)(JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT, DeprecatedDestructuringForIn);
if (sawDeprecatedLegacyGenerator)
(*cb)(JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT, DeprecatedLegacyGenerator);
if (sawDeprecatedExpressionClosure)
(*cb)(JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT, DeprecatedExpressionClosure);
}
template class Parser<FullParseHandler>;

View File

@ -354,6 +354,7 @@ class Parser : private JS::AutoGCRooter, public StrictModeGetter
bool sawDeprecatedForEach:1;
bool sawDeprecatedDestructuringForIn:1;
bool sawDeprecatedLegacyGenerator:1;
bool sawDeprecatedExpressionClosure:1;
typedef typename ParseHandler::Node Node;
typedef typename ParseHandler::DefinitionNode DefinitionNode;

View File

@ -2930,7 +2930,7 @@ AccumulateTelemetryCallback(int id, uint32_t sample)
Telemetry::Accumulate(Telemetry::GC_SCC_SWEEP_MAX_PAUSE_MS, sample);
break;
case JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT:
MOZ_ASSERT(sample <= 2);
MOZ_ASSERT(sample <= 3);
Telemetry::Accumulate(Telemetry::JS_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT, sample);
break;
default:

View File

@ -322,7 +322,7 @@
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 10,
"description": "Use of SpiderMonkey's deprecated language extensions in web content: ForEach, DestructuringForIn, LegacyGenerator"
"description": "Use of SpiderMonkey's deprecated language extensions in web content: ForEach, DestructuringForIn, LegacyGenerator, ExpressionClosure"
},
"TELEMETRY_PING": {
"expires_in_version": "never",