Bug 1102131 - Part 2: Collect telemetry about deprecated let blocks and expressions. r=shu

--HG--
extra : rebase_source : 9e0db2c7a2f90545d27e78d46a334dbc27554209
This commit is contained in:
Chris Peterson 2014-11-15 23:33:33 -08:00
Родитель 48f9369603
Коммит 1a48947a82
4 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -514,6 +514,8 @@ Parser<ParseHandler>::Parser(ExclusiveContext *cx, LifoAlloc *alloc,
sawDeprecatedDestructuringForIn(false),
sawDeprecatedLegacyGenerator(false),
sawDeprecatedExpressionClosure(false),
sawDeprecatedLetBlock(false),
sawDeprecatedLetExpression(false),
handler(cx, *alloc, tokenStream, foldConstants, syntaxParser, lazyOuterFunction)
{
{
@ -3657,11 +3659,13 @@ Parser<ParseHandler>::letBlock(LetContext letContext)
if (!expr)
return null();
MUST_MATCH_TOKEN(TOK_RC, JSMSG_CURLY_AFTER_LET);
sawDeprecatedLetBlock = true;
} else {
MOZ_ASSERT(letContext == LetExpression);
expr = assignExpr();
if (!expr)
return null();
sawDeprecatedLetExpression = true;
}
handler.setLexicalScopeBody(block, expr);
PopStatementPC(tokenStream, pc);
@ -8334,6 +8338,8 @@ Parser<ParseHandler>::accumulateTelemetry()
DeprecatedDestructuringForIn = 1, // JS 1.7 only
DeprecatedLegacyGenerator = 2, // JS 1.7+
DeprecatedExpressionClosure = 3, // Added in JS 1.8, but not version-gated
DeprecatedLetBlock = 4, // Added in JS 1.7, but not version-gated
DeprecatedLetExpression = 5, // Added in JS 1.7, but not version-gated
};
// Hazard analysis can't tell that the telemetry callbacks don't GC.
@ -8348,6 +8354,10 @@ Parser<ParseHandler>::accumulateTelemetry()
(*cb)(JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT, DeprecatedLegacyGenerator);
if (sawDeprecatedExpressionClosure)
(*cb)(JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT, DeprecatedExpressionClosure);
if (sawDeprecatedLetBlock)
(*cb)(JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT, DeprecatedLetBlock);
if (sawDeprecatedLetExpression)
(*cb)(JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT, DeprecatedLetExpression);
}
template class Parser<FullParseHandler>;

Просмотреть файл

@ -377,6 +377,8 @@ class Parser : private JS::AutoGCRooter, public StrictModeGetter
bool sawDeprecatedDestructuringForIn:1;
bool sawDeprecatedLegacyGenerator:1;
bool sawDeprecatedExpressionClosure:1;
bool sawDeprecatedLetBlock:1;
bool sawDeprecatedLetExpression:1;
typedef typename ParseHandler::Node Node;
typedef typename ParseHandler::DefinitionNode DefinitionNode;

Просмотреть файл

@ -3012,7 +3012,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 <= 3);
MOZ_ASSERT(sample <= 5);
Telemetry::Accumulate(Telemetry::JS_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT, sample);
break;
default:

Просмотреть файл

@ -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, ExpressionClosure"
"description": "Use of SpiderMonkey's deprecated language extensions in web content: ForEach=0, DestructuringForIn=1, LegacyGenerator=2, ExpressionClosure=3, LetBlock=4, LetExpression=5"
},
"TELEMETRY_PING": {
"expires_in_version": "default",