| OLD | NEW | 
|---|
| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 188       runtime_call_stats_, | 188       runtime_call_stats_, | 
| 189       counters[track_unresolved_variables_][parsing_on_main_thread_]); | 189       counters[track_unresolved_variables_][parsing_on_main_thread_]); | 
| 190 | 190 | 
| 191   // Parse function body. | 191   // Parse function body. | 
| 192   PreParserStatementList body; | 192   PreParserStatementList body; | 
| 193   DeclarationScope* function_scope = NewFunctionScope(kind); | 193   DeclarationScope* function_scope = NewFunctionScope(kind); | 
| 194   function_scope->SetLanguageMode(language_mode); | 194   function_scope->SetLanguageMode(language_mode); | 
| 195   FunctionState function_state(&function_state_, &scope_state_, function_scope); | 195   FunctionState function_state(&function_state_, &scope_state_, function_scope); | 
| 196   DuplicateFinder duplicate_finder(scanner()->unicode_cache()); | 196   DuplicateFinder duplicate_finder(scanner()->unicode_cache()); | 
| 197   ExpressionClassifier formals_classifier(this, &duplicate_finder); | 197   ExpressionClassifier formals_classifier(this, &duplicate_finder); | 
|  | 198   GetNextFunctionLiteralNum(); | 
| 198 | 199 | 
| 199   Expect(Token::LPAREN, CHECK_OK); | 200   Expect(Token::LPAREN, CHECK_OK); | 
| 200   int start_position = scanner()->location().beg_pos; | 201   int start_position = scanner()->location().beg_pos; | 
| 201   function_scope->set_start_position(start_position); | 202   function_scope->set_start_position(start_position); | 
| 202   PreParserFormalParameters formals(function_scope); | 203   PreParserFormalParameters formals(function_scope); | 
| 203   ParseFormalParameterList(&formals, CHECK_OK); | 204   ParseFormalParameterList(&formals, CHECK_OK); | 
| 204   Expect(Token::RPAREN, CHECK_OK); | 205   Expect(Token::RPAREN, CHECK_OK); | 
| 205   int formals_end_position = scanner()->location().end_pos; | 206   int formals_end_position = scanner()->location().end_pos; | 
| 206 | 207 | 
| 207   CheckArityRestrictions(formals.arity, kind, formals.has_rest, start_position, | 208   CheckArityRestrictions(formals.arity, kind, formals.has_rest, start_position, | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
| 235                                        : "Preparse no-resolution", | 236                                        : "Preparse no-resolution", | 
| 236            function_scope->start_position(), function_scope->end_position()); | 237            function_scope->start_position(), function_scope->end_position()); | 
| 237   } | 238   } | 
| 238 | 239 | 
| 239   return Expression::Default(); | 240   return Expression::Default(); | 
| 240 } | 241 } | 
| 241 | 242 | 
| 242 PreParser::LazyParsingResult PreParser::ParseStatementListAndLogFunction( | 243 PreParser::LazyParsingResult PreParser::ParseStatementListAndLogFunction( | 
| 243     PreParserFormalParameters* formals, bool has_duplicate_parameters, | 244     PreParserFormalParameters* formals, bool has_duplicate_parameters, | 
| 244     bool may_abort, bool* ok) { | 245     bool may_abort, bool* ok) { | 
|  | 246   ResetFunctionLiteralNum(); | 
|  | 247 | 
| 245   PreParserStatementList body; | 248   PreParserStatementList body; | 
| 246   LazyParsingResult result = ParseStatementList( | 249   LazyParsingResult result = ParseStatementList( | 
| 247       body, Token::RBRACE, may_abort, CHECK_OK_VALUE(kLazyParsingComplete)); | 250       body, Token::RBRACE, may_abort, CHECK_OK_VALUE(kLazyParsingComplete)); | 
| 248   if (result == kLazyParsingAborted) return result; | 251   if (result == kLazyParsingAborted) return result; | 
| 249 | 252 | 
| 250   // Position right after terminal '}'. | 253   // Position right after terminal '}'. | 
| 251   DCHECK_EQ(Token::RBRACE, scanner()->peek()); | 254   DCHECK_EQ(Token::RBRACE, scanner()->peek()); | 
| 252   int body_end = scanner()->peek_location().end_pos; | 255   int body_end = scanner()->peek_location().end_pos; | 
| 253   DCHECK(this->scope()->is_function_scope()); | 256   DCHECK(this->scope()->is_function_scope()); | 
| 254   log_.LogFunction(body_end, formals->num_parameters(), | 257   log_.LogFunction(body_end, formals->num_parameters(), | 
| 255                    formals->function_length, has_duplicate_parameters, | 258                    formals->function_length, has_duplicate_parameters, | 
| 256                    function_state_->materialized_literal_count(), | 259                    function_state_->materialized_literal_count(), | 
| 257                    function_state_->expected_property_count()); | 260                    function_state_->expected_property_count(), | 
|  | 261                    GetNextFunctionLiteralNum() - 1); | 
| 258   return kLazyParsingComplete; | 262   return kLazyParsingComplete; | 
| 259 } | 263 } | 
| 260 | 264 | 
| 261 PreParserExpression PreParser::ExpressionFromIdentifier( | 265 PreParserExpression PreParser::ExpressionFromIdentifier( | 
| 262     PreParserIdentifier name, int start_position, InferName infer) { | 266     PreParserIdentifier name, int start_position, InferName infer) { | 
| 263   if (track_unresolved_variables_) { | 267   if (track_unresolved_variables_) { | 
| 264     AstNodeFactory factory(ast_value_factory()); | 268     AstNodeFactory factory(ast_value_factory()); | 
| 265     // Setting the Zone is necessary because zone_ might be the temp Zone, and | 269     // Setting the Zone is necessary because zone_ might be the temp Zone, and | 
| 266     // AstValueFactory doesn't know about it. | 270     // AstValueFactory doesn't know about it. | 
| 267     factory.set_zone(zone()); | 271     factory.set_zone(zone()); | 
| (...skipping 29 matching lines...) Expand all  Loading... | 
| 297     } | 301     } | 
| 298   } | 302   } | 
| 299 } | 303 } | 
| 300 | 304 | 
| 301 #undef CHECK_OK | 305 #undef CHECK_OK | 
| 302 #undef CHECK_OK_CUSTOM | 306 #undef CHECK_OK_CUSTOM | 
| 303 | 307 | 
| 304 | 308 | 
| 305 }  // namespace internal | 309 }  // namespace internal | 
| 306 }  // namespace v8 | 310 }  // namespace v8 | 
| OLD | NEW | 
|---|