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

Side by Side Diff: src/preparser.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 | « src/preparser.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 int end_pos, 81 int end_pos,
82 const char* type, 82 const char* type,
83 const char* name_opt, 83 const char* name_opt,
84 bool is_reference_error) { 84 bool is_reference_error) {
85 pre_parser_->log_->LogMessage(start_pos, end_pos, type, name_opt, 85 pre_parser_->log_->LogMessage(start_pos, end_pos, type, name_opt,
86 is_reference_error); 86 is_reference_error);
87 } 87 }
88 88
89 89
90 PreParserIdentifier PreParserTraits::GetSymbol(Scanner* scanner) { 90 PreParserIdentifier PreParserTraits::GetSymbol(Scanner* scanner) {
91 pre_parser_->LogSymbol();
92 if (scanner->current_token() == Token::FUTURE_RESERVED_WORD) { 91 if (scanner->current_token() == Token::FUTURE_RESERVED_WORD) {
93 return PreParserIdentifier::FutureReserved(); 92 return PreParserIdentifier::FutureReserved();
94 } else if (scanner->current_token() == 93 } else if (scanner->current_token() ==
95 Token::FUTURE_STRICT_RESERVED_WORD) { 94 Token::FUTURE_STRICT_RESERVED_WORD) {
96 return PreParserIdentifier::FutureStrictReserved(); 95 return PreParserIdentifier::FutureStrictReserved();
97 } else if (scanner->current_token() == Token::YIELD) { 96 } else if (scanner->current_token() == Token::YIELD) {
98 return PreParserIdentifier::Yield(); 97 return PreParserIdentifier::Yield();
99 } 98 }
100 if (scanner->UnescapedLiteralMatches("eval", 4)) { 99 if (scanner->UnescapedLiteralMatches("eval", 4)) {
101 return PreParserIdentifier::Eval(); 100 return PreParserIdentifier::Eval();
102 } 101 }
103 if (scanner->UnescapedLiteralMatches("arguments", 9)) { 102 if (scanner->UnescapedLiteralMatches("arguments", 9)) {
104 return PreParserIdentifier::Arguments(); 103 return PreParserIdentifier::Arguments();
105 } 104 }
106 return PreParserIdentifier::Default(); 105 return PreParserIdentifier::Default();
107 } 106 }
108 107
109 108
110 PreParserExpression PreParserTraits::ExpressionFromString( 109 PreParserExpression PreParserTraits::ExpressionFromString(
111 int pos, Scanner* scanner, PreParserFactory* factory) { 110 int pos, Scanner* scanner, PreParserFactory* factory) {
112 pre_parser_->LogSymbol();
113 if (scanner->UnescapedLiteralMatches("use strict", 10)) { 111 if (scanner->UnescapedLiteralMatches("use strict", 10)) {
114 return PreParserExpression::UseStrictStringLiteral(); 112 return PreParserExpression::UseStrictStringLiteral();
115 } 113 }
116 return PreParserExpression::StringLiteral(); 114 return PreParserExpression::StringLiteral();
117 } 115 }
118 116
119 117
120 PreParserExpression PreParserTraits::ParseV8Intrinsic(bool* ok) { 118 PreParserExpression PreParserTraits::ParseV8Intrinsic(bool* ok) {
121 return pre_parser_->ParseV8Intrinsic(ok); 119 return pre_parser_->ParseV8Intrinsic(ok);
122 } 120 }
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 int end_position = scanner()->location().end_pos; 923 int end_position = scanner()->location().end_pos;
926 CheckOctalLiteral(start_position, end_position, CHECK_OK); 924 CheckOctalLiteral(start_position, end_position, CHECK_OK);
927 } 925 }
928 926
929 return Expression::Default(); 927 return Expression::Default();
930 } 928 }
931 929
932 930
933 void PreParser::ParseLazyFunctionLiteralBody(bool* ok) { 931 void PreParser::ParseLazyFunctionLiteralBody(bool* ok) {
934 int body_start = position(); 932 int body_start = position();
935 bool is_logging = log_->ShouldLogSymbols();
936 if (is_logging) log_->PauseRecording();
937 ParseSourceElements(Token::RBRACE, ok); 933 ParseSourceElements(Token::RBRACE, ok);
938 if (is_logging) log_->ResumeRecording();
939 if (!*ok) return; 934 if (!*ok) return;
940 935
941 // Position right after terminal '}'. 936 // Position right after terminal '}'.
942 ASSERT_EQ(Token::RBRACE, scanner()->peek()); 937 ASSERT_EQ(Token::RBRACE, scanner()->peek());
943 int body_end = scanner()->peek_location().end_pos; 938 int body_end = scanner()->peek_location().end_pos;
944 log_->LogFunction(body_start, body_end, 939 log_->LogFunction(body_start, body_end,
945 function_state_->materialized_literal_count(), 940 function_state_->materialized_literal_count(),
946 function_state_->expected_property_count(), 941 function_state_->expected_property_count(),
947 strict_mode()); 942 strict_mode());
948 } 943 }
(...skipping 10 matching lines...) Expand all
959 // Allow "eval" or "arguments" for backward compatibility. 954 // Allow "eval" or "arguments" for backward compatibility.
960 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK); 955 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK);
961 ParseArguments(ok); 956 ParseArguments(ok);
962 957
963 return Expression::Default(); 958 return Expression::Default();
964 } 959 }
965 960
966 #undef CHECK_OK 961 #undef CHECK_OK
967 962
968 963
969 void PreParser::LogSymbol() {
970 if (log_->ShouldLogSymbols()) {
971 scanner()->LogSymbol(log_, position());
972 }
973 }
974
975
976 } } // v8::internal 964 } } // v8::internal
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698