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/assembler.h" | 8 #include "src/assembler.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 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2582 | 2582 |
2583 enum ArityRestriction { | 2583 enum ArityRestriction { |
2584 NORMAL_ARITY, | 2584 NORMAL_ARITY, |
2585 GETTER_ARITY, | 2585 GETTER_ARITY, |
2586 SETTER_ARITY | 2586 SETTER_ARITY |
2587 }; | 2587 }; |
2588 | 2588 |
2589 DECLARE_NODE_TYPE(FunctionLiteral) | 2589 DECLARE_NODE_TYPE(FunctionLiteral) |
2590 | 2590 |
2591 Handle<String> name() const { return raw_name_->string(); } | 2591 Handle<String> name() const { return raw_name_->string(); } |
2592 const AstRawString* raw_name() const { return raw_name_; } | 2592 const AstString* raw_name() const { return raw_name_; } |
2593 void set_raw_name(const AstRawString* name) { raw_name_ = name; } | 2593 void set_raw_name(const AstString* name) { raw_name_ = name; } |
2594 Scope* scope() const { return scope_; } | 2594 Scope* scope() const { return scope_; } |
2595 ZoneList<Statement*>* body() const { return body_; } | 2595 ZoneList<Statement*>* body() const { return body_; } |
2596 void set_function_token_position(int pos) { function_token_position_ = pos; } | 2596 void set_function_token_position(int pos) { function_token_position_ = pos; } |
2597 int function_token_position() const { return function_token_position_; } | 2597 int function_token_position() const { return function_token_position_; } |
2598 int start_position() const; | 2598 int start_position() const; |
2599 int end_position() const; | 2599 int end_position() const; |
2600 int SourceSize() const { return end_position() - start_position(); } | 2600 int SourceSize() const { return end_position() - start_position(); } |
2601 bool is_expression() const { return IsExpression::decode(bitfield_); } | 2601 bool is_expression() const { return IsExpression::decode(bitfield_); } |
2602 bool is_anonymous() const { return IsAnonymous::decode(bitfield_); } | 2602 bool is_anonymous() const { return IsAnonymous::decode(bitfield_); } |
2603 LanguageMode language_mode() const; | 2603 LanguageMode language_mode() const; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2685 const FeedbackVectorSpec* feedback_vector_spec() const { | 2685 const FeedbackVectorSpec* feedback_vector_spec() const { |
2686 return ast_properties_.get_spec(); | 2686 return ast_properties_.get_spec(); |
2687 } | 2687 } |
2688 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } | 2688 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } |
2689 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } | 2689 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } |
2690 void set_dont_optimize_reason(BailoutReason reason) { | 2690 void set_dont_optimize_reason(BailoutReason reason) { |
2691 dont_optimize_reason_ = reason; | 2691 dont_optimize_reason_ = reason; |
2692 } | 2692 } |
2693 | 2693 |
2694 protected: | 2694 protected: |
2695 FunctionLiteral(Zone* zone, const AstRawString* name, | 2695 FunctionLiteral(Zone* zone, const AstString* name, |
2696 AstValueFactory* ast_value_factory, Scope* scope, | 2696 AstValueFactory* ast_value_factory, Scope* scope, |
2697 ZoneList<Statement*>* body, int materialized_literal_count, | 2697 ZoneList<Statement*>* body, int materialized_literal_count, |
2698 int expected_property_count, int parameter_count, | 2698 int expected_property_count, int parameter_count, |
2699 FunctionType function_type, | 2699 FunctionType function_type, |
2700 ParameterFlag has_duplicate_parameters, | 2700 ParameterFlag has_duplicate_parameters, |
2701 IsFunctionFlag is_function, | 2701 IsFunctionFlag is_function, |
2702 EagerCompileHint eager_compile_hint, FunctionKind kind, | 2702 EagerCompileHint eager_compile_hint, FunctionKind kind, |
2703 int position) | 2703 int position) |
2704 : Expression(zone, position), | 2704 : Expression(zone, position), |
2705 raw_name_(name), | 2705 raw_name_(name), |
(...skipping 11 matching lines...) Expand all Loading... |
2717 Pretenure::encode(false) | | 2717 Pretenure::encode(false) | |
2718 HasDuplicateParameters::encode(has_duplicate_parameters) | | 2718 HasDuplicateParameters::encode(has_duplicate_parameters) | |
2719 IsFunction::encode(is_function) | | 2719 IsFunction::encode(is_function) | |
2720 EagerCompileHintBit::encode(eager_compile_hint) | | 2720 EagerCompileHintBit::encode(eager_compile_hint) | |
2721 FunctionKindBits::encode(kind) | | 2721 FunctionKindBits::encode(kind) | |
2722 ShouldBeUsedOnceHintBit::encode(kDontKnowIfShouldBeUsedOnce); | 2722 ShouldBeUsedOnceHintBit::encode(kDontKnowIfShouldBeUsedOnce); |
2723 DCHECK(IsValidFunctionKind(kind)); | 2723 DCHECK(IsValidFunctionKind(kind)); |
2724 } | 2724 } |
2725 | 2725 |
2726 private: | 2726 private: |
2727 const AstRawString* raw_name_; | 2727 const AstString* raw_name_; |
2728 Handle<String> name_; | 2728 Handle<String> name_; |
2729 Scope* scope_; | 2729 Scope* scope_; |
2730 ZoneList<Statement*>* body_; | 2730 ZoneList<Statement*>* body_; |
2731 const AstString* raw_inferred_name_; | 2731 const AstString* raw_inferred_name_; |
2732 Handle<String> inferred_name_; | 2732 Handle<String> inferred_name_; |
2733 AstProperties ast_properties_; | 2733 AstProperties ast_properties_; |
2734 BailoutReason dont_optimize_reason_; | 2734 BailoutReason dont_optimize_reason_; |
2735 | 2735 |
2736 int materialized_literal_count_; | 2736 int materialized_literal_count_; |
2737 int expected_property_count_; | 2737 int expected_property_count_; |
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3769 // the parser-level zone. | 3769 // the parser-level zone. |
3770 Zone* parser_zone_; | 3770 Zone* parser_zone_; |
3771 AstValueFactory* ast_value_factory_; | 3771 AstValueFactory* ast_value_factory_; |
3772 }; | 3772 }; |
3773 | 3773 |
3774 | 3774 |
3775 } // namespace internal | 3775 } // namespace internal |
3776 } // namespace v8 | 3776 } // namespace v8 |
3777 | 3777 |
3778 #endif // V8_AST_AST_H_ | 3778 #endif // V8_AST_AST_H_ |
OLD | NEW |