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 2579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2590 enum IdType { kIdTypeInvalid = -1, kIdTypeTopLevel = 0 }; | 2590 enum IdType { kIdTypeInvalid = -1, kIdTypeTopLevel = 0 }; |
2591 | 2591 |
2592 enum ParameterFlag { kNoDuplicateParameters, kHasDuplicateParameters }; | 2592 enum ParameterFlag { kNoDuplicateParameters, kHasDuplicateParameters }; |
2593 | 2593 |
2594 enum EagerCompileHint { kShouldEagerCompile, kShouldLazyCompile }; | 2594 enum EagerCompileHint { kShouldEagerCompile, kShouldLazyCompile }; |
2595 | 2595 |
2596 Handle<String> name() const { return raw_name_->string(); } | 2596 Handle<String> name() const { return raw_name_->string(); } |
2597 const AstString* raw_name() const { return raw_name_; } | 2597 const AstString* raw_name() const { return raw_name_; } |
2598 void set_raw_name(const AstString* name) { raw_name_ = name; } | 2598 void set_raw_name(const AstString* name) { raw_name_ = name; } |
2599 DeclarationScope* scope() const { return scope_; } | 2599 DeclarationScope* scope() const { return scope_; } |
| 2600 |
| 2601 // AST desugaring of initialization of non-simple parameters. If non-null, |
| 2602 // forces Ignition/TF pipeline. |
| 2603 Block* parameter_init_block() const { return parameter_init_block_; } |
| 2604 void set_parameter_init_block(Block* block) { parameter_init_block_ = block; } |
| 2605 |
2600 ZoneList<Statement*>* body() const { return body_; } | 2606 ZoneList<Statement*>* body() const { return body_; } |
2601 void set_function_token_position(int pos) { function_token_position_ = pos; } | 2607 void set_function_token_position(int pos) { function_token_position_ = pos; } |
2602 int function_token_position() const { return function_token_position_; } | 2608 int function_token_position() const { return function_token_position_; } |
2603 int start_position() const; | 2609 int start_position() const; |
2604 int end_position() const; | 2610 int end_position() const; |
2605 int SourceSize() const { return end_position() - start_position(); } | 2611 int SourceSize() const { return end_position() - start_position(); } |
2606 bool is_declaration() const { return function_type() == kDeclaration; } | 2612 bool is_declaration() const { return function_type() == kDeclaration; } |
2607 bool is_named_expression() const { | 2613 bool is_named_expression() const { |
2608 return function_type() == kNamedExpression; | 2614 return function_type() == kNamedExpression; |
2609 } | 2615 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2740 : Expression(position, kFunctionLiteral), | 2746 : Expression(position, kFunctionLiteral), |
2741 materialized_literal_count_(materialized_literal_count), | 2747 materialized_literal_count_(materialized_literal_count), |
2742 expected_property_count_(expected_property_count), | 2748 expected_property_count_(expected_property_count), |
2743 parameter_count_(parameter_count), | 2749 parameter_count_(parameter_count), |
2744 function_length_(function_length), | 2750 function_length_(function_length), |
2745 function_token_position_(kNoSourcePosition), | 2751 function_token_position_(kNoSourcePosition), |
2746 yield_count_(0), | 2752 yield_count_(0), |
2747 has_braces_(has_braces), | 2753 has_braces_(has_braces), |
2748 raw_name_(name), | 2754 raw_name_(name), |
2749 scope_(scope), | 2755 scope_(scope), |
| 2756 parameter_init_block_(nullptr), |
2750 body_(body), | 2757 body_(body), |
2751 raw_inferred_name_(ast_value_factory->empty_string()), | 2758 raw_inferred_name_(ast_value_factory->empty_string()), |
2752 ast_properties_(zone), | 2759 ast_properties_(zone), |
2753 function_literal_id_(function_literal_id) { | 2760 function_literal_id_(function_literal_id) { |
2754 bit_field_ |= FunctionTypeBits::encode(function_type) | | 2761 bit_field_ |= FunctionTypeBits::encode(function_type) | |
2755 Pretenure::encode(false) | | 2762 Pretenure::encode(false) | |
2756 HasDuplicateParameters::encode(has_duplicate_parameters == | 2763 HasDuplicateParameters::encode(has_duplicate_parameters == |
2757 kHasDuplicateParameters) | | 2764 kHasDuplicateParameters) | |
2758 ShouldNotBeUsedOnceHintField::encode(false) | | 2765 ShouldNotBeUsedOnceHintField::encode(false) | |
2759 DontOptimizeReasonField::encode(kNoReason); | 2766 DontOptimizeReasonField::encode(kNoReason); |
(...skipping 13 matching lines...) Expand all Loading... |
2773 int materialized_literal_count_; | 2780 int materialized_literal_count_; |
2774 int expected_property_count_; | 2781 int expected_property_count_; |
2775 int parameter_count_; | 2782 int parameter_count_; |
2776 int function_length_; | 2783 int function_length_; |
2777 int function_token_position_; | 2784 int function_token_position_; |
2778 int yield_count_; | 2785 int yield_count_; |
2779 bool has_braces_; | 2786 bool has_braces_; |
2780 | 2787 |
2781 const AstString* raw_name_; | 2788 const AstString* raw_name_; |
2782 DeclarationScope* scope_; | 2789 DeclarationScope* scope_; |
| 2790 Block* parameter_init_block_; |
2783 ZoneList<Statement*>* body_; | 2791 ZoneList<Statement*>* body_; |
2784 const AstString* raw_inferred_name_; | 2792 const AstString* raw_inferred_name_; |
2785 Handle<String> inferred_name_; | 2793 Handle<String> inferred_name_; |
2786 AstProperties ast_properties_; | 2794 AstProperties ast_properties_; |
2787 int function_literal_id_; | 2795 int function_literal_id_; |
2788 FeedbackVectorSlot literal_feedback_slot_; | 2796 FeedbackVectorSlot literal_feedback_slot_; |
2789 }; | 2797 }; |
2790 | 2798 |
2791 // Property is used for passing information | 2799 // Property is used for passing information |
2792 // about a class literal's properties from the parser to the code generator. | 2800 // about a class literal's properties from the parser to the code generator. |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3655 : NULL; \ | 3663 : NULL; \ |
3656 } | 3664 } |
3657 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3665 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3658 #undef DECLARE_NODE_FUNCTIONS | 3666 #undef DECLARE_NODE_FUNCTIONS |
3659 | 3667 |
3660 | 3668 |
3661 } // namespace internal | 3669 } // namespace internal |
3662 } // namespace v8 | 3670 } // namespace v8 |
3663 | 3671 |
3664 #endif // V8_AST_AST_H_ | 3672 #endif // V8_AST_AST_H_ |
OLD | NEW |