Index: src/parser.h |
diff --git a/src/parser.h b/src/parser.h |
index 8d557aed53eca468795303c536bbd17252890551..e99bbae9f58ea01ca87630114eb772cffc2905e2 100644 |
--- a/src/parser.h |
+++ b/src/parser.h |
@@ -756,9 +756,10 @@ class ParserTraits { |
bool name_is_strict_reserved, FunctionKind kind, |
int function_token_position, FunctionLiteral::FunctionType type, |
FunctionLiteral::ArityRestriction arity_restriction, bool* ok); |
- V8_INLINE void SkipLazyFunctionBody(const AstRawString* name, |
- int* materialized_literal_count, |
- int* expected_property_count, bool* ok); |
+ V8_INLINE void SkipLazyFunctionBody( |
+ const AstRawString* name, int* materialized_literal_count, |
+ int* expected_property_count, bool* ok, |
+ Scanner::BookmarkScope* bookmark = nullptr); |
V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( |
const AstRawString* name, int pos, Variable* fvar, |
Token::Value fvar_init_op, FunctionKind kind, bool* ok); |
@@ -1008,13 +1009,17 @@ class Parser : public ParserBase<ParserTraits> { |
// Skip over a lazy function, either using cached data if we have it, or |
// by parsing the function with PreParser. Consumes the ending }. |
+ // |
+ // If bookmark is set, the (pre-)parser may decide to abort skipping |
+ // in order to force the function to be eagerly parsed, after all. |
+ // In this case, it'll reset the scanner using the bookmark. |
void SkipLazyFunctionBody(const AstRawString* function_name, |
int* materialized_literal_count, |
- int* expected_property_count, |
- bool* ok); |
+ int* expected_property_count, bool* ok, |
+ Scanner::BookmarkScope* bookmark = nullptr); |
PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( |
- SingletonLogger* logger); |
+ SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr); |
// Consumes the ending }. |
ZoneList<Statement*>* ParseEagerFunctionBody( |
@@ -1078,10 +1083,11 @@ const AstRawString* ParserTraits::EmptyIdentifierString() { |
void ParserTraits::SkipLazyFunctionBody(const AstRawString* function_name, |
int* materialized_literal_count, |
- int* expected_property_count, |
- bool* ok) { |
- return parser_->SkipLazyFunctionBody( |
- function_name, materialized_literal_count, expected_property_count, ok); |
+ int* expected_property_count, bool* ok, |
+ Scanner::BookmarkScope* bookmark) { |
+ return parser_->SkipLazyFunctionBody(function_name, |
+ materialized_literal_count, |
+ expected_property_count, ok, bookmark); |
} |