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

Unified Diff: src/parsing/parser.cc

Issue 2417643004: Explicitly check for lazy parser when dealing with parser cache (Closed)
Patch Set: Reset compile options to kNoCompileOptions if the cache is invalid Created 4 years, 2 months 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') | no next file » | 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 861289e5bd41a94bf15cee86ddd30a0017603214..26e81d0c20e74615ccb4e54bfcf64e257ecd7aee 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -150,12 +150,11 @@ class DiscardableZoneScope {
};
void Parser::SetCachedData(ParseInfo* info) {
- if (compile_options_ == ScriptCompiler::kNoCompileOptions) {
- cached_parse_data_ = NULL;
- } else {
- DCHECK(info->cached_data() != NULL);
- if (compile_options_ == ScriptCompiler::kConsumeParserCache) {
- cached_parse_data_ = ParseData::FromCachedData(*info->cached_data());
+ DCHECK_NULL(cached_parse_data_);
+ if (consume_cached_parse_data()) {
+ cached_parse_data_ = ParseData::FromCachedData(*info->cached_data());
+ if (cached_parse_data_ == nullptr) {
+ compile_options_ = ScriptCompiler::kNoCompileOptions;
}
}
}
@@ -638,7 +637,7 @@ Parser::Parser(ParseInfo* info)
original_scope_(NULL),
target_stack_(NULL),
compile_options_(info->compile_options()),
- cached_parse_data_(NULL),
+ cached_parse_data_(nullptr),
total_preparse_skipped_(0),
pre_parse_timer_(NULL),
parsing_on_main_thread_(true) {
@@ -669,7 +668,8 @@ Parser::Parser(ParseInfo* info)
? FunctionLiteral::kShouldLazyCompile
: FunctionLiteral::kShouldEagerCompile);
set_allow_lazy(FLAG_lazy && info->allow_lazy_parsing() &&
- !info->is_native() && info->extension() == nullptr);
+ !info->is_native() && info->extension() == nullptr &&
+ can_compile_lazily);
set_allow_natives(FLAG_allow_natives_syntax || info->is_native());
set_allow_tailcalls(FLAG_harmony_tailcalls && !info->is_native() &&
info->isolate()->is_tail_call_elimination_enabled());
« no previous file with comments | « src/parsing/parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698