| Index: src/parsing/parser.cc
|
| diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
|
| index 86290f2bb66ee683eb86ba84582a4b9514248ac7..e555942420098a3792a724e2645b195f29306094 100644
|
| --- a/src/parsing/parser.cc
|
| +++ b/src/parsing/parser.cc
|
| @@ -586,15 +586,16 @@ Expression* Parser::NewV8Intrinsic(const AstRawString* name,
|
|
|
| Parser::Parser(ParseInfo* info)
|
| : ParserBase<Parser>(info->zone(), &scanner_, info->stack_limit(),
|
| - info->extension(), info->ast_value_factory(), NULL),
|
| + info->extension(), info->ast_value_factory()),
|
| scanner_(info->unicode_cache()),
|
| - reusable_preparser_(NULL),
|
| - original_scope_(NULL),
|
| - target_stack_(NULL),
|
| + reusable_preparser_(nullptr),
|
| + original_scope_(nullptr),
|
| + target_stack_(nullptr),
|
| compile_options_(info->compile_options()),
|
| cached_parse_data_(nullptr),
|
| total_preparse_skipped_(0),
|
| - parsing_on_main_thread_(true) {
|
| + parsing_on_main_thread_(true),
|
| + log_(nullptr) {
|
| // Even though we were passed ParseInfo, we should not store it in
|
| // Parser - this makes sure that Isolate is not accidentally accessed via
|
| // ParseInfo during background parsing.
|
| @@ -2776,9 +2777,8 @@ Parser::LazyParsingResult Parser::SkipFunction(
|
| }
|
| // With no cached data, we partially parse the function, without building an
|
| // AST. This gathers the data needed to build a lazy function.
|
| - SingletonLogger logger;
|
| PreParser::PreParseResult result = ParseFunctionWithPreParser(
|
| - kind, function_scope, &logger, is_inner_function, may_abort);
|
| + kind, function_scope, is_inner_function, may_abort);
|
|
|
| // Return immediately if pre-parser decided to abort parsing.
|
| if (result == PreParser::kPreParseAbort) return kLazyParsingAborted;
|
| @@ -2788,25 +2788,23 @@ Parser::LazyParsingResult Parser::SkipFunction(
|
| *ok = false;
|
| return kLazyParsingComplete;
|
| }
|
| - if (logger.has_error()) {
|
| - ReportMessageAt(Scanner::Location(logger.start(), logger.end()),
|
| - logger.message(), logger.argument_opt(),
|
| - logger.error_type());
|
| + SingletonLogger* logger = reusable_preparser_->logger();
|
| + if (logger->has_error()) {
|
| + ReportMessageAt(Scanner::Location(logger->start(), logger->end()),
|
| + logger->message(), logger->argument_opt(),
|
| + logger->error_type());
|
| *ok = false;
|
| return kLazyParsingComplete;
|
| }
|
| - function_scope->set_end_position(logger.end());
|
| + function_scope->set_end_position(logger->end());
|
| Expect(Token::RBRACE, CHECK_OK_VALUE(kLazyParsingComplete));
|
| total_preparse_skipped_ +=
|
| function_scope->end_position() - function_scope->start_position();
|
| - *num_parameters = logger.num_parameters();
|
| - *function_length = logger.function_length();
|
| - *has_duplicate_parameters = logger.has_duplicate_parameters();
|
| - *materialized_literal_count = logger.literals();
|
| - *expected_property_count = logger.properties();
|
| - SetLanguageMode(function_scope, logger.language_mode());
|
| - if (logger.uses_super_property()) function_scope->RecordSuperPropertyUsage();
|
| - if (logger.calls_eval()) function_scope->RecordEvalCall();
|
| + *num_parameters = logger->num_parameters();
|
| + *function_length = logger->function_length();
|
| + *has_duplicate_parameters = logger->has_duplicate_parameters();
|
| + *materialized_literal_count = logger->literals();
|
| + *expected_property_count = logger->properties();
|
| if (!is_inner_function && produce_cached_parse_data()) {
|
| DCHECK(log_);
|
| log_->LogFunction(
|
| @@ -3289,13 +3287,13 @@ ZoneList<Statement*>* Parser::ParseEagerFunctionBody(
|
| }
|
|
|
| PreParser::PreParseResult Parser::ParseFunctionWithPreParser(
|
| - FunctionKind kind, DeclarationScope* function_scope,
|
| - SingletonLogger* logger, bool is_inner_function, bool may_abort) {
|
| + 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(),
|
| - NULL, stack_limit_);
|
| + reusable_preparser_ =
|
| + new PreParser(zone(), &scanner_, ast_value_factory(), stack_limit_);
|
| reusable_preparser_->set_allow_lazy(true);
|
| #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name());
|
| SET_ALLOW(natives);
|
| @@ -3312,8 +3310,8 @@ PreParser::PreParseResult Parser::ParseFunctionWithPreParser(
|
| DCHECK(!is_inner_function || !may_abort);
|
|
|
| PreParser::PreParseResult result = reusable_preparser_->PreParseFunction(
|
| - kind, function_scope, parsing_module_, logger, is_inner_function,
|
| - may_abort, use_counts_);
|
| + kind, function_scope, parsing_module_, is_inner_function, may_abort,
|
| + use_counts_);
|
| return result;
|
| }
|
|
|
|
|