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

Side by Side Diff: src/ast/ast-numbering.cc

Issue 2654423004: [async-functions] support await expressions in finally statements (Closed)
Patch Set: Get everything working (except possibly inspector tests) 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 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 #include "src/ast/ast-numbering.h" 5 #include "src/ast/ast-numbering.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 IncrementNodeCount(); 212 IncrementNodeCount();
213 Visit(node->expression()); 213 Visit(node->expression());
214 } 214 }
215 215
216 216
217 void AstNumberingVisitor::VisitYield(Yield* node) { 217 void AstNumberingVisitor::VisitYield(Yield* node) {
218 node->set_yield_id(yield_count_); 218 node->set_yield_id(yield_count_);
219 yield_count_++; 219 yield_count_++;
220 IncrementNodeCount(); 220 IncrementNodeCount();
221 node->set_base_id(ReserveIdRange(Yield::num_ids())); 221 node->set_base_id(ReserveIdRange(Yield::num_ids()));
222 Visit(node->generator_object());
223 Visit(node->expression()); 222 Visit(node->expression());
224 } 223 }
225 224
226 225
227 void AstNumberingVisitor::VisitThrow(Throw* node) { 226 void AstNumberingVisitor::VisitThrow(Throw* node) {
228 IncrementNodeCount(); 227 IncrementNodeCount();
229 node->set_base_id(ReserveIdRange(Throw::num_ids())); 228 node->set_base_id(ReserveIdRange(Throw::num_ids()));
230 Visit(node->exception()); 229 Visit(node->exception());
231 } 230 }
232 231
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 413 }
415 414
416 void AstNumberingVisitor::VisitGetIterator(GetIterator* node) { 415 void AstNumberingVisitor::VisitGetIterator(GetIterator* node) {
417 IncrementNodeCount(); 416 IncrementNodeCount();
418 DisableFullCodegenAndCrankshaft(kGetIterator); 417 DisableFullCodegenAndCrankshaft(kGetIterator);
419 node->set_base_id(ReserveIdRange(GetIterator::num_ids())); 418 node->set_base_id(ReserveIdRange(GetIterator::num_ids()));
420 Visit(node->iterable()); 419 Visit(node->iterable());
421 ReserveFeedbackSlots(node); 420 ReserveFeedbackSlots(node);
422 } 421 }
423 422
423 void AstNumberingVisitor::VisitInternalVariable(InternalVariable* node) {
424 IncrementNodeCount();
425 DisableFullCodegenAndCrankshaft(kNoReason);
426 }
427
424 void AstNumberingVisitor::VisitForInStatement(ForInStatement* node) { 428 void AstNumberingVisitor::VisitForInStatement(ForInStatement* node) {
425 IncrementNodeCount(); 429 IncrementNodeCount();
426 DisableSelfOptimization(); 430 DisableSelfOptimization();
427 node->set_base_id(ReserveIdRange(ForInStatement::num_ids())); 431 node->set_base_id(ReserveIdRange(ForInStatement::num_ids()));
428 Visit(node->enumerable()); // Not part of loop. 432 Visit(node->enumerable()); // Not part of loop.
429 node->set_first_yield_id(yield_count_); 433 node->set_first_yield_id(yield_count_);
430 Visit(node->each()); 434 Visit(node->each());
431 Visit(node->body()); 435 Visit(node->body());
432 node->set_yield_count(yield_count_ - node->first_yield_id()); 436 node->set_yield_count(yield_count_ - node->first_yield_id());
433 ReserveFeedbackSlots(node); 437 ReserveFeedbackSlots(node);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 } 637 }
634 638
635 if (IsResumableFunction(node->kind())) { 639 if (IsResumableFunction(node->kind())) {
636 DisableFullCodegenAndCrankshaft(kGenerator); 640 DisableFullCodegenAndCrankshaft(kGenerator);
637 } 641 }
638 642
639 if (IsClassConstructor(node->kind())) { 643 if (IsClassConstructor(node->kind())) {
640 DisableFullCodegenAndCrankshaft(kClassConstructorFunction); 644 DisableFullCodegenAndCrankshaft(kClassConstructorFunction);
641 } 645 }
642 646
647 if (scope->is_function_scope()) {
648 Variable* function_var = scope->function_var();
649 if (function_var != nullptr && !function_var->IsUnallocated()) {
650 // Initialization of local function-named variable is no longer part of
651 // the AST, and this initialization is not handled in full-codegen or
652 // crankshaft.
caitp 2017/01/30 04:20:29 I'm guessing there isn't a whole lot of cases wher
653 DisableFullCodegenAndCrankshaft(kNoReason);
654 }
655 }
656
657 if (IsGeneratorFunction(node->kind()) || scope->is_module_scope()) {
658 // Generator functions and Modules have an initial yield which is not
659 // included in the AST.
660 DCHECK_EQ(0, yield_count_);
661 yield_count_ = 1;
662 }
663
643 VisitDeclarations(scope->declarations()); 664 VisitDeclarations(scope->declarations());
665 if (node->parameter_init_block() != nullptr) {
666 DisableFullCodegenAndCrankshaft(kNonSimpleParameters);
667 VisitBlock(node->parameter_init_block());
668 }
644 VisitStatements(node->body()); 669 VisitStatements(node->body());
645 670
646 node->set_ast_properties(&properties_); 671 node->set_ast_properties(&properties_);
647 node->set_dont_optimize_reason(dont_optimize_reason()); 672 node->set_dont_optimize_reason(dont_optimize_reason());
648 node->set_yield_count(yield_count_); 673 node->set_yield_count(yield_count_);
649 674
650 if (FLAG_trace_opt) { 675 if (FLAG_trace_opt) {
651 if (disable_crankshaft_reason_ != kNoReason) { 676 if (disable_crankshaft_reason_ != kNoReason) {
652 // TODO(leszeks): This is a quick'n'dirty fix to allow the debug name of 677 // TODO(leszeks): This is a quick'n'dirty fix to allow the debug name of
653 // the function to be accessed in the below print. This DCHECK will fail 678 // the function to be accessed in the below print. This DCHECK will fail
(...skipping 16 matching lines...) Expand all
670 Compiler::EagerInnerFunctionLiterals* eager_literals) { 695 Compiler::EagerInnerFunctionLiterals* eager_literals) {
671 DisallowHeapAllocation no_allocation; 696 DisallowHeapAllocation no_allocation;
672 DisallowHandleAllocation no_handles; 697 DisallowHandleAllocation no_handles;
673 DisallowHandleDereference no_deref; 698 DisallowHandleDereference no_deref;
674 699
675 AstNumberingVisitor visitor(stack_limit, zone, eager_literals); 700 AstNumberingVisitor visitor(stack_limit, zone, eager_literals);
676 return visitor.Renumber(function); 701 return visitor.Renumber(function);
677 } 702 }
678 } // namespace internal 703 } // namespace internal
679 } // namespace v8 704 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698