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_AST_H_ | 5 #ifndef V8_AST_AST_H_ |
6 #define V8_AST_AST_H_ | 6 #define V8_AST_AST_H_ |
7 | 7 |
8 #include "src/ast/ast-types.h" | 8 #include "src/ast/ast-types.h" |
9 #include "src/ast/ast-value-factory.h" | 9 #include "src/ast/ast-value-factory.h" |
10 #include "src/ast/modules.h" | 10 #include "src/ast/modules.h" |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 | 970 |
971 FeedbackSlot CompareOperationFeedbackSlot() { return feedback_slot_; } | 971 FeedbackSlot CompareOperationFeedbackSlot() { return feedback_slot_; } |
972 | 972 |
973 private: | 973 private: |
974 friend class AstNodeFactory; | 974 friend class AstNodeFactory; |
975 | 975 |
976 static int parent_num_ids() { return Expression::num_ids(); } | 976 static int parent_num_ids() { return Expression::num_ids(); } |
977 CaseClause(Expression* label, ZoneList<Statement*>* statements, int pos); | 977 CaseClause(Expression* label, ZoneList<Statement*>* statements, int pos); |
978 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 978 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
979 | 979 |
| 980 FeedbackSlot feedback_slot_; |
980 Expression* label_; | 981 Expression* label_; |
981 Label body_target_; | 982 Label body_target_; |
982 ZoneList<Statement*>* statements_; | 983 ZoneList<Statement*>* statements_; |
983 AstType* compare_type_; | 984 AstType* compare_type_; |
984 FeedbackSlot feedback_slot_; | |
985 }; | 985 }; |
986 | 986 |
987 | 987 |
988 class SwitchStatement final : public BreakableStatement { | 988 class SwitchStatement final : public BreakableStatement { |
989 public: | 989 public: |
990 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { | 990 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { |
991 tag_ = tag; | 991 tag_ = tag; |
992 cases_ = cases; | 992 cases_ = cases; |
993 } | 993 } |
994 | 994 |
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2153 if (arg.IsJust()) fixed_right_arg_value_ = arg.FromJust(); | 2153 if (arg.IsJust()) fixed_right_arg_value_ = arg.FromJust(); |
2154 } | 2154 } |
2155 | 2155 |
2156 void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); | 2156 void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); |
2157 | 2157 |
2158 private: | 2158 private: |
2159 friend class AstNodeFactory; | 2159 friend class AstNodeFactory; |
2160 | 2160 |
2161 BinaryOperation(Token::Value op, Expression* left, Expression* right, int pos) | 2161 BinaryOperation(Token::Value op, Expression* left, Expression* right, int pos) |
2162 : Expression(pos, kBinaryOperation), | 2162 : Expression(pos, kBinaryOperation), |
| 2163 left_(left), |
| 2164 right_(right), |
2163 has_fixed_right_arg_(false), | 2165 has_fixed_right_arg_(false), |
2164 fixed_right_arg_value_(0), | 2166 fixed_right_arg_value_(0) { |
2165 left_(left), | |
2166 right_(right) { | |
2167 bit_field_ |= OperatorField::encode(op); | 2167 bit_field_ |= OperatorField::encode(op); |
2168 DCHECK(Token::IsBinaryOp(op)); | 2168 DCHECK(Token::IsBinaryOp(op)); |
2169 } | 2169 } |
2170 | 2170 |
2171 static int parent_num_ids() { return Expression::num_ids(); } | 2171 static int parent_num_ids() { return Expression::num_ids(); } |
2172 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2172 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
2173 | 2173 |
| 2174 FeedbackSlot feedback_slot_; |
| 2175 Expression* left_; |
| 2176 Expression* right_; |
| 2177 Handle<AllocationSite> allocation_site_; |
2174 // TODO(rossberg): the fixed arg should probably be represented as a Constant | 2178 // TODO(rossberg): the fixed arg should probably be represented as a Constant |
2175 // type for the RHS. Currenty it's actually a Maybe<int> | 2179 // type for the RHS. Currenty it's actually a Maybe<int> |
2176 bool has_fixed_right_arg_; | 2180 bool has_fixed_right_arg_; |
2177 int fixed_right_arg_value_; | 2181 int fixed_right_arg_value_; |
2178 Expression* left_; | |
2179 Expression* right_; | |
2180 Handle<AllocationSite> allocation_site_; | |
2181 FeedbackSlot feedback_slot_; | |
2182 | 2182 |
2183 class OperatorField | 2183 class OperatorField |
2184 : public BitField<Token::Value, Expression::kNextBitFieldIndex, 7> {}; | 2184 : public BitField<Token::Value, Expression::kNextBitFieldIndex, 7> {}; |
2185 }; | 2185 }; |
2186 | 2186 |
2187 | 2187 |
2188 class CountOperation final : public Expression { | 2188 class CountOperation final : public Expression { |
2189 public: | 2189 public: |
2190 bool is_prefix() const { return IsPrefixField::decode(bit_field_); } | 2190 bool is_prefix() const { return IsPrefixField::decode(bit_field_); } |
2191 bool is_postfix() const { return !is_prefix(); } | 2191 bool is_postfix() const { return !is_prefix(); } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2299 left_(left), | 2299 left_(left), |
2300 right_(right), | 2300 right_(right), |
2301 combined_type_(AstType::None()) { | 2301 combined_type_(AstType::None()) { |
2302 bit_field_ |= OperatorField::encode(op); | 2302 bit_field_ |= OperatorField::encode(op); |
2303 DCHECK(Token::IsCompareOp(op)); | 2303 DCHECK(Token::IsCompareOp(op)); |
2304 } | 2304 } |
2305 | 2305 |
2306 static int parent_num_ids() { return Expression::num_ids(); } | 2306 static int parent_num_ids() { return Expression::num_ids(); } |
2307 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2307 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
2308 | 2308 |
| 2309 FeedbackSlot feedback_slot_; |
2309 Expression* left_; | 2310 Expression* left_; |
2310 Expression* right_; | 2311 Expression* right_; |
| 2312 AstType* combined_type_; |
2311 | 2313 |
2312 AstType* combined_type_; | |
2313 FeedbackSlot feedback_slot_; | |
2314 class OperatorField | 2314 class OperatorField |
2315 : public BitField<Token::Value, Expression::kNextBitFieldIndex, 7> {}; | 2315 : public BitField<Token::Value, Expression::kNextBitFieldIndex, 7> {}; |
2316 }; | 2316 }; |
2317 | 2317 |
2318 | 2318 |
2319 class Spread final : public Expression { | 2319 class Spread final : public Expression { |
2320 public: | 2320 public: |
2321 Expression* expression() const { return expression_; } | 2321 Expression* expression() const { return expression_; } |
2322 void set_expression(Expression* e) { expression_ = e; } | 2322 void set_expression(Expression* e) { expression_ = e; } |
2323 | 2323 |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2902 | 2902 |
2903 private: | 2903 private: |
2904 friend class AstNodeFactory; | 2904 friend class AstNodeFactory; |
2905 | 2905 |
2906 NativeFunctionLiteral(const AstRawString* name, v8::Extension* extension, | 2906 NativeFunctionLiteral(const AstRawString* name, v8::Extension* extension, |
2907 int pos) | 2907 int pos) |
2908 : Expression(pos, kNativeFunctionLiteral), | 2908 : Expression(pos, kNativeFunctionLiteral), |
2909 name_(name), | 2909 name_(name), |
2910 extension_(extension) {} | 2910 extension_(extension) {} |
2911 | 2911 |
| 2912 FeedbackSlot literal_feedback_slot_; |
2912 const AstRawString* name_; | 2913 const AstRawString* name_; |
2913 v8::Extension* extension_; | 2914 v8::Extension* extension_; |
2914 FeedbackSlot literal_feedback_slot_; | |
2915 }; | 2915 }; |
2916 | 2916 |
2917 | 2917 |
2918 class ThisFunction final : public Expression { | 2918 class ThisFunction final : public Expression { |
2919 private: | 2919 private: |
2920 friend class AstNodeFactory; | 2920 friend class AstNodeFactory; |
2921 explicit ThisFunction(int pos) : Expression(pos, kThisFunction) {} | 2921 explicit ThisFunction(int pos) : Expression(pos, kThisFunction) {} |
2922 }; | 2922 }; |
2923 | 2923 |
2924 | 2924 |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3711 : NULL; \ | 3711 : NULL; \ |
3712 } | 3712 } |
3713 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3713 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3714 #undef DECLARE_NODE_FUNCTIONS | 3714 #undef DECLARE_NODE_FUNCTIONS |
3715 | 3715 |
3716 | 3716 |
3717 } // namespace internal | 3717 } // namespace internal |
3718 } // namespace v8 | 3718 } // namespace v8 |
3719 | 3719 |
3720 #endif // V8_AST_AST_H_ | 3720 #endif // V8_AST_AST_H_ |
OLD | NEW |