OLD | NEW |
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_PARSER_H_ | 5 #ifndef V8_PARSING_PARSER_H_ |
6 #define V8_PARSING_PARSER_H_ | 6 #define V8_PARSING_PARSER_H_ |
7 | 7 |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/parsing/parser-base.h" | 10 #include "src/parsing/parser-base.h" |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 | 503 |
504 Statement* BuildAssertIsCoercible(Variable* var); | 504 Statement* BuildAssertIsCoercible(Variable* var); |
505 | 505 |
506 // Factory methods. | 506 // Factory methods. |
507 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super, | 507 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super, |
508 int pos, int end_pos, | 508 int pos, int end_pos, |
509 LanguageMode language_mode); | 509 LanguageMode language_mode); |
510 | 510 |
511 // Skip over a lazy function, either using cached data if we have it, or | 511 // Skip over a lazy function, either using cached data if we have it, or |
512 // by parsing the function with PreParser. Consumes the ending }. | 512 // by parsing the function with PreParser. Consumes the ending }. |
513 // | 513 // If may_abort == true, the (pre-)parser may decide to abort skipping |
514 // If bookmark is set, the (pre-)parser may decide to abort skipping | |
515 // in order to force the function to be eagerly parsed, after all. | 514 // in order to force the function to be eagerly parsed, after all. |
516 // In this case, it'll reset the scanner using the bookmark. | 515 LazyParsingResult SkipLazyFunctionBody(int* materialized_literal_count, |
517 void SkipLazyFunctionBody(int* materialized_literal_count, | 516 int* expected_property_count, |
518 int* expected_property_count, bool* ok, | 517 bool may_abort, bool* ok); |
519 Scanner::BookmarkScope* bookmark = nullptr); | |
520 | 518 |
521 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( | 519 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( |
522 SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr); | 520 SingletonLogger* logger, bool may_abort); |
523 | 521 |
524 Block* BuildParameterInitializationBlock( | 522 Block* BuildParameterInitializationBlock( |
525 const ParserFormalParameters& parameters, bool* ok); | 523 const ParserFormalParameters& parameters, bool* ok); |
526 Block* BuildRejectPromiseOnException(Block* block, bool* ok); | 524 Block* BuildRejectPromiseOnException(Block* block, bool* ok); |
527 | 525 |
528 // Consumes the ending }. | 526 // Consumes the ending }. |
529 ZoneList<Statement*>* ParseEagerFunctionBody( | 527 ZoneList<Statement*>* ParseEagerFunctionBody( |
530 const AstRawString* function_name, int pos, | 528 const AstRawString* function_name, int pos, |
531 const ParserFormalParameters& parameters, FunctionKind kind, | 529 const ParserFormalParameters& parameters, FunctionKind kind, |
532 FunctionLiteral::FunctionType function_type, bool* ok); | 530 FunctionLiteral::FunctionType function_type, bool* ok); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 V8_INLINE static FunctionLiteral* EmptyFunctionLiteral() { return nullptr; } | 840 V8_INLINE static FunctionLiteral* EmptyFunctionLiteral() { return nullptr; } |
843 | 841 |
844 V8_INLINE static bool IsEmptyExpression(Expression* expr) { | 842 V8_INLINE static bool IsEmptyExpression(Expression* expr) { |
845 return expr == nullptr; | 843 return expr == nullptr; |
846 } | 844 } |
847 | 845 |
848 // Used in error return values. | 846 // Used in error return values. |
849 V8_INLINE static ZoneList<Expression*>* NullExpressionList() { | 847 V8_INLINE static ZoneList<Expression*>* NullExpressionList() { |
850 return nullptr; | 848 return nullptr; |
851 } | 849 } |
| 850 V8_INLINE static ZoneList<Statement*>* NullStatementList() { return nullptr; } |
852 | 851 |
853 // Non-NULL empty string. | 852 // Non-NULL empty string. |
854 V8_INLINE const AstRawString* EmptyIdentifierString() const { | 853 V8_INLINE const AstRawString* EmptyIdentifierString() const { |
855 return ast_value_factory()->empty_string(); | 854 return ast_value_factory()->empty_string(); |
856 } | 855 } |
857 | 856 |
858 // Odd-ball literal creators. | 857 // Odd-ball literal creators. |
859 V8_INLINE Literal* GetLiteralTheHole(int position) { | 858 V8_INLINE Literal* GetLiteralTheHole(int position) { |
860 return factory()->NewTheHoleLiteral(kNoSourcePosition); | 859 return factory()->NewTheHoleLiteral(kNoSourcePosition); |
861 } | 860 } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 static const int kLiteralTypeSlot = 0; | 1049 static const int kLiteralTypeSlot = 0; |
1051 static const int kElementsSlot = 1; | 1050 static const int kElementsSlot = 1; |
1052 | 1051 |
1053 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 1052 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
1054 }; | 1053 }; |
1055 | 1054 |
1056 } // namespace internal | 1055 } // namespace internal |
1057 } // namespace v8 | 1056 } // namespace v8 |
1058 | 1057 |
1059 #endif // V8_PARSING_PARSER_H_ | 1058 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |