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

Unified Diff: src/parsing/parser.cc

Issue 2479213002: [parser] Only track parsing-mode (and possibly switch to the preparser) in the parser (Closed)
Patch Set: addressed comments 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
« no previous file with comments | « src/parsing/parser.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 7e554a750cd9bc49b429f33a826ee1ea3a89e695..92822d477aacff987d06f3f74fd987e57232f069 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -590,6 +590,7 @@ Parser::Parser(ParseInfo* info)
scanner_(info->unicode_cache()),
reusable_preparser_(nullptr),
original_scope_(nullptr),
+ mode_(PARSE_EAGERLY), // Lazy mode must be set explicitly.
target_stack_(nullptr),
compile_options_(info->compile_options()),
cached_parse_data_(nullptr),
@@ -2569,11 +2570,11 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
// parenthesis before the function means that it will be called
// immediately). bar can be parsed lazily, but we need to parse it in a mode
// that tracks unresolved variables.
- DCHECK_IMPLIES(mode() == PARSE_LAZILY, FLAG_lazy);
- DCHECK_IMPLIES(mode() == PARSE_LAZILY, allow_lazy());
- DCHECK_IMPLIES(mode() == PARSE_LAZILY, extension_ == nullptr);
+ DCHECK_IMPLIES(parse_lazily(), FLAG_lazy);
+ DCHECK_IMPLIES(parse_lazily(), allow_lazy());
+ DCHECK_IMPLIES(parse_lazily(), extension_ == nullptr);
- bool can_preparse = mode() == PARSE_LAZILY &&
+ bool can_preparse = parse_lazily() &&
eager_compile_hint == FunctionLiteral::kShouldLazyCompile;
bool is_lazy_top_level_function =
« no previous file with comments | « src/parsing/parser.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698