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 3097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3108 \ | 3108 \ |
3109 Zone* zone_; \ | 3109 Zone* zone_; \ |
3110 bool stack_overflow_ | 3110 bool stack_overflow_ |
3111 | 3111 |
3112 | 3112 |
3113 // ---------------------------------------------------------------------------- | 3113 // ---------------------------------------------------------------------------- |
3114 // Construction time visitor. | 3114 // Construction time visitor. |
3115 | 3115 |
3116 class AstConstructionVisitor BASE_EMBEDDED { | 3116 class AstConstructionVisitor BASE_EMBEDDED { |
3117 public: | 3117 public: |
3118 AstConstructionVisitor() | 3118 AstConstructionVisitor() {} |
3119 : dont_crankshaft_reason_(kNoReason), dont_turbofan_reason_(kNoReason) {} | |
3120 | 3119 |
3121 AstProperties* ast_properties() { return &properties_; } | 3120 AstProperties* ast_properties() { return &properties_; } |
3122 BailoutReason dont_optimize_reason() { | |
3123 if (dont_turbofan_reason_ != kNoReason) { | |
3124 return dont_turbofan_reason_; | |
3125 } else { | |
3126 return dont_crankshaft_reason_; | |
3127 } | |
3128 } | |
3129 | 3121 |
3130 private: | 3122 private: |
3131 template<class> friend class AstNodeFactory; | 3123 template<class> friend class AstNodeFactory; |
3132 | 3124 |
3133 // Node visitors. | 3125 // Node visitors. |
3134 #define DEF_VISIT(type) \ | 3126 #define DEF_VISIT(type) \ |
3135 void Visit##type(type* node); | 3127 void Visit##type(type* node); |
3136 AST_NODE_LIST(DEF_VISIT) | 3128 AST_NODE_LIST(DEF_VISIT) |
3137 #undef DEF_VISIT | 3129 #undef DEF_VISIT |
3138 | 3130 |
3139 void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); } | |
3140 void set_dont_crankshaft_reason(BailoutReason reason) { | |
3141 dont_crankshaft_reason_ = reason; | |
3142 } | |
3143 void set_dont_turbofan_reason(BailoutReason reason) { | |
3144 dont_turbofan_reason_ = reason; | |
3145 } | |
3146 | |
3147 void add_slot_node(AstNode* slot_node) { | 3131 void add_slot_node(AstNode* slot_node) { |
3148 FeedbackVectorRequirements reqs = slot_node->ComputeFeedbackRequirements(); | 3132 FeedbackVectorRequirements reqs = slot_node->ComputeFeedbackRequirements(); |
3149 if (reqs.slots() > 0) { | 3133 if (reqs.slots() > 0) { |
3150 slot_node->SetFirstFeedbackSlot( | 3134 slot_node->SetFirstFeedbackSlot( |
3151 FeedbackVectorSlot(properties_.feedback_slots())); | 3135 FeedbackVectorSlot(properties_.feedback_slots())); |
3152 properties_.increase_feedback_slots(reqs.slots()); | 3136 properties_.increase_feedback_slots(reqs.slots()); |
3153 } | 3137 } |
3154 if (reqs.ic_slots() > 0) { | 3138 if (reqs.ic_slots() > 0) { |
3155 slot_node->SetFirstFeedbackICSlot( | 3139 slot_node->SetFirstFeedbackICSlot( |
3156 FeedbackVectorICSlot(properties_.ic_feedback_slots())); | 3140 FeedbackVectorICSlot(properties_.ic_feedback_slots())); |
3157 properties_.increase_ic_feedback_slots(reqs.ic_slots()); | 3141 properties_.increase_ic_feedback_slots(reqs.ic_slots()); |
3158 } | 3142 } |
3159 } | 3143 } |
3160 | 3144 |
3161 AstProperties properties_; | 3145 AstProperties properties_; |
3162 BailoutReason dont_crankshaft_reason_; | |
3163 BailoutReason dont_turbofan_reason_; | |
3164 }; | 3146 }; |
3165 | 3147 |
3166 | 3148 |
3167 class AstNullVisitor BASE_EMBEDDED { | 3149 class AstNullVisitor BASE_EMBEDDED { |
3168 public: | 3150 public: |
3169 // Node visitors. | 3151 // Node visitors. |
3170 #define DEF_VISIT(type) \ | 3152 #define DEF_VISIT(type) \ |
3171 void Visit##type(type* node) {} | 3153 void Visit##type(type* node) {} |
3172 AST_NODE_LIST(DEF_VISIT) | 3154 AST_NODE_LIST(DEF_VISIT) |
3173 #undef DEF_VISIT | 3155 #undef DEF_VISIT |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3640 private: | 3622 private: |
3641 Zone* zone_; | 3623 Zone* zone_; |
3642 Visitor visitor_; | 3624 Visitor visitor_; |
3643 AstValueFactory* ast_value_factory_; | 3625 AstValueFactory* ast_value_factory_; |
3644 }; | 3626 }; |
3645 | 3627 |
3646 | 3628 |
3647 } } // namespace v8::internal | 3629 } } // namespace v8::internal |
3648 | 3630 |
3649 #endif // V8_AST_H_ | 3631 #endif // V8_AST_H_ |
OLD | NEW |