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/v8.h" | |
6 | |
7 #include "src/ast.h" | 5 #include "src/ast.h" |
8 #include "src/ast-numbering.h" | 6 #include "src/ast-numbering.h" |
9 #include "src/scopes.h" | 7 #include "src/scopes.h" |
10 | 8 |
11 namespace v8 { | 9 namespace v8 { |
12 namespace internal { | 10 namespace internal { |
13 | 11 |
14 | |
15 class AstNumberingVisitor final : public AstVisitor { | 12 class AstNumberingVisitor final : public AstVisitor { |
16 public: | 13 public: |
17 explicit AstNumberingVisitor(Isolate* isolate, Zone* zone) | 14 explicit AstNumberingVisitor(Isolate* isolate, Zone* zone) |
18 : AstVisitor(), | 15 : AstVisitor(), |
19 next_id_(BailoutId::FirstUsable().ToInt()), | 16 next_id_(BailoutId::FirstUsable().ToInt()), |
20 properties_(zone), | 17 properties_(zone), |
21 ic_slot_cache_(4), | 18 ic_slot_cache_(4), |
22 dont_optimize_reason_(kNoReason) { | 19 dont_optimize_reason_(kNoReason) { |
23 InitializeAstVisitor(isolate, zone); | 20 InitializeAstVisitor(isolate, zone); |
24 } | 21 } |
(...skipping 14 matching lines...) Expand all Loading... |
39 void VisitObjectLiteralProperty(ObjectLiteralProperty* property); | 36 void VisitObjectLiteralProperty(ObjectLiteralProperty* property); |
40 | 37 |
41 int ReserveIdRange(int n) { | 38 int ReserveIdRange(int n) { |
42 int tmp = next_id_; | 39 int tmp = next_id_; |
43 next_id_ += n; | 40 next_id_ += n; |
44 return tmp; | 41 return tmp; |
45 } | 42 } |
46 | 43 |
47 void IncrementNodeCount() { properties_.add_node_count(1); } | 44 void IncrementNodeCount() { properties_.add_node_count(1); } |
48 void DisableSelfOptimization() { | 45 void DisableSelfOptimization() { |
49 properties_.flags()->Add(kDontSelfOptimize); | 46 properties_.flags() |= AstProperties::kDontSelfOptimize; |
50 } | 47 } |
51 void DisableOptimization(BailoutReason reason) { | 48 void DisableOptimization(BailoutReason reason) { |
52 dont_optimize_reason_ = reason; | 49 dont_optimize_reason_ = reason; |
53 DisableSelfOptimization(); | 50 DisableSelfOptimization(); |
54 } | 51 } |
55 void DisableCrankshaft(BailoutReason reason) { | 52 void DisableCrankshaft(BailoutReason reason) { |
56 if (FLAG_turbo_shipping) { | 53 if (FLAG_turbo_shipping) { |
57 return properties_.flags()->Add(kDontCrankshaft); | 54 properties_.flags() |= AstProperties::kDontCrankshaft; |
| 55 } else { |
| 56 dont_optimize_reason_ = reason; |
| 57 DisableSelfOptimization(); |
58 } | 58 } |
59 dont_optimize_reason_ = reason; | |
60 DisableSelfOptimization(); | |
61 } | 59 } |
62 | 60 |
63 template <typename Node> | 61 template <typename Node> |
64 void ReserveFeedbackSlots(Node* node) { | 62 void ReserveFeedbackSlots(Node* node) { |
65 FeedbackVectorRequirements reqs = | 63 FeedbackVectorRequirements reqs = |
66 node->ComputeFeedbackRequirements(isolate(), &ic_slot_cache_); | 64 node->ComputeFeedbackRequirements(isolate(), &ic_slot_cache_); |
67 if (reqs.slots() > 0) { | 65 if (reqs.slots() > 0) { |
68 node->SetFirstFeedbackSlot(FeedbackVectorSlot(properties_.slots())); | 66 node->SetFirstFeedbackSlot(FeedbackVectorSlot(properties_.slots())); |
69 properties_.increase_slots(reqs.slots()); | 67 properties_.increase_slots(reqs.slots()); |
70 } | 68 } |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 } | 548 } |
551 | 549 |
552 | 550 |
553 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 551 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
554 FunctionLiteral* function) { | 552 FunctionLiteral* function) { |
555 AstNumberingVisitor visitor(isolate, zone); | 553 AstNumberingVisitor visitor(isolate, zone); |
556 return visitor.Renumber(function); | 554 return visitor.Renumber(function); |
557 } | 555 } |
558 } // namespace internal | 556 } // namespace internal |
559 } // namespace v8 | 557 } // namespace v8 |
OLD | NEW |