| 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 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 void AstNumberingVisitor::VisitArguments(ZoneList<Expression*>* arguments) { | 591 void AstNumberingVisitor::VisitArguments(ZoneList<Expression*>* arguments) { |
| 592 for (int i = 0; i < arguments->length(); i++) { | 592 for (int i = 0; i < arguments->length(); i++) { |
| 593 Visit(arguments->at(i)); | 593 Visit(arguments->at(i)); |
| 594 } | 594 } |
| 595 } | 595 } |
| 596 | 596 |
| 597 | 597 |
| 598 void AstNumberingVisitor::VisitFunctionLiteral(FunctionLiteral* node) { | 598 void AstNumberingVisitor::VisitFunctionLiteral(FunctionLiteral* node) { |
| 599 IncrementNodeCount(); | 599 IncrementNodeCount(); |
| 600 node->set_base_id(ReserveIdRange(FunctionLiteral::num_ids())); | 600 node->set_base_id(ReserveIdRange(FunctionLiteral::num_ids())); |
| 601 if (node->ShouldEagerCompile()) { | 601 if (eager_literals_ && node->ShouldEagerCompile()) { |
| 602 // If the function literal is being eagerly compiled, recurse into the | 602 eager_literals_->Add(new (zone()) |
| 603 // declarations and body of the function literal. | 603 ThreadedListZoneEntry<FunctionLiteral*>(node)); |
| 604 if (!AstNumbering::Renumber(stack_limit_, zone_, node, eager_literals_)) { | |
| 605 SetStackOverflow(); | |
| 606 return; | |
| 607 } | |
| 608 if (eager_literals_) { | |
| 609 eager_literals_->Add(new (zone()) | |
| 610 ThreadedListZoneEntry<FunctionLiteral*>(node)); | |
| 611 } | |
| 612 } | 604 } |
| 605 // We don't recurse into the declarations or body of the function literal: |
| 606 // you have to separately Renumber() each FunctionLiteral that you compile. |
| 613 ReserveFeedbackSlots(node); | 607 ReserveFeedbackSlots(node); |
| 614 } | 608 } |
| 615 | 609 |
| 616 | 610 |
| 617 void AstNumberingVisitor::VisitRewritableExpression( | 611 void AstNumberingVisitor::VisitRewritableExpression( |
| 618 RewritableExpression* node) { | 612 RewritableExpression* node) { |
| 619 IncrementNodeCount(); | 613 IncrementNodeCount(); |
| 620 node->set_base_id(ReserveIdRange(RewritableExpression::num_ids())); | 614 node->set_base_id(ReserveIdRange(RewritableExpression::num_ids())); |
| 621 Visit(node->expression()); | 615 Visit(node->expression()); |
| 622 } | 616 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 Compiler::EagerInnerFunctionLiterals* eager_literals) { | 663 Compiler::EagerInnerFunctionLiterals* eager_literals) { |
| 670 DisallowHeapAllocation no_allocation; | 664 DisallowHeapAllocation no_allocation; |
| 671 DisallowHandleAllocation no_handles; | 665 DisallowHandleAllocation no_handles; |
| 672 DisallowHandleDereference no_deref; | 666 DisallowHandleDereference no_deref; |
| 673 | 667 |
| 674 AstNumberingVisitor visitor(stack_limit, zone, eager_literals); | 668 AstNumberingVisitor visitor(stack_limit, zone, eager_literals); |
| 675 return visitor.Renumber(function); | 669 return visitor.Renumber(function); |
| 676 } | 670 } |
| 677 } // namespace internal | 671 } // namespace internal |
| 678 } // namespace v8 | 672 } // namespace v8 |
| OLD | NEW |