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

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

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

Powered by Google App Engine
This is Rietveld 408576698