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

Side by Side 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: The Great Rebase Adventure. 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/parser.cc » ('j') | src/preparser.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_PARSER_H_ 5 #ifndef V8_PARSER_H_
6 #define V8_PARSER_H_ 6 #define V8_PARSER_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/compiler.h" // TODO(titzer): remove this include dependency 10 #include "src/compiler.h" // TODO(titzer): remove this include dependency
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 Scope* scope, Expression* params, const Scanner::Location& params_loc, 766 Scope* scope, Expression* params, const Scanner::Location& params_loc,
767 FormalParameterErrorLocations* error_locs, bool* is_rest, bool* ok); 767 FormalParameterErrorLocations* error_locs, bool* is_rest, bool* ok);
768 768
769 // Temporary glue; these functions will move to ParserBase. 769 // Temporary glue; these functions will move to ParserBase.
770 Expression* ParseV8Intrinsic(bool* ok); 770 Expression* ParseV8Intrinsic(bool* ok);
771 FunctionLiteral* ParseFunctionLiteral( 771 FunctionLiteral* ParseFunctionLiteral(
772 const AstRawString* name, Scanner::Location function_name_location, 772 const AstRawString* name, Scanner::Location function_name_location,
773 bool name_is_strict_reserved, FunctionKind kind, 773 bool name_is_strict_reserved, FunctionKind kind,
774 int function_token_position, FunctionLiteral::FunctionType type, 774 int function_token_position, FunctionLiteral::FunctionType type,
775 FunctionLiteral::ArityRestriction arity_restriction, bool* ok); 775 FunctionLiteral::ArityRestriction arity_restriction, bool* ok);
776 V8_INLINE void SkipLazyFunctionBody(int* materialized_literal_count, 776 V8_INLINE void SkipLazyFunctionBody(
777 int* expected_property_count, bool* ok); 777 int* materialized_literal_count, int* expected_property_count, bool* ok,
778 Scanner::BookmarkScope* bookmark = nullptr);
778 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody( 779 V8_INLINE ZoneList<Statement*>* ParseEagerFunctionBody(
779 const AstRawString* name, int pos, Variable* fvar, 780 const AstRawString* name, int pos, Variable* fvar,
780 Token::Value fvar_init_op, FunctionKind kind, bool* ok); 781 Token::Value fvar_init_op, FunctionKind kind, bool* ok);
781 782
782 ClassLiteral* ParseClassLiteral(const AstRawString* name, 783 ClassLiteral* ParseClassLiteral(const AstRawString* name,
783 Scanner::Location class_name_location, 784 Scanner::Location class_name_location,
784 bool name_is_strict_reserved, int pos, 785 bool name_is_strict_reserved, int pos,
785 bool* ok); 786 bool* ok);
786 787
787 V8_INLINE void CheckConflictingVarDeclarations(v8::internal::Scope* scope, 788 V8_INLINE void CheckConflictingVarDeclarations(v8::internal::Scope* scope,
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok); 1018 IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok);
1018 1019
1019 void AddAssertIsConstruct(ZoneList<Statement*>* body, int pos); 1020 void AddAssertIsConstruct(ZoneList<Statement*>* body, int pos);
1020 1021
1021 // Factory methods. 1022 // Factory methods.
1022 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos, 1023 FunctionLiteral* DefaultConstructor(bool call_super, Scope* scope, int pos,
1023 int end_pos); 1024 int end_pos);
1024 1025
1025 // Skip over a lazy function, either using cached data if we have it, or 1026 // Skip over a lazy function, either using cached data if we have it, or
1026 // by parsing the function with PreParser. Consumes the ending }. 1027 // by parsing the function with PreParser. Consumes the ending }.
1028 //
1029 // If bookmark is set, the (pre-)parser may decide to abort skipping
1030 // in order to force the function to be eagerly parsed, after all.
1031 // In this case, it'll reset the scanner using the bookmark.
1027 void SkipLazyFunctionBody(int* materialized_literal_count, 1032 void SkipLazyFunctionBody(int* materialized_literal_count,
1028 int* expected_property_count, 1033 int* expected_property_count, bool* ok,
1029 bool* ok); 1034 Scanner::BookmarkScope* bookmark = nullptr);
1030 1035
1031 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( 1036 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser(
1032 SingletonLogger* logger); 1037 SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr);
1033 1038
1034 // Consumes the ending }. 1039 // Consumes the ending }.
1035 ZoneList<Statement*>* ParseEagerFunctionBody( 1040 ZoneList<Statement*>* ParseEagerFunctionBody(
1036 const AstRawString* function_name, int pos, Variable* fvar, 1041 const AstRawString* function_name, int pos, Variable* fvar,
1037 Token::Value fvar_init_op, FunctionKind kind, bool* ok); 1042 Token::Value fvar_init_op, FunctionKind kind, bool* ok);
1038 1043
1039 void ThrowPendingError(Isolate* isolate, Handle<Script> script); 1044 void ThrowPendingError(Isolate* isolate, Handle<Script> script);
1040 1045
1041 TemplateLiteralState OpenTemplateLiteral(int pos); 1046 TemplateLiteralState OpenTemplateLiteral(int pos);
1042 void AddTemplateSpan(TemplateLiteralState* state, bool tail); 1047 void AddTemplateSpan(TemplateLiteralState* state, bool tail);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 return parser_->NewScope(parent_scope, scope_type, kind); 1088 return parser_->NewScope(parent_scope, scope_type, kind);
1084 } 1089 }
1085 1090
1086 1091
1087 const AstRawString* ParserTraits::EmptyIdentifierString() { 1092 const AstRawString* ParserTraits::EmptyIdentifierString() {
1088 return parser_->ast_value_factory()->empty_string(); 1093 return parser_->ast_value_factory()->empty_string();
1089 } 1094 }
1090 1095
1091 1096
1092 void ParserTraits::SkipLazyFunctionBody(int* materialized_literal_count, 1097 void ParserTraits::SkipLazyFunctionBody(int* materialized_literal_count,
1093 int* expected_property_count, 1098 int* expected_property_count, bool* ok,
1094 bool* ok) { 1099 Scanner::BookmarkScope* bookmark) {
1095 return parser_->SkipLazyFunctionBody( 1100 return parser_->SkipLazyFunctionBody(materialized_literal_count,
1096 materialized_literal_count, expected_property_count, ok); 1101 expected_property_count, ok, bookmark);
1097 } 1102 }
1098 1103
1099 1104
1100 ZoneList<Statement*>* ParserTraits::ParseEagerFunctionBody( 1105 ZoneList<Statement*>* ParserTraits::ParseEagerFunctionBody(
1101 const AstRawString* name, int pos, Variable* fvar, 1106 const AstRawString* name, int pos, Variable* fvar,
1102 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { 1107 Token::Value fvar_init_op, FunctionKind kind, bool* ok) {
1103 return parser_->ParseEagerFunctionBody(name, pos, fvar, fvar_init_op, kind, 1108 return parser_->ParseEagerFunctionBody(name, pos, fvar, fvar_init_op, kind,
1104 ok); 1109 ok);
1105 } 1110 }
1106 1111
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 } 1179 }
1175 1180
1176 1181
1177 Expression* ParserTraits::SpreadCallNew( 1182 Expression* ParserTraits::SpreadCallNew(
1178 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) { 1183 Expression* function, ZoneList<v8::internal::Expression*>* args, int pos) {
1179 return parser_->SpreadCallNew(function, args, pos); 1184 return parser_->SpreadCallNew(function, args, pos);
1180 } 1185 }
1181 } } // namespace v8::internal 1186 } } // namespace v8::internal
1182 1187
1183 #endif // V8_PARSER_H_ 1188 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | src/parser.cc » ('j') | src/preparser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698