| Index: src/parser.cc
|
| diff --git a/src/parser.cc b/src/parser.cc
|
| index 63556cf9d4a643a979f15530a0204326503206f5..0301e40851d5c4da1f09b77ed0728517762fe997 100644
|
| --- a/src/parser.cc
|
| +++ b/src/parser.cc
|
| @@ -202,7 +202,6 @@ int ParseData::FunctionCount() {
|
|
|
|
|
| bool ParseData::IsSane() {
|
| - if (!IsAligned(script_data_->length(), sizeof(unsigned))) return false;
|
| // Check that the header data is valid and doesn't specify
|
| // point to positions outside the store.
|
| int data_length = Length();
|
| @@ -257,7 +256,7 @@ void Parser::SetCachedData() {
|
| } else {
|
| DCHECK(info_->cached_data() != NULL);
|
| if (compile_options() == ScriptCompiler::kConsumeParserCache) {
|
| - cached_parse_data_ = ParseData::FromCachedData(*info_->cached_data());
|
| + cached_parse_data_ = new ParseData(*info_->cached_data());
|
| }
|
| }
|
| }
|
| @@ -842,9 +841,9 @@ FunctionLiteral* Parser::ParseProgram() {
|
| CompleteParserRecorder recorder;
|
|
|
| debug_saved_compile_options_ = compile_options();
|
| - if (produce_cached_parse_data()) {
|
| + if (compile_options() == ScriptCompiler::kProduceParserCache) {
|
| log_ = &recorder;
|
| - } else if (consume_cached_parse_data()) {
|
| + } else if (compile_options() == ScriptCompiler::kConsumeParserCache) {
|
| cached_parse_data_->Initialize();
|
| }
|
|
|
| @@ -885,7 +884,7 @@ FunctionLiteral* Parser::ParseProgram() {
|
| }
|
| PrintF(" - took %0.3f ms]\n", ms);
|
| }
|
| - if (produce_cached_parse_data()) {
|
| + if (compile_options() == ScriptCompiler::kProduceParserCache) {
|
| if (result != NULL) *info_->cached_data() = recorder.GetScriptData();
|
| log_ = NULL;
|
| }
|
| @@ -3754,10 +3753,12 @@ void Parser::SkipLazyFunctionBody(const AstRawString* function_name,
|
| CHECK(materialized_literal_count);
|
| CHECK(expected_property_count);
|
| CHECK(debug_saved_compile_options_ == compile_options());
|
| - if (produce_cached_parse_data()) CHECK(log_);
|
| + if (compile_options() == ScriptCompiler::kProduceParserCache) {
|
| + CHECK(log_);
|
| + }
|
|
|
| int function_block_pos = position();
|
| - if (consume_cached_parse_data()) {
|
| + if (compile_options() == ScriptCompiler::kConsumeParserCache) {
|
| // If we have cached data, we use it to skip parsing the function body. The
|
| // data contains the information we need to construct the lazy function.
|
| FunctionEntry entry =
|
| @@ -3805,7 +3806,7 @@ void Parser::SkipLazyFunctionBody(const AstRawString* function_name,
|
| *materialized_literal_count = logger.literals();
|
| *expected_property_count = logger.properties();
|
| scope_->SetStrictMode(logger.strict_mode());
|
| - if (produce_cached_parse_data()) {
|
| + if (compile_options() == ScriptCompiler::kProduceParserCache) {
|
| DCHECK(log_);
|
| // Position right after terminal '}'.
|
| int body_end = scanner()->location().end_pos;
|
| @@ -4981,7 +4982,9 @@ void Parser::ParseOnBackground() {
|
|
|
| CompleteParserRecorder recorder;
|
| debug_saved_compile_options_ = compile_options();
|
| - if (produce_cached_parse_data()) log_ = &recorder;
|
| + if (compile_options() == ScriptCompiler::kProduceParserCache) {
|
| + log_ = &recorder;
|
| + }
|
|
|
| DCHECK(info()->source_stream() != NULL);
|
| ExternalStreamingStream stream(info()->source_stream(),
|
| @@ -5009,7 +5012,7 @@ void Parser::ParseOnBackground() {
|
| // We cannot internalize on a background thread; a foreground task will take
|
| // care of calling Parser::Internalize just before compilation.
|
|
|
| - if (produce_cached_parse_data()) {
|
| + if (compile_options() == ScriptCompiler::kProduceParserCache) {
|
| if (result != NULL) *info_->cached_data() = recorder.GetScriptData();
|
| log_ = NULL;
|
| }
|
|
|