| 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 #ifndef V8_AST_H_ | 5 #ifndef V8_AST_H_ |
| 6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
| (...skipping 3105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3116 \ | 3116 \ |
| 3117 Zone* zone_; \ | 3117 Zone* zone_; \ |
| 3118 bool stack_overflow_ | 3118 bool stack_overflow_ |
| 3119 | 3119 |
| 3120 | 3120 |
| 3121 // ---------------------------------------------------------------------------- | 3121 // ---------------------------------------------------------------------------- |
| 3122 // Construction time visitor. | 3122 // Construction time visitor. |
| 3123 | 3123 |
| 3124 class AstConstructionVisitor BASE_EMBEDDED { | 3124 class AstConstructionVisitor BASE_EMBEDDED { |
| 3125 public: | 3125 public: |
| 3126 AstConstructionVisitor() | 3126 AstConstructionVisitor() {} |
| 3127 : dont_crankshaft_reason_(kNoReason), dont_turbofan_reason_(kNoReason) {} | |
| 3128 | 3127 |
| 3129 AstProperties* ast_properties() { return &properties_; } | 3128 AstProperties* ast_properties() { return &properties_; } |
| 3130 BailoutReason dont_optimize_reason() { | |
| 3131 if (dont_turbofan_reason_ != kNoReason) { | |
| 3132 return dont_turbofan_reason_; | |
| 3133 } else { | |
| 3134 return dont_crankshaft_reason_; | |
| 3135 } | |
| 3136 } | |
| 3137 | 3129 |
| 3138 private: | 3130 private: |
| 3139 template<class> friend class AstNodeFactory; | 3131 template<class> friend class AstNodeFactory; |
| 3140 | 3132 |
| 3141 // Node visitors. | 3133 // Node visitors. |
| 3142 #define DEF_VISIT(type) \ | 3134 #define DEF_VISIT(type) \ |
| 3143 void Visit##type(type* node); | 3135 void Visit##type(type* node); |
| 3144 AST_NODE_LIST(DEF_VISIT) | 3136 AST_NODE_LIST(DEF_VISIT) |
| 3145 #undef DEF_VISIT | 3137 #undef DEF_VISIT |
| 3146 | 3138 |
| 3147 void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); } | |
| 3148 void set_dont_crankshaft_reason(BailoutReason reason) { | |
| 3149 dont_crankshaft_reason_ = reason; | |
| 3150 } | |
| 3151 void set_dont_turbofan_reason(BailoutReason reason) { | |
| 3152 dont_turbofan_reason_ = reason; | |
| 3153 } | |
| 3154 | |
| 3155 void add_slot_node(AstNode* slot_node) { | 3139 void add_slot_node(AstNode* slot_node) { |
| 3156 FeedbackVectorRequirements reqs = slot_node->ComputeFeedbackRequirements(); | 3140 FeedbackVectorRequirements reqs = slot_node->ComputeFeedbackRequirements(); |
| 3157 if (reqs.slots() > 0) { | 3141 if (reqs.slots() > 0) { |
| 3158 slot_node->SetFirstFeedbackSlot( | 3142 slot_node->SetFirstFeedbackSlot( |
| 3159 FeedbackVectorSlot(properties_.feedback_slots())); | 3143 FeedbackVectorSlot(properties_.feedback_slots())); |
| 3160 properties_.increase_feedback_slots(reqs.slots()); | 3144 properties_.increase_feedback_slots(reqs.slots()); |
| 3161 } | 3145 } |
| 3162 if (reqs.ic_slots() > 0) { | 3146 if (reqs.ic_slots() > 0) { |
| 3163 slot_node->SetFirstFeedbackICSlot( | 3147 slot_node->SetFirstFeedbackICSlot( |
| 3164 FeedbackVectorICSlot(properties_.ic_feedback_slots())); | 3148 FeedbackVectorICSlot(properties_.ic_feedback_slots())); |
| 3165 properties_.increase_ic_feedback_slots(reqs.ic_slots()); | 3149 properties_.increase_ic_feedback_slots(reqs.ic_slots()); |
| 3166 } | 3150 } |
| 3167 } | 3151 } |
| 3168 | 3152 |
| 3169 AstProperties properties_; | 3153 AstProperties properties_; |
| 3170 BailoutReason dont_crankshaft_reason_; | |
| 3171 BailoutReason dont_turbofan_reason_; | |
| 3172 }; | 3154 }; |
| 3173 | 3155 |
| 3174 | 3156 |
| 3175 class AstNullVisitor BASE_EMBEDDED { | 3157 class AstNullVisitor BASE_EMBEDDED { |
| 3176 public: | 3158 public: |
| 3177 // Node visitors. | 3159 // Node visitors. |
| 3178 #define DEF_VISIT(type) \ | 3160 #define DEF_VISIT(type) \ |
| 3179 void Visit##type(type* node) {} | 3161 void Visit##type(type* node) {} |
| 3180 AST_NODE_LIST(DEF_VISIT) | 3162 AST_NODE_LIST(DEF_VISIT) |
| 3181 #undef DEF_VISIT | 3163 #undef DEF_VISIT |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3648 private: | 3630 private: |
| 3649 Zone* zone_; | 3631 Zone* zone_; |
| 3650 Visitor visitor_; | 3632 Visitor visitor_; |
| 3651 AstValueFactory* ast_value_factory_; | 3633 AstValueFactory* ast_value_factory_; |
| 3652 }; | 3634 }; |
| 3653 | 3635 |
| 3654 | 3636 |
| 3655 } } // namespace v8::internal | 3637 } } // namespace v8::internal |
| 3656 | 3638 |
| 3657 #endif // V8_AST_H_ | 3639 #endif // V8_AST_H_ |
| OLD | NEW |