Reviewers: jochen (slow for reviews),

Message:
jochen, ptal.

Description:
Defensive programming for Parser::ParseOnBackground.

Apparently it sometimes happens that log_ is NULL in
Parser::SkipLazyFunctionBody in the branch which uses it. It should be
impossible: ParseOnBackground sets log_ correctly if the compile option says it
should produce parser cache, and SkipLazyFunctionBody reads the same option
before using log_. However, checking the NULL-ity of log_ instead of checking the option is more correct coding anyway (the logic is simpler, and it's easier
to see the correctness of the code locally without following the option
logic).

BUG=chromium:418749
LOG=n

Please review this at https://codereview.chromium.org/619633002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+1, -2 lines):
  M src/parser.cc


Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 9d1a40d39b9ebb7b47730b4f287d0abcca684276..149859acc7ad497b3bc99b1b96cc01e183b9b33c 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -3751,8 +3751,7 @@ void Parser::SkipLazyFunctionBody(const AstRawString* function_name,
     *materialized_literal_count = logger.literals();
     *expected_property_count = logger.properties();
     scope_->SetStrictMode(logger.strict_mode());
-    if (compile_options() == ScriptCompiler::kProduceParserCache) {
-      DCHECK(log_);
+    if (log_) {
       // Position right after terminal '}'.
       int body_end = scanner()->location().end_pos;
       log_->LogFunction(function_block_pos, body_end,


--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to