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

Unified Diff: src/parser.h

Issue 1102523003: Implement a 'trial parse' step, that will abort pre-parsing excessively (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/parser.cc » ('j') | src/parser.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « no previous file | src/parser.cc » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698