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

Side by Side Diff: src/parser.cc

Issue 222123003: Parser cleanup: PreParser doesn't need to produce symbol data any more. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 8 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 | « no previous file | src/preparse-data.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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 731
732 Handle<String> ParserTraits::GetSymbol(Scanner* scanner) { 732 Handle<String> ParserTraits::GetSymbol(Scanner* scanner) {
733 if (parser_->cached_data_mode() == CONSUME_CACHED_DATA) { 733 if (parser_->cached_data_mode() == CONSUME_CACHED_DATA) {
734 int symbol_id = (*parser_->cached_data())->GetSymbolIdentifier(); 734 int symbol_id = (*parser_->cached_data())->GetSymbolIdentifier();
735 // If there is no symbol data, -1 will be returned. 735 // If there is no symbol data, -1 will be returned.
736 if (symbol_id >= 0 && 736 if (symbol_id >= 0 &&
737 symbol_id < (*parser_->cached_data())->symbol_count()) { 737 symbol_id < (*parser_->cached_data())->symbol_count()) {
738 return parser_->LookupCachedSymbol(symbol_id); 738 return parser_->LookupCachedSymbol(symbol_id);
739 } 739 }
740 } else if (parser_->cached_data_mode() == PRODUCE_CACHED_DATA) { 740 } else if (parser_->cached_data_mode() == PRODUCE_CACHED_DATA) {
741 if (parser_->log_->ShouldLogSymbols()) { 741 // Parser is never used inside lazy functions (it falls back to PreParser
742 parser_->scanner()->LogSymbol(parser_->log_, parser_->position()); 742 // instead), so we can produce the symbol data unconditionally.
743 } 743 parser_->scanner()->LogSymbol(parser_->log_, parser_->position());
744 } 744 }
745 Handle<String> result = 745 Handle<String> result =
746 parser_->scanner()->AllocateInternalizedString(parser_->isolate()); 746 parser_->scanner()->AllocateInternalizedString(parser_->isolate());
747 ASSERT(!result.is_null()); 747 ASSERT(!result.is_null());
748 return result; 748 return result;
749 } 749 }
750 750
751 751
752 Handle<String> ParserTraits::NextLiteralString(Scanner* scanner, 752 Handle<String> ParserTraits::NextLiteralString(Scanner* scanner,
753 PretenureFlag tenured) { 753 PretenureFlag tenured) {
(...skipping 2659 matching lines...) Expand 10 before | Expand all | Expand 10 after
3413 scope_->SetStrictMode(entry.strict_mode()); 3413 scope_->SetStrictMode(entry.strict_mode());
3414 } else { 3414 } else {
3415 // This case happens when we have preparse data but it doesn't contain 3415 // This case happens when we have preparse data but it doesn't contain
3416 // an entry for the function. Fail the compilation. 3416 // an entry for the function. Fail the compilation.
3417 ReportInvalidCachedData(function_name, CHECK_OK); 3417 ReportInvalidCachedData(function_name, CHECK_OK);
3418 } 3418 }
3419 } else { 3419 } else {
3420 // With no cached data, we partially parse the function, without 3420 // With no cached data, we partially parse the function, without
3421 // building an AST. This gathers the data needed to build a lazy 3421 // building an AST. This gathers the data needed to build a lazy
3422 // function. 3422 // function.
3423 // FIXME(marja): Now the PreParser doesn't need to log functions /
3424 // symbols; only errors -> clean that up.
3425 SingletonLogger logger; 3423 SingletonLogger logger;
3426 PreParser::PreParseResult result = LazyParseFunctionLiteral(&logger); 3424 PreParser::PreParseResult result = LazyParseFunctionLiteral(&logger);
3427 if (result == PreParser::kPreParseStackOverflow) { 3425 if (result == PreParser::kPreParseStackOverflow) {
3428 // Propagate stack overflow. 3426 // Propagate stack overflow.
3429 set_stack_overflow(); 3427 set_stack_overflow();
3430 *ok = false; 3428 *ok = false;
3431 return NULL; 3429 return NULL;
3432 } 3430 }
3433 if (logger.has_error()) { 3431 if (logger.has_error()) {
3434 const char* arg = logger.argument_opt(); 3432 const char* arg = logger.argument_opt();
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
4671 ASSERT(info()->isolate()->has_pending_exception()); 4669 ASSERT(info()->isolate()->has_pending_exception());
4672 } else { 4670 } else {
4673 result = ParseProgram(); 4671 result = ParseProgram();
4674 } 4672 }
4675 } 4673 }
4676 info()->SetFunction(result); 4674 info()->SetFunction(result);
4677 return (result != NULL); 4675 return (result != NULL);
4678 } 4676 }
4679 4677
4680 } } // namespace v8::internal 4678 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/preparse-data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698