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

Side by Side Diff: src/parsing/preparser.cc

Issue 2424013002: Add support to trace preparsing decisions (Closed)
Patch Set: Created 4 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
« no previous file with comments | « src/parsing/parser.cc ('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 // 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 <cmath> 5 #include <cmath>
6 6
7 #include "src/allocation.h" 7 #include "src/allocation.h"
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/conversions-inl.h" 9 #include "src/conversions-inl.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 language_mode = function_scope->language_mode(); 170 language_mode = function_scope->language_mode();
171 171
172 // Validate name and parameter names. We can do this only after parsing the 172 // Validate name and parameter names. We can do this only after parsing the
173 // function, since the function can declare itself strict. 173 // function, since the function can declare itself strict.
174 CheckFunctionName(language_mode, function_name, function_name_validity, 174 CheckFunctionName(language_mode, function_name, function_name_validity,
175 function_name_location, CHECK_OK); 175 function_name_location, CHECK_OK);
176 const bool allow_duplicate_parameters = 176 const bool allow_duplicate_parameters =
177 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); 177 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind);
178 ValidateFormalParameters(language_mode, allow_duplicate_parameters, CHECK_OK); 178 ValidateFormalParameters(language_mode, allow_duplicate_parameters, CHECK_OK);
179 179
180 int end_position = scanner()->location().end_pos;
180 if (is_strict(language_mode)) { 181 if (is_strict(language_mode)) {
181 int end_position = scanner()->location().end_pos;
182 CheckStrictOctalLiteral(start_position, end_position, CHECK_OK); 182 CheckStrictOctalLiteral(start_position, end_position, CHECK_OK);
183 CheckDecimalLiteralWithLeadingZero(start_position, end_position); 183 CheckDecimalLiteralWithLeadingZero(start_position, end_position);
184 } 184 }
185 function_scope->set_end_position(end_position);
186
187 if (FLAG_trace_preparse) {
188 PrintF(" [%s]: %i-%i\n",
189 track_unresolved_variables_ ? "Preparse resolution"
190 : "Preparse no-resolution",
191 function_scope->start_position(), function_scope->end_position());
192 }
185 193
186 return Expression::Default(); 194 return Expression::Default();
187 } 195 }
188 196
189 PreParser::LazyParsingResult PreParser::ParseStatementListAndLogFunction( 197 PreParser::LazyParsingResult PreParser::ParseStatementListAndLogFunction(
190 bool may_abort, bool* ok) { 198 bool may_abort, bool* ok) {
191 int body_start = position(); 199 int body_start = position();
192 PreParserStatementList body; 200 PreParserStatementList body;
193 LazyParsingResult result = ParseStatementList( 201 LazyParsingResult result = ParseStatementList(
194 body, Token::RBRACE, may_abort, CHECK_OK_VALUE(kLazyParsingComplete)); 202 body, Token::RBRACE, may_abort, CHECK_OK_VALUE(kLazyParsingComplete));
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 254 }
247 } 255 }
248 } 256 }
249 257
250 #undef CHECK_OK 258 #undef CHECK_OK
251 #undef CHECK_OK_CUSTOM 259 #undef CHECK_OK_CUSTOM
252 260
253 261
254 } // namespace internal 262 } // namespace internal
255 } // namespace v8 263 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698