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

Side by Side Diff: src/parser.cc

Issue 619583005: Debug a mystery crash bug in script streaming. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: code review (jochen) Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/parser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 isolate()->counters()->total_parse_size()->Increment(source->length()); 800 isolate()->counters()->total_parse_size()->Increment(source->length());
801 base::ElapsedTimer timer; 801 base::ElapsedTimer timer;
802 if (FLAG_trace_parse) { 802 if (FLAG_trace_parse) {
803 timer.Start(); 803 timer.Start();
804 } 804 }
805 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); 805 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone());
806 806
807 // Initialize parser state. 807 // Initialize parser state.
808 CompleteParserRecorder recorder; 808 CompleteParserRecorder recorder;
809 809
810 debug_saved_compile_options_ = compile_options();
810 if (compile_options() == ScriptCompiler::kProduceParserCache) { 811 if (compile_options() == ScriptCompiler::kProduceParserCache) {
811 log_ = &recorder; 812 log_ = &recorder;
812 } else if (compile_options() == ScriptCompiler::kConsumeParserCache) { 813 } else if (compile_options() == ScriptCompiler::kConsumeParserCache) {
813 cached_parse_data_->Initialize(); 814 cached_parse_data_->Initialize();
814 } 815 }
815 816
816 source = String::Flatten(source); 817 source = String::Flatten(source);
817 FunctionLiteral* result; 818 FunctionLiteral* result;
818 819
819 Scope* top_scope = NULL; 820 Scope* top_scope = NULL;
(...skipping 2875 matching lines...) Expand 10 before | Expand all | Expand 10 after
3695 3696
3696 if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal); 3697 if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal);
3697 return function_literal; 3698 return function_literal;
3698 } 3699 }
3699 3700
3700 3701
3701 void Parser::SkipLazyFunctionBody(const AstRawString* function_name, 3702 void Parser::SkipLazyFunctionBody(const AstRawString* function_name,
3702 int* materialized_literal_count, 3703 int* materialized_literal_count,
3703 int* expected_property_count, 3704 int* expected_property_count,
3704 bool* ok) { 3705 bool* ok) {
3706 // Temporary debugging code for tracking down a mystery crash which should
3707 // never happen. The crash happens on the line where we log the function in
3708 // the preparse data: log_->LogFunction(...). TODO(marja): remove this once
3709 // done.
3710 CHECK(materialized_literal_count);
3711 CHECK(expected_property_count);
3712 CHECK(debug_saved_compile_options_ == compile_options());
3713 if (compile_options() == ScriptCompiler::kProduceParserCache) {
3714 CHECK(log_);
3715 }
3716
3705 int function_block_pos = position(); 3717 int function_block_pos = position();
3706 if (compile_options() == ScriptCompiler::kConsumeParserCache) { 3718 if (compile_options() == ScriptCompiler::kConsumeParserCache) {
3707 // If we have cached data, we use it to skip parsing the function body. The 3719 // If we have cached data, we use it to skip parsing the function body. The
3708 // data contains the information we need to construct the lazy function. 3720 // data contains the information we need to construct the lazy function.
3709 FunctionEntry entry = 3721 FunctionEntry entry =
3710 cached_parse_data_->GetFunctionEntry(function_block_pos); 3722 cached_parse_data_->GetFunctionEntry(function_block_pos);
3711 // Check that cached data is valid. 3723 // Check that cached data is valid.
3712 CHECK(entry.is_valid()); 3724 CHECK(entry.is_valid());
3713 // End position greater than end of stream is safe, and hard to check. 3725 // End position greater than end of stream is safe, and hard to check.
3714 CHECK(entry.end_pos() > function_block_pos); 3726 CHECK(entry.end_pos() > function_block_pos);
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
4919 return (result != NULL); 4931 return (result != NULL);
4920 } 4932 }
4921 4933
4922 4934
4923 void Parser::ParseOnBackground() { 4935 void Parser::ParseOnBackground() {
4924 DCHECK(info()->function() == NULL); 4936 DCHECK(info()->function() == NULL);
4925 FunctionLiteral* result = NULL; 4937 FunctionLiteral* result = NULL;
4926 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); 4938 fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone());
4927 4939
4928 CompleteParserRecorder recorder; 4940 CompleteParserRecorder recorder;
4941 debug_saved_compile_options_ = compile_options();
4929 if (compile_options() == ScriptCompiler::kProduceParserCache) { 4942 if (compile_options() == ScriptCompiler::kProduceParserCache) {
4930 log_ = &recorder; 4943 log_ = &recorder;
4931 } 4944 }
4932 4945
4933 DCHECK(info()->source_stream() != NULL); 4946 DCHECK(info()->source_stream() != NULL);
4934 ExternalStreamingStream stream(info()->source_stream(), 4947 ExternalStreamingStream stream(info()->source_stream(),
4935 info()->source_stream_encoding()); 4948 info()->source_stream_encoding());
4936 scanner_.Initialize(&stream); 4949 scanner_.Initialize(&stream);
4937 DCHECK(info()->context().is_null() || info()->context()->IsNativeContext()); 4950 DCHECK(info()->context().is_null() || info()->context()->IsNativeContext());
4938 4951
(...skipping 16 matching lines...) Expand all
4955 4968
4956 // We cannot internalize on a background thread; a foreground task will take 4969 // We cannot internalize on a background thread; a foreground task will take
4957 // care of calling Parser::Internalize just before compilation. 4970 // care of calling Parser::Internalize just before compilation.
4958 4971
4959 if (compile_options() == ScriptCompiler::kProduceParserCache) { 4972 if (compile_options() == ScriptCompiler::kProduceParserCache) {
4960 if (result != NULL) *info_->cached_data() = recorder.GetScriptData(); 4973 if (result != NULL) *info_->cached_data() = recorder.GetScriptData();
4961 log_ = NULL; 4974 log_ = NULL;
4962 } 4975 }
4963 } 4976 }
4964 } } // namespace v8::internal 4977 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698