| 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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 | 556 |
| 557 bool AstNumberingVisitor::Finish(FunctionLiteral* node) { | 557 bool AstNumberingVisitor::Finish(FunctionLiteral* node) { |
| 558 node->set_ast_properties(&properties_); | 558 node->set_ast_properties(&properties_); |
| 559 node->set_dont_optimize_reason(dont_optimize_reason()); | 559 node->set_dont_optimize_reason(dont_optimize_reason()); |
| 560 return !HasStackOverflow(); | 560 return !HasStackOverflow(); |
| 561 } | 561 } |
| 562 | 562 |
| 563 | 563 |
| 564 bool AstNumberingVisitor::Renumber(FunctionLiteral* node) { | 564 bool AstNumberingVisitor::Renumber(FunctionLiteral* node) { |
| 565 Scope* scope = node->scope(); | 565 Scope* scope = node->scope(); |
| 566 | |
| 567 if (scope->HasIllegalRedeclaration()) { | |
| 568 Visit(scope->GetIllegalRedeclaration()); | |
| 569 DisableOptimization(kFunctionWithIllegalRedeclaration); | |
| 570 return Finish(node); | |
| 571 } | |
| 572 if (scope->new_target_var()) DisableCrankshaft(kSuperReference); | 566 if (scope->new_target_var()) DisableCrankshaft(kSuperReference); |
| 573 if (scope->calls_eval()) DisableOptimization(kFunctionCallsEval); | 567 if (scope->calls_eval()) DisableOptimization(kFunctionCallsEval); |
| 574 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) { | 568 if (scope->arguments() != NULL && !scope->arguments()->IsStackAllocated()) { |
| 575 DisableCrankshaft(kContextAllocatedArguments); | 569 DisableCrankshaft(kContextAllocatedArguments); |
| 576 } | 570 } |
| 577 | 571 |
| 578 int rest_index; | 572 int rest_index; |
| 579 if (scope->rest_parameter(&rest_index)) { | 573 if (scope->rest_parameter(&rest_index)) { |
| 580 DisableCrankshaft(kRestParameter); | 574 DisableCrankshaft(kRestParameter); |
| 581 } | 575 } |
| 582 | 576 |
| 583 VisitDeclarations(scope->declarations()); | 577 VisitDeclarations(scope->declarations()); |
| 584 VisitStatements(node->body()); | 578 VisitStatements(node->body()); |
| 585 | 579 |
| 586 return Finish(node); | 580 return Finish(node); |
| 587 } | 581 } |
| 588 | 582 |
| 589 | 583 |
| 590 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 584 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
| 591 FunctionLiteral* function) { | 585 FunctionLiteral* function) { |
| 592 AstNumberingVisitor visitor(isolate, zone); | 586 AstNumberingVisitor visitor(isolate, zone); |
| 593 return visitor.Renumber(function); | 587 return visitor.Renumber(function); |
| 594 } | 588 } |
| 595 } // namespace internal | 589 } // namespace internal |
| 596 } // namespace v8 | 590 } // namespace v8 |
| OLD | NEW |