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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 | 897 |
898 class ReturnStatement final : public JumpStatement { | 898 class ReturnStatement final : public JumpStatement { |
899 public: | 899 public: |
900 enum Type { kNormal, kAsyncReturn }; | 900 enum Type { kNormal, kAsyncReturn }; |
901 Expression* expression() const { return expression_; } | 901 Expression* expression() const { return expression_; } |
902 | 902 |
903 void set_expression(Expression* e) { expression_ = e; } | 903 void set_expression(Expression* e) { expression_ = e; } |
904 Type type() const { return TypeField::decode(bit_field_); } | 904 Type type() const { return TypeField::decode(bit_field_); } |
905 bool is_async_return() const { return type() == kAsyncReturn; } | 905 bool is_async_return() const { return type() == kAsyncReturn; } |
906 | 906 |
| 907 FeedbackSlot TypeProfileSlot() const { |
| 908 DCHECK(HasTypeProfileSlot()); |
| 909 return type_profile_slot_; |
| 910 } |
| 911 |
| 912 void SetTypeProfileSlot(FeedbackSlot slot) { type_profile_slot_ = slot; } |
| 913 |
| 914 bool HasTypeProfileSlot() const { return !type_profile_slot_.IsInvalid(); } |
| 915 |
907 private: | 916 private: |
908 friend class AstNodeFactory; | 917 friend class AstNodeFactory; |
909 | 918 |
910 ReturnStatement(Expression* expression, Type type, int pos) | 919 ReturnStatement(Expression* expression, Type type, int pos) |
911 : JumpStatement(pos, kReturnStatement), expression_(expression) { | 920 : JumpStatement(pos, kReturnStatement), expression_(expression) { |
912 bit_field_ |= TypeField::encode(type); | 921 bit_field_ |= TypeField::encode(type); |
913 } | 922 } |
914 | 923 |
| 924 FeedbackSlot type_profile_slot_; |
| 925 |
915 Expression* expression_; | 926 Expression* expression_; |
916 | 927 |
917 class TypeField | 928 class TypeField |
918 : public BitField<Type, JumpStatement::kNextBitFieldIndex, 1> {}; | 929 : public BitField<Type, JumpStatement::kNextBitFieldIndex, 1> {}; |
919 }; | 930 }; |
920 | 931 |
921 | 932 |
922 class WithStatement final : public Statement { | 933 class WithStatement final : public Statement { |
923 public: | 934 public: |
924 Scope* scope() { return scope_; } | 935 Scope* scope() { return scope_; } |
(...skipping 2722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3647 : NULL; \ | 3658 : NULL; \ |
3648 } | 3659 } |
3649 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3660 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3650 #undef DECLARE_NODE_FUNCTIONS | 3661 #undef DECLARE_NODE_FUNCTIONS |
3651 | 3662 |
3652 | 3663 |
3653 } // namespace internal | 3664 } // namespace internal |
3654 } // namespace v8 | 3665 } // namespace v8 |
3655 | 3666 |
3656 #endif // V8_AST_AST_H_ | 3667 #endif // V8_AST_AST_H_ |
OLD | NEW |