| Index: src/parsing/parser.cc
|
| diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
|
| index a5eb0d20c0fec567fca9cda5990b23f83cf86b76..255892a47460d347b9d31a51f009d4a74ce94bd1 100644
|
| --- a/src/parsing/parser.cc
|
| +++ b/src/parsing/parser.cc
|
| @@ -280,7 +280,7 @@ FunctionLiteral* Parser::DefaultConstructor(const AstRawString* name,
|
| expected_property_count, parameter_count, parameter_count,
|
| FunctionLiteral::kNoDuplicateParameters,
|
| FunctionLiteral::kAnonymousExpression, default_eager_compile_hint(), pos,
|
| - true);
|
| + true, GetNextFunctionLiteralNum());
|
|
|
| function_literal->set_requires_class_field_init(requires_class_field_init);
|
|
|
| @@ -729,6 +729,9 @@ FunctionLiteral* Parser::DoParseProgram(ParseInfo* info) {
|
| DCHECK_NULL(target_stack_);
|
|
|
| ParsingModeScope mode(this, allow_lazy_ ? PARSE_LAZILY : PARSE_EAGERLY);
|
| + ResetFunctionLiteralNum();
|
| + DCHECK(info->function_literal_num() == 0 ||
|
| + info->function_literal_num() == -1);
|
|
|
| FunctionLiteral* result = NULL;
|
| {
|
| @@ -889,6 +892,10 @@ FunctionLiteral* Parser::DoParseFunction(ParseInfo* info,
|
| fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone());
|
| fni_->PushEnclosingName(raw_name);
|
|
|
| + ResetFunctionLiteralNum();
|
| + DCHECK_LT(0, info->function_literal_num());
|
| + SkipFunctionLiterals(info->function_literal_num() - 1);
|
| +
|
| ParsingModeScope parsing_mode(this, PARSE_EAGERLY);
|
|
|
| // Place holder for the result.
|
| @@ -921,6 +928,8 @@ FunctionLiteral* Parser::DoParseFunction(ParseInfo* info,
|
| }
|
| }
|
|
|
| + int function_literal_num = GetNextFunctionLiteralNum();
|
| +
|
| // TODO(adamk): We should construct this scope from the ScopeInfo.
|
| DeclarationScope* scope = NewFunctionScope(kind);
|
|
|
| @@ -957,7 +966,8 @@ FunctionLiteral* Parser::DoParseFunction(ParseInfo* info,
|
| checkpoint.Restore(&formals.materialized_literals_count);
|
| // Pass `accept_IN=true` to ParseArrowFunctionLiteral --- This should
|
| // not be observable, or else the preparser would have failed.
|
| - Expression* expression = ParseArrowFunctionLiteral(true, formals, &ok);
|
| + Expression* expression =
|
| + ParseArrowFunctionLiteral(true, formals, function_literal_num, &ok);
|
| if (ok) {
|
| // Scanning must end at the same position that was recorded
|
| // previously. If not, parsing has been interrupted due to a stack
|
| @@ -2625,6 +2635,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
|
| int num_parameters = -1;
|
| int function_length = -1;
|
| bool has_duplicate_parameters = false;
|
| + int function_literal_num = GetNextFunctionLiteralNum();
|
|
|
| Expect(Token::LPAREN, CHECK_OK);
|
| scope->set_start_position(scanner()->location().beg_pos);
|
| @@ -2731,7 +2742,8 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
|
| FunctionLiteral* function_literal = factory()->NewFunctionLiteral(
|
| function_name, scope, body, materialized_literal_count,
|
| expected_property_count, num_parameters, function_length,
|
| - duplicate_parameters, function_type, eager_compile_hint, pos, true);
|
| + duplicate_parameters, function_type, eager_compile_hint, pos, true,
|
| + function_literal_num);
|
| function_literal->set_function_token_position(function_token_pos);
|
| if (should_be_used_once_hint)
|
| function_literal->set_should_be_used_once_hint();
|
| @@ -2779,6 +2791,7 @@ Parser::LazyParsingResult Parser::SkipFunction(
|
| if (entry.uses_super_property())
|
| function_scope->RecordSuperPropertyUsage();
|
| if (entry.calls_eval()) function_scope->RecordEvalCall();
|
| + SkipFunctionLiterals(entry.num_inner_functions());
|
| return kLazyParsingComplete;
|
| }
|
| cached_parse_data_->Reject();
|
| @@ -2831,13 +2844,15 @@ Parser::LazyParsingResult Parser::SkipFunction(
|
| *has_duplicate_parameters = logger->has_duplicate_parameters();
|
| *materialized_literal_count = logger->literals();
|
| *expected_property_count = logger->properties();
|
| + SkipFunctionLiterals(logger->num_inner_functions());
|
| if (!is_inner_function && produce_cached_parse_data()) {
|
| DCHECK(log_);
|
| log_->LogFunction(
|
| function_scope->start_position(), function_scope->end_position(),
|
| *num_parameters, *function_length, *has_duplicate_parameters,
|
| *materialized_literal_count, *expected_property_count, language_mode(),
|
| - function_scope->uses_super_property(), function_scope->calls_eval());
|
| + function_scope->uses_super_property(), function_scope->calls_eval(),
|
| + logger->num_inner_functions());
|
| }
|
| return kLazyParsingComplete;
|
| }
|
| @@ -3416,7 +3431,7 @@ FunctionLiteral* Parser::SynthesizeClassFieldInitializer(int count) {
|
| FunctionLiteral::kNoDuplicateParameters,
|
| FunctionLiteral::kAnonymousExpression,
|
| FunctionLiteral::kShouldLazyCompile, initializer_scope->start_position(),
|
| - true);
|
| + true, GetNextFunctionLiteralNum());
|
| function_literal->set_is_class_field_initializer(true);
|
| return function_literal;
|
| }
|
| @@ -3460,7 +3475,9 @@ void Parser::DeclareClassVariable(const AstRawString* name, Scope* block_scope,
|
| // - properties
|
| void Parser::DeclareClassProperty(const AstRawString* class_name,
|
| ClassLiteralProperty* property,
|
| - ClassInfo* class_info, bool* ok) {
|
| + ClassLiteralProperty::Kind kind,
|
| + bool is_static, ClassInfo* class_info,
|
| + bool* ok) {
|
| if (class_info->has_seen_constructor && class_info->constructor == nullptr) {
|
| class_info->constructor = GetPropertyValue(property)->AsFunctionLiteral();
|
| DCHECK_NOT_NULL(class_info->constructor);
|
|
|