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

Unified Diff: src/ast/ast-numbering.cc

Issue 2664083002: [ignition] desugar async functions/generators/modules in BytecodeGenerator
Patch Set: get rid of lambdas, for better or worse.. Created 3 years, 10 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
Index: src/ast/ast-numbering.cc
diff --git a/src/ast/ast-numbering.cc b/src/ast/ast-numbering.cc
index 001911fcef78776f979d51bb6faf346f67b4c2b1..689148d62b156fcb348e776c083ce503747b5c99 100644
--- a/src/ast/ast-numbering.cc
+++ b/src/ast/ast-numbering.cc
@@ -664,15 +664,42 @@ bool AstNumberingVisitor::Renumber(FunctionLiteral* node) {
if (IsResumableFunction(node->kind())) {
DisableFullCodegenAndCrankshaft(kGenerator);
+
+ if (IsAsyncFunction(node->kind())) {
+ // Set initial catch_prediction to HandlerTable::ASYNC_AWAIT for the
+ // wrapper try/catch block not present in the AST.
+ catch_prediction_ = HandlerTable::ASYNC_AWAIT;
+ }
}
if (IsClassConstructor(node->kind())) {
DisableFullCodegenAndCrankshaft(kClassConstructorFunction);
}
+ if (scope->is_function_scope()) {
+ Variable* function_var = scope->function_var();
+ if (function_var != nullptr && !function_var->IsUnallocated()) {
+ // Initialization of local function-named variable is no longer part of
+ // the AST, and this initialization is not handled in full-codegen or
+ // crankshaft.
+ DisableFullCodegenAndCrankshaft(kNoReason);
+ }
+ }
+
+ if (IsGeneratorFunction(node->kind()) || scope->is_module_scope()) {
+ // Generator functions and Modules have an initial yield which is not
+ // included in the AST.
+ DCHECK_EQ(0, yield_count_);
+ yield_count_ = 1;
+ }
+
LanguageModeScope language_mode_scope(this, node->language_mode());
VisitDeclarations(scope->declarations());
+ if (node->parameter_init_block() != nullptr) {
+ DisableFullCodegenAndCrankshaft(kNonSimpleParameters);
+ VisitBlock(node->parameter_init_block());
+ }
VisitStatements(node->body());
node->set_ast_properties(&properties_);

Powered by Google App Engine
This is Rietveld 408576698