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

Side by Side Diff: src/parser.cc

Issue 27174002: Remove deprecated v8::preparser namespace. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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') | src/preparser.h » ('j') | 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4344 matching lines...) Expand 10 before | Expand all | Expand 10 after
4355 expected_property_count = entry.property_count(); 4355 expected_property_count = entry.property_count();
4356 top_scope_->SetLanguageMode(entry.language_mode()); 4356 top_scope_->SetLanguageMode(entry.language_mode());
4357 } else { 4357 } else {
4358 is_lazily_compiled = false; 4358 is_lazily_compiled = false;
4359 } 4359 }
4360 } else { 4360 } else {
4361 // With no preparser data, we partially parse the function, without 4361 // With no preparser data, we partially parse the function, without
4362 // building an AST. This gathers the data needed to build a lazy 4362 // building an AST. This gathers the data needed to build a lazy
4363 // function. 4363 // function.
4364 SingletonLogger logger; 4364 SingletonLogger logger;
4365 preparser::PreParser::PreParseResult result = 4365 PreParser::PreParseResult result = LazyParseFunctionLiteral(&logger);
4366 LazyParseFunctionLiteral(&logger); 4366 if (result == PreParser::kPreParseStackOverflow) {
4367 if (result == preparser::PreParser::kPreParseStackOverflow) {
4368 // Propagate stack overflow. 4367 // Propagate stack overflow.
4369 stack_overflow_ = true; 4368 stack_overflow_ = true;
4370 *ok = false; 4369 *ok = false;
4371 return NULL; 4370 return NULL;
4372 } 4371 }
4373 if (logger.has_error()) { 4372 if (logger.has_error()) {
4374 const char* arg = logger.argument_opt(); 4373 const char* arg = logger.argument_opt();
4375 Vector<const char*> args; 4374 Vector<const char*> args;
4376 if (arg != NULL) { 4375 if (arg != NULL) {
4377 args = Vector<const char*>(&arg, 1); 4376 args = Vector<const char*>(&arg, 1);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
4514 generator); 4513 generator);
4515 function_literal->set_function_token_position(function_token_position); 4514 function_literal->set_function_token_position(function_token_position);
4516 function_literal->set_ast_properties(&ast_properties); 4515 function_literal->set_ast_properties(&ast_properties);
4517 function_literal->set_dont_optimize_reason(dont_optimize_reason); 4516 function_literal->set_dont_optimize_reason(dont_optimize_reason);
4518 4517
4519 if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal); 4518 if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal);
4520 return function_literal; 4519 return function_literal;
4521 } 4520 }
4522 4521
4523 4522
4524 preparser::PreParser::PreParseResult Parser::LazyParseFunctionLiteral( 4523 PreParser::PreParseResult Parser::LazyParseFunctionLiteral(
4525 SingletonLogger* logger) { 4524 SingletonLogger* logger) {
4526 HistogramTimerScope preparse_scope(isolate()->counters()->pre_parse()); 4525 HistogramTimerScope preparse_scope(isolate()->counters()->pre_parse());
4527 ASSERT_EQ(Token::LBRACE, scanner().current_token()); 4526 ASSERT_EQ(Token::LBRACE, scanner().current_token());
4528 4527
4529 if (reusable_preparser_ == NULL) { 4528 if (reusable_preparser_ == NULL) {
4530 intptr_t stack_limit = isolate()->stack_guard()->real_climit(); 4529 intptr_t stack_limit = isolate()->stack_guard()->real_climit();
4531 reusable_preparser_ = new preparser::PreParser(&scanner_, 4530 reusable_preparser_ = new PreParser(&scanner_, NULL, stack_limit);
4532 NULL,
4533 stack_limit);
4534 reusable_preparser_->set_allow_harmony_scoping(allow_harmony_scoping()); 4531 reusable_preparser_->set_allow_harmony_scoping(allow_harmony_scoping());
4535 reusable_preparser_->set_allow_modules(allow_modules()); 4532 reusable_preparser_->set_allow_modules(allow_modules());
4536 reusable_preparser_->set_allow_natives_syntax(allow_natives_syntax()); 4533 reusable_preparser_->set_allow_natives_syntax(allow_natives_syntax());
4537 reusable_preparser_->set_allow_lazy(true); 4534 reusable_preparser_->set_allow_lazy(true);
4538 reusable_preparser_->set_allow_generators(allow_generators()); 4535 reusable_preparser_->set_allow_generators(allow_generators());
4539 reusable_preparser_->set_allow_for_of(allow_for_of()); 4536 reusable_preparser_->set_allow_for_of(allow_for_of());
4540 reusable_preparser_->set_allow_harmony_numeric_literals( 4537 reusable_preparser_->set_allow_harmony_numeric_literals(
4541 allow_harmony_numeric_literals()); 4538 allow_harmony_numeric_literals());
4542 } 4539 }
4543 preparser::PreParser::PreParseResult result = 4540 PreParser::PreParseResult result =
4544 reusable_preparser_->PreParseLazyFunction(top_scope_->language_mode(), 4541 reusable_preparser_->PreParseLazyFunction(top_scope_->language_mode(),
4545 is_generator(), 4542 is_generator(),
4546 logger); 4543 logger);
4547 return result; 4544 return result;
4548 } 4545 }
4549 4546
4550 4547
4551 Expression* Parser::ParseV8Intrinsic(bool* ok) { 4548 Expression* Parser::ParseV8Intrinsic(bool* ok) {
4552 // CallRuntime :: 4549 // CallRuntime ::
4553 // '%' Identifier Arguments 4550 // '%' Identifier Arguments
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
5796 } 5793 }
5797 5794
5798 5795
5799 // Create a Scanner for the preparser to use as input, and preparse the source. 5796 // Create a Scanner for the preparser to use as input, and preparse the source.
5800 ScriptDataImpl* PreParserApi::PreParse(Isolate* isolate, 5797 ScriptDataImpl* PreParserApi::PreParse(Isolate* isolate,
5801 Utf16CharacterStream* source) { 5798 Utf16CharacterStream* source) {
5802 CompleteParserRecorder recorder; 5799 CompleteParserRecorder recorder;
5803 HistogramTimerScope timer(isolate->counters()->pre_parse()); 5800 HistogramTimerScope timer(isolate->counters()->pre_parse());
5804 Scanner scanner(isolate->unicode_cache()); 5801 Scanner scanner(isolate->unicode_cache());
5805 intptr_t stack_limit = isolate->stack_guard()->real_climit(); 5802 intptr_t stack_limit = isolate->stack_guard()->real_climit();
5806 preparser::PreParser preparser(&scanner, &recorder, stack_limit); 5803 PreParser preparser(&scanner, &recorder, stack_limit);
5807 preparser.set_allow_lazy(true); 5804 preparser.set_allow_lazy(true);
5808 preparser.set_allow_generators(FLAG_harmony_generators); 5805 preparser.set_allow_generators(FLAG_harmony_generators);
5809 preparser.set_allow_for_of(FLAG_harmony_iteration); 5806 preparser.set_allow_for_of(FLAG_harmony_iteration);
5810 preparser.set_allow_harmony_scoping(FLAG_harmony_scoping); 5807 preparser.set_allow_harmony_scoping(FLAG_harmony_scoping);
5811 preparser.set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals); 5808 preparser.set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals);
5812 scanner.Initialize(source); 5809 scanner.Initialize(source);
5813 preparser::PreParser::PreParseResult result = preparser.PreParseProgram(); 5810 PreParser::PreParseResult result = preparser.PreParseProgram();
5814 if (result == preparser::PreParser::kPreParseStackOverflow) { 5811 if (result == PreParser::kPreParseStackOverflow) {
5815 isolate->StackOverflow(); 5812 isolate->StackOverflow();
5816 return NULL; 5813 return NULL;
5817 } 5814 }
5818 5815
5819 // Extract the accumulated data from the recorder as a single 5816 // Extract the accumulated data from the recorder as a single
5820 // contiguous vector that we are responsible for disposing. 5817 // contiguous vector that we are responsible for disposing.
5821 Vector<unsigned> store = recorder.ExtractData(); 5818 Vector<unsigned> store = recorder.ExtractData();
5822 return new ScriptDataImpl(store); 5819 return new ScriptDataImpl(store);
5823 } 5820 }
5824 5821
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
5872 ASSERT(info()->isolate()->has_pending_exception()); 5869 ASSERT(info()->isolate()->has_pending_exception());
5873 } else { 5870 } else {
5874 result = ParseProgram(); 5871 result = ParseProgram();
5875 } 5872 }
5876 } 5873 }
5877 info()->SetFunction(result); 5874 info()->SetFunction(result);
5878 return (result != NULL); 5875 return (result != NULL);
5879 } 5876 }
5880 5877
5881 } } // namespace v8::internal 5878 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.h ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698