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 (eager_literals_ && node->ShouldEagerCompile()) { | 601 if (node->ShouldEagerCompile()) { |
602 eager_literals_->Add(new (zone()) | 602 // If the function literal is being eagerly compiled, recurse into the |
603 ThreadedListZoneEntry<FunctionLiteral*>(node)); | 603 // declarations and body of the function literal. |
| 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 } |
604 } | 612 } |
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. | |
607 ReserveFeedbackSlots(node); | 613 ReserveFeedbackSlots(node); |
608 } | 614 } |
609 | 615 |
610 | 616 |
611 void AstNumberingVisitor::VisitRewritableExpression( | 617 void AstNumberingVisitor::VisitRewritableExpression( |
612 RewritableExpression* node) { | 618 RewritableExpression* node) { |
613 IncrementNodeCount(); | 619 IncrementNodeCount(); |
614 node->set_base_id(ReserveIdRange(RewritableExpression::num_ids())); | 620 node->set_base_id(ReserveIdRange(RewritableExpression::num_ids())); |
615 Visit(node->expression()); | 621 Visit(node->expression()); |
616 } | 622 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 Compiler::EagerInnerFunctionLiterals* eager_literals) { | 669 Compiler::EagerInnerFunctionLiterals* eager_literals) { |
664 DisallowHeapAllocation no_allocation; | 670 DisallowHeapAllocation no_allocation; |
665 DisallowHandleAllocation no_handles; | 671 DisallowHandleAllocation no_handles; |
666 DisallowHandleDereference no_deref; | 672 DisallowHandleDereference no_deref; |
667 | 673 |
668 AstNumberingVisitor visitor(stack_limit, zone, eager_literals); | 674 AstNumberingVisitor visitor(stack_limit, zone, eager_literals); |
669 return visitor.Renumber(function); | 675 return visitor.Renumber(function); |
670 } | 676 } |
671 } // namespace internal | 677 } // namespace internal |
672 } // namespace v8 | 678 } // namespace v8 |
OLD | NEW |