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->calls_eval()) DisableOptimization(kFunctionCallsEval); | 572 if (scope->calls_eval()) DisableOptimization(kFunctionCallsEval); |
573 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) { | 573 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) { |
574 DisableCrankshaft(kContextAllocatedArguments); | 574 DisableCrankshaft(kContextAllocatedArguments); |
575 } | 575 } |
576 | 576 |
577 int rest_index; | 577 int rest_index; |
578 if (scope->rest_parameter(&rest_index)) { | 578 if (scope->rest_parameter(&rest_index)) { |
579 DisableCrankshaft(kRestParameter); | 579 DisableCrankshaft(kRestParameter); |
580 } | 580 } |
581 | 581 |
| 582 if (IsGeneratorFunction(node->kind()) || IsAsyncFunction(node->kind())) { |
| 583 DisableOptimization(kGenerator); |
| 584 } |
| 585 |
582 VisitDeclarations(scope->declarations()); | 586 VisitDeclarations(scope->declarations()); |
583 VisitStatements(node->body()); | 587 VisitStatements(node->body()); |
584 | 588 |
585 node->set_ast_properties(&properties_); | 589 node->set_ast_properties(&properties_); |
586 node->set_dont_optimize_reason(dont_optimize_reason()); | 590 node->set_dont_optimize_reason(dont_optimize_reason()); |
587 node->set_yield_count(yield_count_); | 591 node->set_yield_count(yield_count_); |
588 return !HasStackOverflow(); | 592 return !HasStackOverflow(); |
589 } | 593 } |
590 | 594 |
591 | 595 |
592 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 596 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
593 FunctionLiteral* function) { | 597 FunctionLiteral* function) { |
594 AstNumberingVisitor visitor(isolate, zone); | 598 AstNumberingVisitor visitor(isolate, zone); |
595 return visitor.Renumber(function); | 599 return visitor.Renumber(function); |
596 } | 600 } |
597 } // namespace internal | 601 } // namespace internal |
598 } // namespace v8 | 602 } // namespace v8 |
OLD | NEW |