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 2396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2407 bit_field_ = IsUninitializedField::update(bit_field_, b); | 2407 bit_field_ = IsUninitializedField::update(bit_field_, b); |
2408 } | 2408 } |
2409 void set_key_type(IcCheckType key_type) { | 2409 void set_key_type(IcCheckType key_type) { |
2410 bit_field_ = KeyTypeField::update(bit_field_, key_type); | 2410 bit_field_ = KeyTypeField::update(bit_field_, key_type); |
2411 } | 2411 } |
2412 void set_store_mode(KeyedAccessStoreMode mode) { | 2412 void set_store_mode(KeyedAccessStoreMode mode) { |
2413 bit_field_ = StoreModeField::update(bit_field_, mode); | 2413 bit_field_ = StoreModeField::update(bit_field_, mode); |
2414 } | 2414 } |
2415 | 2415 |
2416 void AssignFeedbackSlots(FeedbackVectorSpec* spec, LanguageMode language_mode, | 2416 void AssignFeedbackSlots(FeedbackVectorSpec* spec, LanguageMode language_mode, |
2417 FeedbackSlotCache* cache, | 2417 FeedbackSlotCache* cache); |
2418 bool collect_type_profile = false); | |
2419 FeedbackSlot AssignmentSlot() const { return slot_; } | 2418 FeedbackSlot AssignmentSlot() const { return slot_; } |
2420 | 2419 |
2421 FeedbackSlot TypeProfileSlot() const { | |
2422 DCHECK(HasTypeProfileSlot()); | |
2423 return type_profile_slot_; | |
2424 } | |
2425 | |
2426 bool HasTypeProfileSlot() const { return !type_profile_slot_.IsInvalid(); } | |
2427 | |
2428 private: | 2420 private: |
2429 friend class AstNodeFactory; | 2421 friend class AstNodeFactory; |
2430 | 2422 |
2431 Assignment(Token::Value op, Expression* target, Expression* value, int pos); | 2423 Assignment(Token::Value op, Expression* target, Expression* value, int pos); |
2432 | 2424 |
2433 static int parent_num_ids() { return Expression::num_ids(); } | 2425 static int parent_num_ids() { return Expression::num_ids(); } |
2434 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2426 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
2435 | 2427 |
2436 class IsUninitializedField | 2428 class IsUninitializedField |
2437 : public BitField<bool, Expression::kNextBitFieldIndex, 1> {}; | 2429 : public BitField<bool, Expression::kNextBitFieldIndex, 1> {}; |
2438 class KeyTypeField | 2430 class KeyTypeField |
2439 : public BitField<IcCheckType, IsUninitializedField::kNext, 1> {}; | 2431 : public BitField<IcCheckType, IsUninitializedField::kNext, 1> {}; |
2440 class StoreModeField | 2432 class StoreModeField |
2441 : public BitField<KeyedAccessStoreMode, KeyTypeField::kNext, 3> {}; | 2433 : public BitField<KeyedAccessStoreMode, KeyTypeField::kNext, 3> {}; |
2442 class TokenField : public BitField<Token::Value, StoreModeField::kNext, 7> {}; | 2434 class TokenField : public BitField<Token::Value, StoreModeField::kNext, 7> {}; |
2443 | 2435 |
2444 FeedbackSlot slot_; | 2436 FeedbackSlot slot_; |
2445 Expression* target_; | 2437 Expression* target_; |
2446 Expression* value_; | 2438 Expression* value_; |
2447 BinaryOperation* binary_operation_; | 2439 BinaryOperation* binary_operation_; |
2448 SmallMapList receiver_types_; | 2440 SmallMapList receiver_types_; |
2449 | |
2450 FeedbackSlot type_profile_slot_; | |
2451 }; | 2441 }; |
2452 | 2442 |
2453 | 2443 |
2454 // The RewritableExpression class is a wrapper for AST nodes that wait | 2444 // The RewritableExpression class is a wrapper for AST nodes that wait |
2455 // for some potential rewriting. However, even if such nodes are indeed | 2445 // for some potential rewriting. However, even if such nodes are indeed |
2456 // rewritten, the RewritableExpression wrapper nodes will survive in the | 2446 // rewritten, the RewritableExpression wrapper nodes will survive in the |
2457 // final AST and should be just ignored, i.e., they should be treated as | 2447 // final AST and should be just ignored, i.e., they should be treated as |
2458 // equivalent to the wrapped nodes. For this reason and to simplify later | 2448 // equivalent to the wrapped nodes. For this reason and to simplify later |
2459 // phases, RewritableExpressions are considered as exceptions of AST nodes | 2449 // phases, RewritableExpressions are considered as exceptions of AST nodes |
2460 // in the following sense: | 2450 // in the following sense: |
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3647 : NULL; \ | 3637 : NULL; \ |
3648 } | 3638 } |
3649 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3639 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3650 #undef DECLARE_NODE_FUNCTIONS | 3640 #undef DECLARE_NODE_FUNCTIONS |
3651 | 3641 |
3652 | 3642 |
3653 } // namespace internal | 3643 } // namespace internal |
3654 } // namespace v8 | 3644 } // namespace v8 |
3655 | 3645 |
3656 #endif // V8_AST_AST_H_ | 3646 #endif // V8_AST_AST_H_ |
OLD | NEW |