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

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

Issue 2479213002: [parser] Only track parsing-mode (and possibly switch to the preparser) in the parser (Closed)
Patch Set: addressed comments Created 4 years, 1 month 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-base.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_PARSING_PREPARSER_H 5 #ifndef V8_PARSING_PREPARSER_H
6 #define V8_PARSING_PREPARSER_H 6 #define V8_PARSING_PREPARSER_H
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/parsing/parser-base.h" 9 #include "src/parsing/parser-base.h"
10 10
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 // All ParseXXX functions take as the last argument an *ok parameter 904 // All ParseXXX functions take as the last argument an *ok parameter
905 // which is set to false if parsing failed; it is unchanged otherwise. 905 // which is set to false if parsing failed; it is unchanged otherwise.
906 // By making the 'exception handling' explicit, we are forced to check 906 // By making the 'exception handling' explicit, we are forced to check
907 // for failure at the call sites. 907 // for failure at the call sites.
908 908
909 V8_INLINE PreParserStatementList ParseEagerFunctionBody( 909 V8_INLINE PreParserStatementList ParseEagerFunctionBody(
910 PreParserIdentifier function_name, int pos, 910 PreParserIdentifier function_name, int pos,
911 const PreParserFormalParameters& parameters, FunctionKind kind, 911 const PreParserFormalParameters& parameters, FunctionKind kind,
912 FunctionLiteral::FunctionType function_type, bool* ok); 912 FunctionLiteral::FunctionType function_type, bool* ok);
913 913
914 // Indicates that we won't switch from the preparser to the preparser; we'll
915 // just stay where we are.
914 bool AllowsLazyParsingWithoutUnresolvedVariables() const { return false; } 916 bool AllowsLazyParsingWithoutUnresolvedVariables() const { return false; }
917 bool parse_lazily() const { return false; }
915 918
916 V8_INLINE LazyParsingResult SkipFunction( 919 V8_INLINE LazyParsingResult SkipFunction(
917 FunctionKind kind, DeclarationScope* function_scope, int* num_parameters, 920 FunctionKind kind, DeclarationScope* function_scope, int* num_parameters,
918 int* function_length, bool* has_duplicate_parameters, 921 int* function_length, bool* has_duplicate_parameters,
919 int* materialized_literal_count, int* expected_property_count, 922 int* materialized_literal_count, int* expected_property_count,
920 bool is_inner_function, bool may_abort, bool* ok) { 923 bool is_inner_function, bool may_abort, bool* ok) {
921 UNREACHABLE(); 924 UNREACHABLE();
922 return kLazyParsingComplete; 925 return kLazyParsingComplete;
923 } 926 }
924 Expression ParseFunctionLiteral( 927 Expression ParseFunctionLiteral(
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 PreParserExpression PreParser::SpreadCallNew(PreParserExpression function, 1519 PreParserExpression PreParser::SpreadCallNew(PreParserExpression function,
1517 PreParserExpressionList args, 1520 PreParserExpressionList args,
1518 int pos) { 1521 int pos) {
1519 return factory()->NewCallNew(function, args, pos); 1522 return factory()->NewCallNew(function, args, pos);
1520 } 1523 }
1521 1524
1522 PreParserStatementList PreParser::ParseEagerFunctionBody( 1525 PreParserStatementList PreParser::ParseEagerFunctionBody(
1523 PreParserIdentifier function_name, int pos, 1526 PreParserIdentifier function_name, int pos,
1524 const PreParserFormalParameters& parameters, FunctionKind kind, 1527 const PreParserFormalParameters& parameters, FunctionKind kind,
1525 FunctionLiteral::FunctionType function_type, bool* ok) { 1528 FunctionLiteral::FunctionType function_type, bool* ok) {
1526 ParsingModeScope parsing_mode(this, PARSE_EAGERLY);
1527 PreParserStatementList result; 1529 PreParserStatementList result;
1528 1530
1529 Scope* inner_scope = scope(); 1531 Scope* inner_scope = scope();
1530 if (!parameters.is_simple) inner_scope = NewScope(BLOCK_SCOPE); 1532 if (!parameters.is_simple) inner_scope = NewScope(BLOCK_SCOPE);
1531 1533
1532 { 1534 {
1533 BlockState block_state(&scope_state_, inner_scope); 1535 BlockState block_state(&scope_state_, inner_scope);
1534 ParseStatementList(result, Token::RBRACE, ok); 1536 ParseStatementList(result, Token::RBRACE, ok);
1535 if (!*ok) return PreParserStatementList(); 1537 if (!*ok) return PreParserStatementList();
1536 } 1538 }
(...skipping 11 matching lines...) Expand all
1548 function_state_->NextMaterializedLiteralIndex(); 1550 function_state_->NextMaterializedLiteralIndex();
1549 function_state_->NextMaterializedLiteralIndex(); 1551 function_state_->NextMaterializedLiteralIndex();
1550 } 1552 }
1551 return EmptyExpression(); 1553 return EmptyExpression();
1552 } 1554 }
1553 1555
1554 } // namespace internal 1556 } // namespace internal
1555 } // namespace v8 1557 } // namespace v8
1556 1558
1557 #endif // V8_PARSING_PREPARSER_H 1559 #endif // V8_PARSING_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698