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