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-numbering.h" | 5 #include "src/ast-numbering.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/scopes.h" | 8 #include "src/scopes.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 | 12 |
13 class AstNumberingVisitor final : public AstVisitor { | 13 class AstNumberingVisitor final : public AstVisitor { |
14 public: | 14 public: |
15 AstNumberingVisitor(Isolate* isolate, Zone* zone) | 15 AstNumberingVisitor(Isolate* isolate, Zone* zone) |
16 : AstVisitor(), | 16 : AstVisitor(), |
17 next_id_(BailoutId::FirstUsable().ToInt()), | 17 next_id_(BailoutId::FirstUsable().ToInt()), |
18 properties_(zone), | 18 properties_(zone), |
19 ic_slot_cache_(zone), | 19 slot_cache_(zone), |
20 dont_optimize_reason_(kNoReason) { | 20 dont_optimize_reason_(kNoReason) { |
21 InitializeAstVisitor(isolate, zone); | 21 InitializeAstVisitor(isolate, zone); |
22 } | 22 } |
23 | 23 |
24 bool Renumber(FunctionLiteral* node); | 24 bool Renumber(FunctionLiteral* node); |
25 | 25 |
26 private: | 26 private: |
27 // AST node visitor interface. | 27 // AST node visitor interface. |
28 #define DEFINE_VISIT(type) virtual void Visit##type(type* node) override; | 28 #define DEFINE_VISIT(type) virtual void Visit##type(type* node) override; |
29 AST_NODE_LIST(DEFINE_VISIT) | 29 AST_NODE_LIST(DEFINE_VISIT) |
(...skipping 29 matching lines...) Expand all Loading... |
59 properties_.flags() |= AstProperties::kDontCrankshaft; | 59 properties_.flags() |= AstProperties::kDontCrankshaft; |
60 } else { | 60 } else { |
61 dont_optimize_reason_ = reason; | 61 dont_optimize_reason_ = reason; |
62 DisableSelfOptimization(); | 62 DisableSelfOptimization(); |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 template <typename Node> | 66 template <typename Node> |
67 void ReserveFeedbackSlots(Node* node) { | 67 void ReserveFeedbackSlots(Node* node) { |
68 node->AssignFeedbackVectorSlots(isolate(), properties_.get_spec(), | 68 node->AssignFeedbackVectorSlots(isolate(), properties_.get_spec(), |
69 &ic_slot_cache_); | 69 &slot_cache_); |
70 } | 70 } |
71 | 71 |
72 BailoutReason dont_optimize_reason() const { return dont_optimize_reason_; } | 72 BailoutReason dont_optimize_reason() const { return dont_optimize_reason_; } |
73 | 73 |
74 int next_id_; | 74 int next_id_; |
75 AstProperties properties_; | 75 AstProperties properties_; |
76 // The slot cache allows us to reuse certain vector IC slots. | 76 // The slot cache allows us to reuse certain feedback vector slots. |
77 ICSlotCache ic_slot_cache_; | 77 FeedbackVectorSlotCache slot_cache_; |
78 BailoutReason dont_optimize_reason_; | 78 BailoutReason dont_optimize_reason_; |
79 | 79 |
80 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 80 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
81 DISALLOW_COPY_AND_ASSIGN(AstNumberingVisitor); | 81 DISALLOW_COPY_AND_ASSIGN(AstNumberingVisitor); |
82 }; | 82 }; |
83 | 83 |
84 | 84 |
85 void AstNumberingVisitor::VisitVariableDeclaration(VariableDeclaration* node) { | 85 void AstNumberingVisitor::VisitVariableDeclaration(VariableDeclaration* node) { |
86 IncrementNodeCount(); | 86 IncrementNodeCount(); |
87 VisitVariableProxy(node->proxy()); | 87 VisitVariableProxy(node->proxy()); |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 } | 568 } |
569 | 569 |
570 | 570 |
571 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 571 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
572 FunctionLiteral* function) { | 572 FunctionLiteral* function) { |
573 AstNumberingVisitor visitor(isolate, zone); | 573 AstNumberingVisitor visitor(isolate, zone); |
574 return visitor.Renumber(function); | 574 return visitor.Renumber(function); |
575 } | 575 } |
576 } // namespace internal | 576 } // namespace internal |
577 } // namespace v8 | 577 } // namespace v8 |
OLD | NEW |