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 3170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3181 \ | 3181 \ |
3182 Zone* zone_; \ | 3182 Zone* zone_; \ |
3183 bool stack_overflow_ | 3183 bool stack_overflow_ |
3184 | 3184 |
3185 | 3185 |
3186 // ---------------------------------------------------------------------------- | 3186 // ---------------------------------------------------------------------------- |
3187 // Construction time visitor. | 3187 // Construction time visitor. |
3188 | 3188 |
3189 class AstConstructionVisitor BASE_EMBEDDED { | 3189 class AstConstructionVisitor BASE_EMBEDDED { |
3190 public: | 3190 public: |
3191 AstConstructionVisitor() | 3191 AstConstructionVisitor() {} |
3192 : dont_crankshaft_reason_(kNoReason), dont_turbofan_reason_(kNoReason) {} | |
3193 | 3192 |
3194 AstProperties* ast_properties() { return &properties_; } | 3193 AstProperties* ast_properties() { return &properties_; } |
3195 BailoutReason dont_optimize_reason() { | |
3196 if (dont_turbofan_reason_ != kNoReason) { | |
3197 return dont_turbofan_reason_; | |
3198 } else { | |
3199 return dont_crankshaft_reason_; | |
3200 } | |
3201 } | |
3202 | 3194 |
3203 private: | 3195 private: |
3204 template<class> friend class AstNodeFactory; | 3196 template<class> friend class AstNodeFactory; |
3205 | 3197 |
3206 // Node visitors. | 3198 // Node visitors. |
3207 #define DEF_VISIT(type) \ | 3199 #define DEF_VISIT(type) \ |
3208 void Visit##type(type* node); | 3200 void Visit##type(type* node); |
3209 AST_NODE_LIST(DEF_VISIT) | 3201 AST_NODE_LIST(DEF_VISIT) |
3210 #undef DEF_VISIT | 3202 #undef DEF_VISIT |
3211 | 3203 |
3212 void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); } | |
3213 void set_dont_crankshaft_reason(BailoutReason reason) { | |
3214 dont_crankshaft_reason_ = reason; | |
3215 } | |
3216 void set_dont_turbofan_reason(BailoutReason reason) { | |
3217 dont_turbofan_reason_ = reason; | |
3218 } | |
3219 | |
3220 void add_slot_node(AstNode* slot_node) { | 3204 void add_slot_node(AstNode* slot_node) { |
3221 FeedbackVectorRequirements reqs = slot_node->ComputeFeedbackRequirements(); | 3205 FeedbackVectorRequirements reqs = slot_node->ComputeFeedbackRequirements(); |
3222 if (reqs.slots() > 0) { | 3206 if (reqs.slots() > 0) { |
3223 slot_node->SetFirstFeedbackSlot( | 3207 slot_node->SetFirstFeedbackSlot( |
3224 FeedbackVectorSlot(properties_.feedback_slots())); | 3208 FeedbackVectorSlot(properties_.feedback_slots())); |
3225 properties_.increase_feedback_slots(reqs.slots()); | 3209 properties_.increase_feedback_slots(reqs.slots()); |
3226 } | 3210 } |
3227 if (reqs.ic_slots() > 0) { | 3211 if (reqs.ic_slots() > 0) { |
3228 slot_node->SetFirstFeedbackICSlot( | 3212 slot_node->SetFirstFeedbackICSlot( |
3229 FeedbackVectorICSlot(properties_.ic_feedback_slots())); | 3213 FeedbackVectorICSlot(properties_.ic_feedback_slots())); |
3230 properties_.increase_ic_feedback_slots(reqs.ic_slots()); | 3214 properties_.increase_ic_feedback_slots(reqs.ic_slots()); |
3231 } | 3215 } |
3232 } | 3216 } |
3233 | 3217 |
3234 AstProperties properties_; | 3218 AstProperties properties_; |
3235 BailoutReason dont_crankshaft_reason_; | |
3236 BailoutReason dont_turbofan_reason_; | |
3237 }; | 3219 }; |
3238 | 3220 |
3239 | 3221 |
3240 class AstNullVisitor BASE_EMBEDDED { | 3222 class AstNullVisitor BASE_EMBEDDED { |
3241 public: | 3223 public: |
3242 // Node visitors. | 3224 // Node visitors. |
3243 #define DEF_VISIT(type) \ | 3225 #define DEF_VISIT(type) \ |
3244 void Visit##type(type* node) {} | 3226 void Visit##type(type* node) {} |
3245 AST_NODE_LIST(DEF_VISIT) | 3227 AST_NODE_LIST(DEF_VISIT) |
3246 #undef DEF_VISIT | 3228 #undef DEF_VISIT |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3706 private: | 3688 private: |
3707 Zone* zone_; | 3689 Zone* zone_; |
3708 Visitor visitor_; | 3690 Visitor visitor_; |
3709 AstValueFactory* ast_value_factory_; | 3691 AstValueFactory* ast_value_factory_; |
3710 }; | 3692 }; |
3711 | 3693 |
3712 | 3694 |
3713 } } // namespace v8::internal | 3695 } } // namespace v8::internal |
3714 | 3696 |
3715 #endif // V8_AST_H_ | 3697 #endif // V8_AST_H_ |
OLD | NEW |