| 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 2585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2596 bool is_named_expression() const { | 2596 bool is_named_expression() const { |
| 2597 return function_type() == kNamedExpression; | 2597 return function_type() == kNamedExpression; |
| 2598 } | 2598 } |
| 2599 bool is_anonymous_expression() const { | 2599 bool is_anonymous_expression() const { |
| 2600 return function_type() == kAnonymousExpression; | 2600 return function_type() == kAnonymousExpression; |
| 2601 } | 2601 } |
| 2602 LanguageMode language_mode() const; | 2602 LanguageMode language_mode() const; |
| 2603 | 2603 |
| 2604 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 2604 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 2605 FeedbackVectorSlotCache* cache) { | 2605 FeedbackVectorSlotCache* cache) { |
| 2606 // The + 1 is because we need an array with room for the literals | 2606 literal_feedback_slot_ = spec->AddCreateClosureSlot(); |
| 2607 // as well as the feedback vector. | |
| 2608 literal_feedback_slot_ = | |
| 2609 spec->AddCreateClosureSlot(materialized_literal_count_ + 1); | |
| 2610 } | 2607 } |
| 2611 | 2608 |
| 2612 FeedbackVectorSlot LiteralFeedbackSlot() const { | 2609 FeedbackVectorSlot LiteralFeedbackSlot() const { |
| 2613 return literal_feedback_slot_; | 2610 return literal_feedback_slot_; |
| 2614 } | 2611 } |
| 2615 | 2612 |
| 2616 static bool NeedsHomeObject(Expression* expr); | 2613 static bool NeedsHomeObject(Expression* expr); |
| 2617 | 2614 |
| 2618 int materialized_literal_count() { return materialized_literal_count_; } | 2615 int materialized_literal_count() { return materialized_literal_count_; } |
| 2619 int expected_property_count() { return expected_property_count_; } | 2616 int expected_property_count() { return expected_property_count_; } |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2866 class NativeFunctionLiteral final : public Expression { | 2863 class NativeFunctionLiteral final : public Expression { |
| 2867 public: | 2864 public: |
| 2868 Handle<String> name() const { return name_->string(); } | 2865 Handle<String> name() const { return name_->string(); } |
| 2869 v8::Extension* extension() const { return extension_; } | 2866 v8::Extension* extension() const { return extension_; } |
| 2870 FeedbackVectorSlot LiteralFeedbackSlot() const { | 2867 FeedbackVectorSlot LiteralFeedbackSlot() const { |
| 2871 return literal_feedback_slot_; | 2868 return literal_feedback_slot_; |
| 2872 } | 2869 } |
| 2873 | 2870 |
| 2874 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 2871 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 2875 FeedbackVectorSlotCache* cache) { | 2872 FeedbackVectorSlotCache* cache) { |
| 2876 // 0 is a magic number here. It means we are holding the literals | |
| 2877 // array for a native function literal, which needs to be | |
| 2878 // the empty literals array. | |
| 2879 // TODO(mvstanton): The FeedbackVectorSlotCache can be adapted | 2873 // TODO(mvstanton): The FeedbackVectorSlotCache can be adapted |
| 2880 // to always return the same slot for this case. | 2874 // to always return the same slot for this case. |
| 2881 literal_feedback_slot_ = spec->AddCreateClosureSlot(0); | 2875 literal_feedback_slot_ = spec->AddCreateClosureSlot(); |
| 2882 } | 2876 } |
| 2883 | 2877 |
| 2884 private: | 2878 private: |
| 2885 friend class AstNodeFactory; | 2879 friend class AstNodeFactory; |
| 2886 | 2880 |
| 2887 NativeFunctionLiteral(const AstRawString* name, v8::Extension* extension, | 2881 NativeFunctionLiteral(const AstRawString* name, v8::Extension* extension, |
| 2888 int pos) | 2882 int pos) |
| 2889 : Expression(pos, kNativeFunctionLiteral), | 2883 : Expression(pos, kNativeFunctionLiteral), |
| 2890 name_(name), | 2884 name_(name), |
| 2891 extension_(extension) {} | 2885 extension_(extension) {} |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3652 : NULL; \ | 3646 : NULL; \ |
| 3653 } | 3647 } |
| 3654 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3648 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
| 3655 #undef DECLARE_NODE_FUNCTIONS | 3649 #undef DECLARE_NODE_FUNCTIONS |
| 3656 | 3650 |
| 3657 | 3651 |
| 3658 } // namespace internal | 3652 } // namespace internal |
| 3659 } // namespace v8 | 3653 } // namespace v8 |
| 3660 | 3654 |
| 3661 #endif // V8_AST_AST_H_ | 3655 #endif // V8_AST_AST_H_ |
| OLD | NEW |