OLD | NEW |
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 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 if (scope->new_target_var()) DisableCrankshaft(kSuperReference); | 572 if (scope->new_target_var()) DisableCrankshaft(kSuperReference); |
573 if (scope->calls_eval()) DisableOptimization(kFunctionCallsEval); | 573 if (scope->calls_eval()) DisableOptimization(kFunctionCallsEval); |
574 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) { | 574 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) { |
575 DisableCrankshaft(kContextAllocatedArguments); | 575 DisableCrankshaft(kContextAllocatedArguments); |
576 } | 576 } |
577 | 577 |
578 if (scope->rest_parameter() != nullptr) { | 578 if (scope->rest_parameter() != nullptr) { |
579 DisableCrankshaft(kRestParameter); | 579 DisableCrankshaft(kRestParameter); |
580 } | 580 } |
581 | 581 |
582 if (FLAG_ignition && scope->NeedsContext() && scope->is_script_scope()) { | 582 if (FLAG_ignition && scope->NeedsContext() && |
| 583 (scope->is_script_scope() || scope->is_module_scope())) { |
583 // Create ScopeInfo while on the main thread to avoid allocation during | 584 // Create ScopeInfo while on the main thread to avoid allocation during |
584 // potentially concurrent bytecode generation. | 585 // potentially concurrent bytecode generation. |
585 node->scope()->GetScopeInfo(isolate_); | 586 node->scope()->GetScopeInfo(isolate_); |
586 } | 587 } |
587 | 588 |
588 if (IsGeneratorFunction(node->kind()) || IsAsyncFunction(node->kind())) { | 589 if (IsGeneratorFunction(node->kind()) || IsAsyncFunction(node->kind())) { |
589 // TODO(neis): We may want to allow Turbofan optimization here if | 590 // TODO(neis): We may want to allow Turbofan optimization here if |
590 // --turbo-from-bytecode is set and we know that Ignition is used. | 591 // --turbo-from-bytecode is set and we know that Ignition is used. |
591 // Unfortunately we can't express that here. | 592 // Unfortunately we can't express that here. |
592 DisableOptimization(kGenerator); | 593 DisableOptimization(kGenerator); |
593 } | 594 } |
594 | 595 |
595 VisitDeclarations(scope->declarations()); | 596 VisitDeclarations(scope->declarations()); |
596 VisitStatements(node->body()); | 597 VisitStatements(node->body()); |
597 | 598 |
598 node->set_ast_properties(&properties_); | 599 node->set_ast_properties(&properties_); |
599 node->set_dont_optimize_reason(dont_optimize_reason()); | 600 node->set_dont_optimize_reason(dont_optimize_reason()); |
600 node->set_yield_count(yield_count_); | 601 node->set_yield_count(yield_count_); |
601 return !HasStackOverflow(); | 602 return !HasStackOverflow(); |
602 } | 603 } |
603 | 604 |
604 | 605 |
605 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 606 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
606 FunctionLiteral* function) { | 607 FunctionLiteral* function) { |
607 AstNumberingVisitor visitor(isolate, zone); | 608 AstNumberingVisitor visitor(isolate, zone); |
608 return visitor.Renumber(function); | 609 return visitor.Renumber(function); |
609 } | 610 } |
610 } // namespace internal | 611 } // namespace internal |
611 } // namespace v8 | 612 } // namespace v8 |
OLD | NEW |