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 2955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2966 \ | 2966 \ |
2967 Zone* zone_; \ | 2967 Zone* zone_; \ |
2968 bool stack_overflow_ | 2968 bool stack_overflow_ |
2969 | 2969 |
2970 | 2970 |
2971 // ---------------------------------------------------------------------------- | 2971 // ---------------------------------------------------------------------------- |
2972 // Construction time visitor. | 2972 // Construction time visitor. |
2973 | 2973 |
2974 class AstConstructionVisitor BASE_EMBEDDED { | 2974 class AstConstructionVisitor BASE_EMBEDDED { |
2975 public: | 2975 public: |
2976 AstConstructionVisitor() : dont_optimize_reason_(kNoReason) { } | 2976 AstConstructionVisitor() |
| 2977 : dont_crankshaft_reason_(kNoReason), dont_turbofan_reason_(kNoReason) {} |
2977 | 2978 |
2978 AstProperties* ast_properties() { return &properties_; } | 2979 AstProperties* ast_properties() { return &properties_; } |
2979 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } | 2980 BailoutReason dont_optimize_reason() { |
| 2981 if (dont_turbofan_reason_ != kNoReason) { |
| 2982 return dont_turbofan_reason_; |
| 2983 } else { |
| 2984 return dont_crankshaft_reason_; |
| 2985 } |
| 2986 } |
2980 | 2987 |
2981 private: | 2988 private: |
2982 template<class> friend class AstNodeFactory; | 2989 template<class> friend class AstNodeFactory; |
2983 | 2990 |
2984 // Node visitors. | 2991 // Node visitors. |
2985 #define DEF_VISIT(type) \ | 2992 #define DEF_VISIT(type) \ |
2986 void Visit##type(type* node); | 2993 void Visit##type(type* node); |
2987 AST_NODE_LIST(DEF_VISIT) | 2994 AST_NODE_LIST(DEF_VISIT) |
2988 #undef DEF_VISIT | 2995 #undef DEF_VISIT |
2989 | 2996 |
2990 void increase_node_count() { properties_.add_node_count(1); } | 2997 void increase_node_count() { properties_.add_node_count(1); } |
2991 void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); } | 2998 void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); } |
2992 void set_dont_optimize_reason(BailoutReason reason) { | 2999 void set_dont_crankshaft_reason(BailoutReason reason) { |
2993 dont_optimize_reason_ = reason; | 3000 dont_crankshaft_reason_ = reason; |
| 3001 } |
| 3002 void set_dont_turbofan_reason(BailoutReason reason) { |
| 3003 dont_turbofan_reason_ = reason; |
2994 } | 3004 } |
2995 | 3005 |
2996 void add_slot_node(FeedbackSlotInterface* slot_node) { | 3006 void add_slot_node(FeedbackSlotInterface* slot_node) { |
2997 int count = slot_node->ComputeFeedbackSlotCount(); | 3007 int count = slot_node->ComputeFeedbackSlotCount(); |
2998 if (count > 0) { | 3008 if (count > 0) { |
2999 slot_node->SetFirstFeedbackSlot(properties_.feedback_slots()); | 3009 slot_node->SetFirstFeedbackSlot(properties_.feedback_slots()); |
3000 properties_.increase_feedback_slots(count); | 3010 properties_.increase_feedback_slots(count); |
3001 } | 3011 } |
3002 } | 3012 } |
3003 | 3013 |
3004 AstProperties properties_; | 3014 AstProperties properties_; |
3005 BailoutReason dont_optimize_reason_; | 3015 BailoutReason dont_crankshaft_reason_; |
| 3016 BailoutReason dont_turbofan_reason_; |
3006 }; | 3017 }; |
3007 | 3018 |
3008 | 3019 |
3009 class AstNullVisitor BASE_EMBEDDED { | 3020 class AstNullVisitor BASE_EMBEDDED { |
3010 public: | 3021 public: |
3011 // Node visitors. | 3022 // Node visitors. |
3012 #define DEF_VISIT(type) \ | 3023 #define DEF_VISIT(type) \ |
3013 void Visit##type(type* node) {} | 3024 void Visit##type(type* node) {} |
3014 AST_NODE_LIST(DEF_VISIT) | 3025 AST_NODE_LIST(DEF_VISIT) |
3015 #undef DEF_VISIT | 3026 #undef DEF_VISIT |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3479 Zone* zone_; | 3490 Zone* zone_; |
3480 Visitor visitor_; | 3491 Visitor visitor_; |
3481 AstValueFactory* ast_value_factory_; | 3492 AstValueFactory* ast_value_factory_; |
3482 AstNode::IdGen* id_gen_; | 3493 AstNode::IdGen* id_gen_; |
3483 }; | 3494 }; |
3484 | 3495 |
3485 | 3496 |
3486 } } // namespace v8::internal | 3497 } } // namespace v8::internal |
3487 | 3498 |
3488 #endif // V8_AST_H_ | 3499 #endif // V8_AST_H_ |
OLD | NEW |