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

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

Issue 2220203002: [ic] Merge LoadGlobalIC_Slow builtins for inside typeof and outside typeof cases. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | src/builtins/builtins.h » ('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 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 class AstNumberingVisitor final : public AstVisitor<AstNumberingVisitor> { 13 class AstNumberingVisitor final : public AstVisitor<AstNumberingVisitor> {
14 public: 14 public:
15 AstNumberingVisitor(Isolate* isolate, Zone* zone) 15 AstNumberingVisitor(Isolate* isolate, Zone* zone)
16 : isolate_(isolate), 16 : isolate_(isolate),
17 zone_(zone), 17 zone_(zone),
18 next_id_(BailoutId::FirstUsable().ToInt()), 18 next_id_(BailoutId::FirstUsable().ToInt()),
19 yield_count_(0), 19 yield_count_(0),
20 properties_(zone), 20 properties_(zone),
21 slot_cache_(zone), 21 slot_cache_(zone),
22 slot_cache_inside_typeof_(zone),
23 dont_optimize_reason_(kNoReason), 22 dont_optimize_reason_(kNoReason),
24 typeof_mode_(NOT_INSIDE_TYPEOF),
25 catch_prediction_(HandlerTable::UNCAUGHT) { 23 catch_prediction_(HandlerTable::UNCAUGHT) {
26 InitializeAstVisitor(isolate); 24 InitializeAstVisitor(isolate);
27 } 25 }
28 26
29 bool Renumber(FunctionLiteral* node); 27 bool Renumber(FunctionLiteral* node);
30 28
31 private: 29 private:
32 // AST node visitor interface. 30 // AST node visitor interface.
33 #define DEFINE_VISIT(type) void Visit##type(type* node); 31 #define DEFINE_VISIT(type) void Visit##type(type* node);
34 AST_NODE_LIST(DEFINE_VISIT) 32 AST_NODE_LIST(DEFINE_VISIT)
(...skipping 22 matching lines...) Expand all
57 dont_optimize_reason_ = reason; 55 dont_optimize_reason_ = reason;
58 DisableSelfOptimization(); 56 DisableSelfOptimization();
59 } 57 }
60 void DisableCrankshaft(BailoutReason reason) { 58 void DisableCrankshaft(BailoutReason reason) {
61 properties_.flags() |= AstProperties::kDontCrankshaft; 59 properties_.flags() |= AstProperties::kDontCrankshaft;
62 } 60 }
63 61
64 template <typename Node> 62 template <typename Node>
65 void ReserveFeedbackSlots(Node* node) { 63 void ReserveFeedbackSlots(Node* node) {
66 node->AssignFeedbackVectorSlots(isolate_, properties_.get_spec(), 64 node->AssignFeedbackVectorSlots(isolate_, properties_.get_spec(),
67 typeof_mode_ == INSIDE_TYPEOF 65 &slot_cache_);
68 ? &slot_cache_inside_typeof_
69 : &slot_cache_);
70 } 66 }
71 67
72 BailoutReason dont_optimize_reason() const { return dont_optimize_reason_; } 68 BailoutReason dont_optimize_reason() const { return dont_optimize_reason_; }
73 69
74 Isolate* isolate_; 70 Isolate* isolate_;
75 Zone* zone_; 71 Zone* zone_;
76 int next_id_; 72 int next_id_;
77 int yield_count_; 73 int yield_count_;
78 AstProperties properties_; 74 AstProperties properties_;
79 // The slot cache allows us to reuse certain feedback vector slots. 75 // The slot cache allows us to reuse certain feedback vector slots.
80 FeedbackVectorSlotCache slot_cache_; 76 FeedbackVectorSlotCache slot_cache_;
81 FeedbackVectorSlotCache slot_cache_inside_typeof_;
82 BailoutReason dont_optimize_reason_; 77 BailoutReason dont_optimize_reason_;
83 TypeofMode typeof_mode_;
84 HandlerTable::CatchPrediction catch_prediction_; 78 HandlerTable::CatchPrediction catch_prediction_;
85 79
86 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 80 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
87 DISALLOW_COPY_AND_ASSIGN(AstNumberingVisitor); 81 DISALLOW_COPY_AND_ASSIGN(AstNumberingVisitor);
88 }; 82 };
89 83
90 84
91 void AstNumberingVisitor::VisitVariableDeclaration(VariableDeclaration* node) { 85 void AstNumberingVisitor::VisitVariableDeclaration(VariableDeclaration* node) {
92 IncrementNodeCount(); 86 IncrementNodeCount();
93 VisitVariableProxy(node->proxy()); 87 VisitVariableProxy(node->proxy());
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 209
216 210
217 void AstNumberingVisitor::VisitThrow(Throw* node) { 211 void AstNumberingVisitor::VisitThrow(Throw* node) {
218 IncrementNodeCount(); 212 IncrementNodeCount();
219 node->set_base_id(ReserveIdRange(Throw::num_ids())); 213 node->set_base_id(ReserveIdRange(Throw::num_ids()));
220 Visit(node->exception()); 214 Visit(node->exception());
221 } 215 }
222 216
223 217
224 void AstNumberingVisitor::VisitUnaryOperation(UnaryOperation* node) { 218 void AstNumberingVisitor::VisitUnaryOperation(UnaryOperation* node) {
225 Token::Value op = node->op();
226 TypeofMode old_typeof_mode = typeof_mode_;
227 IncrementNodeCount(); 219 IncrementNodeCount();
228 if (op == Token::TYPEOF) typeof_mode_ = INSIDE_TYPEOF;
229 node->set_base_id(ReserveIdRange(UnaryOperation::num_ids())); 220 node->set_base_id(ReserveIdRange(UnaryOperation::num_ids()));
230 Visit(node->expression()); 221 Visit(node->expression());
231 typeof_mode_ = old_typeof_mode;
232 } 222 }
233 223
234 224
235 void AstNumberingVisitor::VisitCountOperation(CountOperation* node) { 225 void AstNumberingVisitor::VisitCountOperation(CountOperation* node) {
236 IncrementNodeCount(); 226 IncrementNodeCount();
237 node->set_base_id(ReserveIdRange(CountOperation::num_ids())); 227 node->set_base_id(ReserveIdRange(CountOperation::num_ids()));
238 Visit(node->expression()); 228 Visit(node->expression());
239 ReserveFeedbackSlots(node); 229 ReserveFeedbackSlots(node);
240 } 230 }
241 231
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 } 589 }
600 590
601 591
602 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, 592 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone,
603 FunctionLiteral* function) { 593 FunctionLiteral* function) {
604 AstNumberingVisitor visitor(isolate, zone); 594 AstNumberingVisitor visitor(isolate, zone);
605 return visitor.Renumber(function); 595 return visitor.Renumber(function);
606 } 596 }
607 } // namespace internal 597 } // namespace internal
608 } // namespace v8 598 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698