From e1a5abb6c8d5c5d643dd9a64dcf87b750dced713 Mon Sep 17 00:00:00 2001 From: "marja@chromium.org" Date: Wed, 1 Oct 2014 16:54:42 +0000 Subject: [PATCH] Debug a mystery crash bug in script streaming. This adds a bunch of checks so we hopefully get more detailed information about what exactly goes wrong. R=jochen@chromium.org BUG= Review URL: https://codereview.chromium.org/619583005 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24373 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/parser.cc | 13 +++++++++++++ src/parser.h | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/parser.cc b/src/parser.cc index 9d1a40d..ed04d24 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -807,6 +807,7 @@ FunctionLiteral* Parser::ParseProgram() { // Initialize parser state. CompleteParserRecorder recorder; + debug_saved_compile_options_ = compile_options(); if (compile_options() == ScriptCompiler::kProduceParserCache) { log_ = &recorder; } else if (compile_options() == ScriptCompiler::kConsumeParserCache) { @@ -3702,6 +3703,17 @@ void Parser::SkipLazyFunctionBody(const AstRawString* function_name, int* materialized_literal_count, int* expected_property_count, bool* ok) { + // Temporary debugging code for tracking down a mystery crash which should + // never happen. The crash happens on the line where we log the function in + // the preparse data: log_->LogFunction(...). TODO(marja): remove this once + // done. + CHECK(materialized_literal_count); + CHECK(expected_property_count); + CHECK(debug_saved_compile_options_ == compile_options()); + if (compile_options() == ScriptCompiler::kProduceParserCache) { + CHECK(log_); + } + int function_block_pos = position(); if (compile_options() == ScriptCompiler::kConsumeParserCache) { // If we have cached data, we use it to skip parsing the function body. The @@ -4926,6 +4938,7 @@ void Parser::ParseOnBackground() { fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); CompleteParserRecorder recorder; + debug_saved_compile_options_ = compile_options(); if (compile_options() == ScriptCompiler::kProduceParserCache) { log_ = &recorder; } diff --git a/src/parser.h b/src/parser.h index 40886f6..5cbb19a 100644 --- a/src/parser.h +++ b/src/parser.h @@ -850,6 +850,10 @@ class Parser : public ParserBase { int use_counts_[v8::Isolate::kUseCounterFeatureCount]; int total_preparse_skipped_; HistogramTimer* pre_parse_timer_; + + // Temporary; for debugging. See Parser::SkipLazyFunctionBody. TODO(marja): + // remove this once done. + ScriptCompiler::CompileOptions debug_saved_compile_options_; }; -- 2.7.4