Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Side by Side Diff: src/ast/ast-numbering.cc

Issue 2618553004: [compiler] Collect eager inner functions for compilation during renumbering. (Closed)
Patch Set: Address comments and remove field from ParseInfo Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ast/ast-numbering.h ('k') | src/bit-vector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/objects-inl.h" 10 #include "src/objects-inl.h"
10 11
11 namespace v8 { 12 namespace v8 {
12 namespace internal { 13 namespace internal {
13 14
14 class AstNumberingVisitor final : public AstVisitor<AstNumberingVisitor> { 15 class AstNumberingVisitor final : public AstVisitor<AstNumberingVisitor> {
15 public: 16 public:
16 AstNumberingVisitor(Isolate* isolate, Zone* zone) 17 AstNumberingVisitor(Isolate* isolate, Zone* zone,
18 Compiler::EagerInnerFunctionLiterals* eager_literals)
17 : isolate_(isolate), 19 : isolate_(isolate),
18 zone_(zone), 20 zone_(zone),
21 eager_literals_(eager_literals),
19 next_id_(BailoutId::FirstUsable().ToInt()), 22 next_id_(BailoutId::FirstUsable().ToInt()),
20 yield_count_(0), 23 yield_count_(0),
21 properties_(zone), 24 properties_(zone),
22 slot_cache_(zone), 25 slot_cache_(zone),
23 disable_crankshaft_reason_(kNoReason), 26 disable_crankshaft_reason_(kNoReason),
24 dont_optimize_reason_(kNoReason), 27 dont_optimize_reason_(kNoReason),
25 catch_prediction_(HandlerTable::UNCAUGHT) { 28 catch_prediction_(HandlerTable::UNCAUGHT) {
26 InitializeAstVisitor(isolate); 29 InitializeAstVisitor(isolate);
27 } 30 }
28 31
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 66 }
64 67
65 template <typename Node> 68 template <typename Node>
66 void ReserveFeedbackSlots(Node* node) { 69 void ReserveFeedbackSlots(Node* node) {
67 node->AssignFeedbackVectorSlots(isolate_, properties_.get_spec(), 70 node->AssignFeedbackVectorSlots(isolate_, properties_.get_spec(),
68 &slot_cache_); 71 &slot_cache_);
69 } 72 }
70 73
71 BailoutReason dont_optimize_reason() const { return dont_optimize_reason_; } 74 BailoutReason dont_optimize_reason() const { return dont_optimize_reason_; }
72 75
76 Zone* zone() const { return zone_; }
77
73 Isolate* isolate_; 78 Isolate* isolate_;
74 Zone* zone_; 79 Zone* zone_;
80 Compiler::EagerInnerFunctionLiterals* eager_literals_;
75 int next_id_; 81 int next_id_;
76 int yield_count_; 82 int yield_count_;
77 AstProperties properties_; 83 AstProperties properties_;
78 // The slot cache allows us to reuse certain feedback vector slots. 84 // The slot cache allows us to reuse certain feedback vector slots.
79 FeedbackVectorSlotCache slot_cache_; 85 FeedbackVectorSlotCache slot_cache_;
80 BailoutReason disable_crankshaft_reason_; 86 BailoutReason disable_crankshaft_reason_;
81 BailoutReason dont_optimize_reason_; 87 BailoutReason dont_optimize_reason_;
82 HandlerTable::CatchPrediction catch_prediction_; 88 HandlerTable::CatchPrediction catch_prediction_;
83 89
84 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 90 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 void AstNumberingVisitor::VisitArguments(ZoneList<Expression*>* arguments) { 594 void AstNumberingVisitor::VisitArguments(ZoneList<Expression*>* arguments) {
589 for (int i = 0; i < arguments->length(); i++) { 595 for (int i = 0; i < arguments->length(); i++) {
590 Visit(arguments->at(i)); 596 Visit(arguments->at(i));
591 } 597 }
592 } 598 }
593 599
594 600
595 void AstNumberingVisitor::VisitFunctionLiteral(FunctionLiteral* node) { 601 void AstNumberingVisitor::VisitFunctionLiteral(FunctionLiteral* node) {
596 IncrementNodeCount(); 602 IncrementNodeCount();
597 node->set_base_id(ReserveIdRange(FunctionLiteral::num_ids())); 603 node->set_base_id(ReserveIdRange(FunctionLiteral::num_ids()));
604 if (eager_literals_ && node->ShouldEagerCompile()) {
605 eager_literals_->Add(new (zone())
606 ThreadedListZoneEntry<FunctionLiteral*>(node));
607 }
598 // We don't recurse into the declarations or body of the function literal: 608 // We don't recurse into the declarations or body of the function literal:
599 // you have to separately Renumber() each FunctionLiteral that you compile. 609 // you have to separately Renumber() each FunctionLiteral that you compile.
600 ReserveFeedbackSlots(node); 610 ReserveFeedbackSlots(node);
601 } 611 }
602 612
603 613
604 void AstNumberingVisitor::VisitRewritableExpression( 614 void AstNumberingVisitor::VisitRewritableExpression(
605 RewritableExpression* node) { 615 RewritableExpression* node) {
606 IncrementNodeCount(); 616 IncrementNodeCount();
607 node->set_base_id(ReserveIdRange(RewritableExpression::num_ids())); 617 node->set_base_id(ReserveIdRange(RewritableExpression::num_ids()));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 if (disable_crankshaft_reason_ != kNoReason) { 654 if (disable_crankshaft_reason_ != kNoReason) {
645 PrintF("[enforcing Ignition and TurboFan for %s because: %s\n", 655 PrintF("[enforcing Ignition and TurboFan for %s because: %s\n",
646 node->debug_name()->ToCString().get(), 656 node->debug_name()->ToCString().get(),
647 GetBailoutReason(disable_crankshaft_reason_)); 657 GetBailoutReason(disable_crankshaft_reason_));
648 } 658 }
649 } 659 }
650 660
651 return !HasStackOverflow(); 661 return !HasStackOverflow();
652 } 662 }
653 663
654 664 bool AstNumbering::Renumber(
655 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, 665 Isolate* isolate, Zone* zone, FunctionLiteral* function,
656 FunctionLiteral* function) { 666 Compiler::EagerInnerFunctionLiterals* eager_literals) {
657 AstNumberingVisitor visitor(isolate, zone); 667 AstNumberingVisitor visitor(isolate, zone, eager_literals);
658 return visitor.Renumber(function); 668 return visitor.Renumber(function);
659 } 669 }
660 } // namespace internal 670 } // namespace internal
661 } // namespace v8 671 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast-numbering.h ('k') | src/bit-vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698