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

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

Issue 2233923003: Desugar async/await to create the resulting Promise upfront (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Better approach for bailing out on stack overflow in the appropriate place in fullcodegen Created 4 years, 4 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
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/allocation.h" 8 #include "src/allocation.h"
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 // In this case, it'll reset the scanner using the bookmark. 1115 // In this case, it'll reset the scanner using the bookmark.
1116 void SkipLazyFunctionBody(int* materialized_literal_count, 1116 void SkipLazyFunctionBody(int* materialized_literal_count,
1117 int* expected_property_count, bool* ok, 1117 int* expected_property_count, bool* ok,
1118 Scanner::BookmarkScope* bookmark = nullptr); 1118 Scanner::BookmarkScope* bookmark = nullptr);
1119 1119
1120 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( 1120 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser(
1121 SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr); 1121 SingletonLogger* logger, Scanner::BookmarkScope* bookmark = nullptr);
1122 1122
1123 Block* BuildParameterInitializationBlock( 1123 Block* BuildParameterInitializationBlock(
1124 const ParserFormalParameters& parameters, bool* ok); 1124 const ParserFormalParameters& parameters, bool* ok);
1125 Block* BuildRejectPromiseOnException(Block* block); 1125 Block* BuildRejectPromiseOnException(Block* block, bool* ok);
1126 1126
1127 // Consumes the ending }. 1127 // Consumes the ending }.
1128 ZoneList<Statement*>* ParseEagerFunctionBody( 1128 ZoneList<Statement*>* ParseEagerFunctionBody(
1129 const AstRawString* function_name, int pos, 1129 const AstRawString* function_name, int pos,
1130 const ParserFormalParameters& parameters, FunctionKind kind, 1130 const ParserFormalParameters& parameters, FunctionKind kind,
1131 FunctionLiteral::FunctionType function_type, bool* ok); 1131 FunctionLiteral::FunctionType function_type, bool* ok);
1132 1132
1133 void ThrowPendingError(Isolate* isolate, Handle<Script> script); 1133 void ThrowPendingError(Isolate* isolate, Handle<Script> script);
1134 1134
1135 TemplateLiteralState OpenTemplateLiteral(int pos); 1135 TemplateLiteralState OpenTemplateLiteral(int pos);
(...skipping 25 matching lines...) Expand all
1161 1161
1162 friend class NonPatternRewriter; 1162 friend class NonPatternRewriter;
1163 V8_INLINE Expression* RewriteSpreads(ArrayLiteral* lit); 1163 V8_INLINE Expression* RewriteSpreads(ArrayLiteral* lit);
1164 1164
1165 V8_INLINE void RewriteNonPattern(ExpressionClassifier* classifier, bool* ok); 1165 V8_INLINE void RewriteNonPattern(ExpressionClassifier* classifier, bool* ok);
1166 1166
1167 friend class InitializerRewriter; 1167 friend class InitializerRewriter;
1168 void RewriteParameterInitializer(Expression* expr, Scope* scope); 1168 void RewriteParameterInitializer(Expression* expr, Scope* scope);
1169 1169
1170 Expression* BuildCreateJSGeneratorObject(int pos, FunctionKind kind); 1170 Expression* BuildCreateJSGeneratorObject(int pos, FunctionKind kind);
1171 Expression* BuildPromiseResolve(Expression* value, int pos); 1171 Expression* BuildResolvePromise(Expression* value, int pos);
1172 Expression* BuildPromiseReject(Expression* value, int pos); 1172 Expression* BuildRejectPromise(Expression* value, int pos);
1173 VariableProxy* BuildDotPromise();
1174 VariableProxy* BuildDebugIsActive();
1173 1175
1174 Scanner scanner_; 1176 Scanner scanner_;
1175 PreParser* reusable_preparser_; 1177 PreParser* reusable_preparser_;
1176 Scope* original_scope_; // for ES5 function declarations in sloppy eval 1178 Scope* original_scope_; // for ES5 function declarations in sloppy eval
1177 Target* target_stack_; // for break, continue statements 1179 Target* target_stack_; // for break, continue statements
1178 ScriptCompiler::CompileOptions compile_options_; 1180 ScriptCompiler::CompileOptions compile_options_;
1179 ParseData* cached_parse_data_; 1181 ParseData* cached_parse_data_;
1180 1182
1181 PendingCompilationErrorHandler pending_error_handler_; 1183 PendingCompilationErrorHandler pending_error_handler_;
1182 1184
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 1353
1352 void ParserTraits::AddParameterInitializationBlock( 1354 void ParserTraits::AddParameterInitializationBlock(
1353 const ParserFormalParameters& parameters, 1355 const ParserFormalParameters& parameters,
1354 ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok) { 1356 ZoneList<v8::internal::Statement*>* body, bool is_async, bool* ok) {
1355 if (!parameters.is_simple) { 1357 if (!parameters.is_simple) {
1356 auto* init_block = 1358 auto* init_block =
1357 parser_->BuildParameterInitializationBlock(parameters, ok); 1359 parser_->BuildParameterInitializationBlock(parameters, ok);
1358 if (!*ok) return; 1360 if (!*ok) return;
1359 1361
1360 if (is_async) { 1362 if (is_async) {
1361 init_block = parser_->BuildRejectPromiseOnException(init_block); 1363 init_block = parser_->BuildRejectPromiseOnException(init_block, ok);
1364 if (!*ok) return;
1362 } 1365 }
1363 1366
1364 if (init_block != nullptr) { 1367 if (init_block != nullptr) {
1365 body->Add(init_block, parser_->zone()); 1368 body->Add(init_block, parser_->zone());
1366 } 1369 }
1367 } 1370 }
1368 } 1371 }
1369 1372
1370 Expression* ParserTraits::ParseAsyncFunctionExpression(bool* ok) { 1373 Expression* ParserTraits::ParseAsyncFunctionExpression(bool* ok) {
1371 return parser_->ParseAsyncFunctionExpression(ok); 1374 return parser_->ParseAsyncFunctionExpression(ok);
1372 } 1375 }
1373 1376
1374 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { 1377 DoExpression* ParserTraits::ParseDoExpression(bool* ok) {
1375 return parser_->ParseDoExpression(ok); 1378 return parser_->ParseDoExpression(ok);
1376 } 1379 }
1377 1380
1378 1381
1379 } // namespace internal 1382 } // namespace internal
1380 } // namespace v8 1383 } // namespace v8
1381 1384
1382 #endif // V8_PARSING_PARSER_H_ 1385 #endif // V8_PARSING_PARSER_H_
OLDNEW
« src/full-codegen/full-codegen.cc ('K') | « src/js/promise.js ('k') | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698