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

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

Issue 2297733002: [parser] Refactor bookmark in SkipLazyFunctionBody (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | src/parsing/parser.cc » ('j') | src/parsing/parser.cc » ('J')
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_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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 Statement* BuildAssertIsCoercible(Variable* var); 537 Statement* BuildAssertIsCoercible(Variable* var);
538 538
539 // Factory methods. 539 // Factory methods.
540 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super, 540 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super,
541 int pos, int end_pos, 541 int pos, int end_pos,
542 LanguageMode language_mode); 542 LanguageMode language_mode);
543 543
544 // Skip over a lazy function, either using cached data if we have it, or 544 // Skip over a lazy function, either using cached data if we have it, or
545 // by parsing the function with PreParser. Consumes the ending }. 545 // by parsing the function with PreParser. Consumes the ending }.
546 // 546 //
547 // If bookmark is set, the (pre-)parser may decide to abort skipping 547 // If may_abort == true, the (pre-)parser may decide to abort skipping
548 // in order to force the function to be eagerly parsed, after all. 548 // in order to force the function to be eagerly parsed, after all.
adamk 2016/08/30 22:13:14 Mention when it'll return true vs false? I was sur
nickie 2016/08/31 13:23:36 Done.
549 // In this case, it'll reset the scanner using the bookmark. 549 bool SkipLazyFunctionBody(int* materialized_literal_count,
550 void SkipLazyFunctionBody(int* materialized_literal_count, 550 int* expected_property_count, bool may_abort,
551 int* expected_property_count, bool* ok, 551 bool* ok);
552 Scanner::BookmarkScope* bookmark = nullptr);
553 552
554 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( 553 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser(
555 SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr); 554 SingletonLogger* logger, bool may_abort);
556 555
557 Block* BuildParameterInitializationBlock( 556 Block* BuildParameterInitializationBlock(
558 const ParserFormalParameters& parameters, bool* ok); 557 const ParserFormalParameters& parameters, bool* ok);
559 Block* BuildRejectPromiseOnException(Block* block, bool* ok); 558 Block* BuildRejectPromiseOnException(Block* block, bool* ok);
560 559
561 // Consumes the ending }. 560 // Consumes the ending }.
562 ZoneList<Statement*>* ParseEagerFunctionBody( 561 ZoneList<Statement*>* ParseEagerFunctionBody(
563 const AstRawString* function_name, int pos, 562 const AstRawString* function_name, int pos,
564 const ParserFormalParameters& parameters, FunctionKind kind, 563 const ParserFormalParameters& parameters, FunctionKind kind,
565 FunctionLiteral::FunctionType function_type, bool* ok); 564 FunctionLiteral::FunctionType function_type, bool* ok);
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 V8_INLINE static Literal* EmptyLiteral() { return nullptr; } 870 V8_INLINE static Literal* EmptyLiteral() { return nullptr; }
872 V8_INLINE static ObjectLiteralProperty* EmptyObjectLiteralProperty() { 871 V8_INLINE static ObjectLiteralProperty* EmptyObjectLiteralProperty() {
873 return nullptr; 872 return nullptr;
874 } 873 }
875 V8_INLINE static FunctionLiteral* EmptyFunctionLiteral() { return nullptr; } 874 V8_INLINE static FunctionLiteral* EmptyFunctionLiteral() { return nullptr; }
876 875
877 // Used in error return values. 876 // Used in error return values.
878 V8_INLINE static ZoneList<Expression*>* NullExpressionList() { 877 V8_INLINE static ZoneList<Expression*>* NullExpressionList() {
879 return nullptr; 878 return nullptr;
880 } 879 }
880 V8_INLINE static ZoneList<Statement*>* NullStatementList() {
881 return nullptr;
882 }
881 883
882 // Non-NULL empty string. 884 // Non-NULL empty string.
883 V8_INLINE const AstRawString* EmptyIdentifierString() const { 885 V8_INLINE const AstRawString* EmptyIdentifierString() const {
884 return ast_value_factory()->empty_string(); 886 return ast_value_factory()->empty_string();
885 } 887 }
886 888
887 // Odd-ball literal creators. 889 // Odd-ball literal creators.
888 V8_INLINE Literal* GetLiteralTheHole(int position) { 890 V8_INLINE Literal* GetLiteralTheHole(int position) {
889 return factory()->NewTheHoleLiteral(kNoSourcePosition); 891 return factory()->NewTheHoleLiteral(kNoSourcePosition);
890 } 892 }
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 static const int kLiteralTypeSlot = 0; 1081 static const int kLiteralTypeSlot = 0;
1080 static const int kElementsSlot = 1; 1082 static const int kElementsSlot = 1;
1081 1083
1082 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); 1084 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue);
1083 }; 1085 };
1084 1086
1085 } // namespace internal 1087 } // namespace internal
1086 } // namespace v8 1088 } // namespace v8
1087 1089
1088 #endif // V8_PARSING_PARSER_H_ 1090 #endif // V8_PARSING_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | src/parsing/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698