Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Unified Diff: src/parsing/preparser.cc

Issue 2481163002: Assign unique IDs to FunctionLiterals (Closed)
Patch Set: updates Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/parsing/preparser.cc
diff --git a/src/parsing/preparser.cc b/src/parsing/preparser.cc
index 7f95164412209f2e6c20cda76c9528457dcf91ee..818808a1145ef59fdcf40c4f3c0f59146f3ae382 100644
--- a/src/parsing/preparser.cc
+++ b/src/parsing/preparser.cc
@@ -92,6 +92,8 @@ PreParser::PreParseResult PreParser::PreParseFunction(
DCHECK(!track_unresolved_variables_);
track_unresolved_variables_ = is_inner_function;
+ ResetFunctionLiteralId();
marja 2016/11/25 13:14:56 Had to think a bit about this... so this is becaus
jochen (gone - plz use gerrit) 2016/11/28 08:12:07 done
+
// The caller passes the function_scope which is not yet inserted into the
// scope_state_. All scopes above the function_scope are ignored by the
// PreParser.
@@ -195,6 +197,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
FunctionState function_state(&function_state_, &scope_state_, function_scope);
DuplicateFinder duplicate_finder(scanner()->unicode_cache());
ExpressionClassifier formals_classifier(this, &duplicate_finder);
+ GetNextFunctionLiteralId();
Expect(Token::LPAREN, CHECK_OK);
int start_position = scanner()->location().beg_pos;
@@ -251,10 +254,10 @@ PreParser::LazyParsingResult PreParser::ParseStatementListAndLogFunction(
DCHECK_EQ(Token::RBRACE, scanner()->peek());
int body_end = scanner()->peek_location().end_pos;
DCHECK(this->scope()->is_function_scope());
- log_.LogFunction(body_end, formals->num_parameters(),
- formals->function_length, has_duplicate_parameters,
- function_state_->materialized_literal_count(),
- function_state_->expected_property_count());
+ log_.LogFunction(
+ body_end, formals->num_parameters(), formals->function_length,
+ has_duplicate_parameters, function_state_->materialized_literal_count(),
+ function_state_->expected_property_count(), GetLastFunctionLiteralId());
return kLazyParsingComplete;
}

Powered by Google App Engine
This is Rietveld 408576698