Chromium Code Reviews| Index: src/parsing/parser.cc |
| diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc |
| index f283b13b989689fc428c2b99d27006433d56cc87..5f4a9e8608344ab5652437cd56848daccbe86712 100644 |
| --- a/src/parsing/parser.cc |
| +++ b/src/parsing/parser.cc |
| @@ -2769,10 +2769,31 @@ Parser::LazyParsingResult Parser::SkipFunction( |
| } |
| cached_parse_data_->Reject(); |
| } |
| + |
| // With no cached data, we partially parse the function, without building an |
| // AST. This gathers the data needed to build a lazy function. |
| - PreParser::PreParseResult result = ParseFunctionWithPreParser( |
| - kind, function_scope, is_inner_function, may_abort); |
| + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.PreParse"); |
|
vogelheim
2016/11/15 16:14:10
This is a scope, and will now cover a somewhat lar
|
| + |
| + if (reusable_preparser_ == NULL) { |
| + reusable_preparser_ = new PreParser(zone(), &scanner_, ast_value_factory(), |
| + &pending_error_handler_, stack_limit_); |
| + reusable_preparser_->set_allow_lazy(true); |
| +#define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name()); |
| + SET_ALLOW(natives); |
| + SET_ALLOW(harmony_do_expressions); |
| + SET_ALLOW(harmony_function_sent); |
| + SET_ALLOW(harmony_async_await); |
| + SET_ALLOW(harmony_trailing_commas); |
| + SET_ALLOW(harmony_class_fields); |
| +#undef SET_ALLOW |
| + } |
| + // Aborting inner function preparsing would leave scopes in an inconsistent |
| + // state; we don't parse inner functions in the abortable mode anyway. |
| + DCHECK(!is_inner_function || !may_abort); |
| + |
| + PreParser::PreParseResult result = reusable_preparser_->PreParseFunction( |
| + kind, function_scope, parsing_module_, is_inner_function, may_abort, |
| + use_counts_); |
| // Return immediately if pre-parser decided to abort parsing. |
| if (result == PreParser::kPreParseAbort) return kLazyParsingAborted; |
| @@ -3277,34 +3298,6 @@ ZoneList<Statement*>* Parser::ParseEagerFunctionBody( |
| return result; |
| } |
| -PreParser::PreParseResult Parser::ParseFunctionWithPreParser( |
| - FunctionKind kind, DeclarationScope* function_scope, bool is_inner_function, |
| - bool may_abort) { |
| - TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.PreParse"); |
| - |
| - if (reusable_preparser_ == NULL) { |
| - reusable_preparser_ = new PreParser(zone(), &scanner_, ast_value_factory(), |
| - &pending_error_handler_, stack_limit_); |
| - reusable_preparser_->set_allow_lazy(true); |
| -#define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name()); |
| - SET_ALLOW(natives); |
| - SET_ALLOW(harmony_do_expressions); |
| - SET_ALLOW(harmony_function_sent); |
| - SET_ALLOW(harmony_async_await); |
| - SET_ALLOW(harmony_trailing_commas); |
| - SET_ALLOW(harmony_class_fields); |
| -#undef SET_ALLOW |
| - } |
| - // Aborting inner function preparsing would leave scopes in an inconsistent |
| - // state; we don't parse inner functions in the abortable mode anyway. |
| - DCHECK(!is_inner_function || !may_abort); |
| - |
| - PreParser::PreParseResult result = reusable_preparser_->PreParseFunction( |
| - kind, function_scope, parsing_module_, is_inner_function, may_abort, |
| - use_counts_); |
| - return result; |
| -} |
| - |
| Expression* Parser::InstallHomeObject(Expression* function_literal, |
| Expression* home_object) { |
| Block* do_block = factory()->NewBlock(nullptr, 1, false, kNoSourcePosition); |