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_H_ | 5 #ifndef V8_AST_H_ |
6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 V(Property) \ | 80 V(Property) \ |
81 V(Call) \ | 81 V(Call) \ |
82 V(CallNew) \ | 82 V(CallNew) \ |
83 V(CallRuntime) \ | 83 V(CallRuntime) \ |
84 V(UnaryOperation) \ | 84 V(UnaryOperation) \ |
85 V(CountOperation) \ | 85 V(CountOperation) \ |
86 V(BinaryOperation) \ | 86 V(BinaryOperation) \ |
87 V(CompareOperation) \ | 87 V(CompareOperation) \ |
88 V(Spread) \ | 88 V(Spread) \ |
89 V(ThisFunction) \ | 89 V(ThisFunction) \ |
90 V(SuperPropertyReference) \ | 90 V(SuperReference) \ |
91 V(SuperCallReference) \ | |
92 V(CaseClause) | 91 V(CaseClause) |
93 | 92 |
94 #define AST_NODE_LIST(V) \ | 93 #define AST_NODE_LIST(V) \ |
95 DECLARATION_NODE_LIST(V) \ | 94 DECLARATION_NODE_LIST(V) \ |
96 STATEMENT_NODE_LIST(V) \ | 95 STATEMENT_NODE_LIST(V) \ |
97 EXPRESSION_NODE_LIST(V) | 96 EXPRESSION_NODE_LIST(V) |
98 | 97 |
99 // Forward declarations | 98 // Forward declarations |
100 class AstNodeFactory; | 99 class AstNodeFactory; |
101 class AstVisitor; | 100 class AstVisitor; |
(...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 bit_field_ = KeyTypeField::update(bit_field_, key_type); | 1753 bit_field_ = KeyTypeField::update(bit_field_, key_type); |
1755 } | 1754 } |
1756 void set_inline_cache_state(InlineCacheState state) { | 1755 void set_inline_cache_state(InlineCacheState state) { |
1757 bit_field_ = InlineCacheStateField::update(bit_field_, state); | 1756 bit_field_ = InlineCacheStateField::update(bit_field_, state); |
1758 } | 1757 } |
1759 void mark_for_call() { | 1758 void mark_for_call() { |
1760 bit_field_ = IsForCallField::update(bit_field_, true); | 1759 bit_field_ = IsForCallField::update(bit_field_, true); |
1761 } | 1760 } |
1762 bool is_for_call() const { return IsForCallField::decode(bit_field_); } | 1761 bool is_for_call() const { return IsForCallField::decode(bit_field_); } |
1763 | 1762 |
1764 bool IsSuperAccess() { return obj()->IsSuperPropertyReference(); } | 1763 bool IsSuperAccess() { |
| 1764 return obj()->IsSuperReference(); |
| 1765 } |
1765 | 1766 |
1766 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( | 1767 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( |
1767 Isolate* isolate, const ICSlotCache* cache) override { | 1768 Isolate* isolate, const ICSlotCache* cache) override { |
1768 return FeedbackVectorRequirements(0, 1); | 1769 return FeedbackVectorRequirements(0, 1); |
1769 } | 1770 } |
1770 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, | 1771 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
1771 ICSlotCache* cache) override { | 1772 ICSlotCache* cache) override { |
1772 property_feedback_slot_ = slot; | 1773 property_feedback_slot_ = slot; |
1773 } | 1774 } |
1774 Code::Kind FeedbackICSlotKind(int index) override { | 1775 Code::Kind FeedbackICSlotKind(int index) override { |
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2783 | 2784 |
2784 class ThisFunction final : public Expression { | 2785 class ThisFunction final : public Expression { |
2785 public: | 2786 public: |
2786 DECLARE_NODE_TYPE(ThisFunction) | 2787 DECLARE_NODE_TYPE(ThisFunction) |
2787 | 2788 |
2788 protected: | 2789 protected: |
2789 ThisFunction(Zone* zone, int pos) : Expression(zone, pos) {} | 2790 ThisFunction(Zone* zone, int pos) : Expression(zone, pos) {} |
2790 }; | 2791 }; |
2791 | 2792 |
2792 | 2793 |
2793 class SuperPropertyReference final : public Expression { | 2794 class SuperReference final : public Expression { |
2794 public: | 2795 public: |
2795 DECLARE_NODE_TYPE(SuperPropertyReference) | 2796 DECLARE_NODE_TYPE(SuperReference) |
2796 | 2797 |
2797 VariableProxy* this_var() const { return this_var_; } | 2798 VariableProxy* this_var() const { return this_var_; } |
2798 VariableProxy* home_object_var() const { return home_object_var_; } | 2799 VariableProxy* home_object_var() const { return home_object_var_; } |
2799 | 2800 |
2800 protected: | 2801 protected: |
2801 SuperPropertyReference(Zone* zone, VariableProxy* this_var, | 2802 SuperReference(Zone* zone, VariableProxy* this_var, |
2802 VariableProxy* home_object_var, int pos) | 2803 VariableProxy* home_object_var, int pos) |
2803 : Expression(zone, pos), | 2804 : Expression(zone, pos), |
2804 this_var_(this_var), | 2805 this_var_(this_var), |
2805 home_object_var_(home_object_var) { | 2806 home_object_var_(home_object_var) { |
2806 DCHECK(this_var->is_this()); | 2807 DCHECK(this_var->is_this()); |
2807 DCHECK(home_object_var->raw_name()->IsOneByteEqualTo(".home_object")); | 2808 DCHECK(home_object_var->raw_name()->IsOneByteEqualTo(".home_object")); |
2808 } | 2809 } |
2809 | 2810 |
2810 private: | 2811 private: |
2811 VariableProxy* this_var_; | 2812 VariableProxy* this_var_; |
2812 VariableProxy* home_object_var_; | 2813 VariableProxy* home_object_var_; |
2813 }; | 2814 }; |
2814 | 2815 |
2815 | 2816 |
2816 class SuperCallReference final : public Expression { | |
2817 public: | |
2818 DECLARE_NODE_TYPE(SuperCallReference) | |
2819 | |
2820 VariableProxy* this_var() const { return this_var_; } | |
2821 VariableProxy* new_target_var() const { return new_target_var_; } | |
2822 VariableProxy* this_function_var() const { return this_function_var_; } | |
2823 | |
2824 protected: | |
2825 SuperCallReference(Zone* zone, VariableProxy* this_var, | |
2826 VariableProxy* new_target_var, | |
2827 VariableProxy* this_function_var, int pos) | |
2828 : Expression(zone, pos), | |
2829 this_var_(this_var), | |
2830 new_target_var_(new_target_var), | |
2831 this_function_var_(this_function_var) { | |
2832 DCHECK(this_var->is_this()); | |
2833 DCHECK(new_target_var->raw_name()->IsOneByteEqualTo("new.target")); | |
2834 DCHECK(this_function_var->raw_name()->IsOneByteEqualTo(".this_function")); | |
2835 } | |
2836 | |
2837 private: | |
2838 VariableProxy* this_var_; | |
2839 VariableProxy* new_target_var_; | |
2840 VariableProxy* this_function_var_; | |
2841 }; | |
2842 | |
2843 | |
2844 #undef DECLARE_NODE_TYPE | 2817 #undef DECLARE_NODE_TYPE |
2845 | 2818 |
2846 | 2819 |
2847 // ---------------------------------------------------------------------------- | 2820 // ---------------------------------------------------------------------------- |
2848 // Regular expressions | 2821 // Regular expressions |
2849 | 2822 |
2850 | 2823 |
2851 class RegExpVisitor BASE_EMBEDDED { | 2824 class RegExpVisitor BASE_EMBEDDED { |
2852 public: | 2825 public: |
2853 virtual ~RegExpVisitor() { } | 2826 virtual ~RegExpVisitor() { } |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3601 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, | 3574 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, |
3602 v8::Extension* extension, | 3575 v8::Extension* extension, |
3603 int pos) { | 3576 int pos) { |
3604 return new (zone_) NativeFunctionLiteral(zone_, name, extension, pos); | 3577 return new (zone_) NativeFunctionLiteral(zone_, name, extension, pos); |
3605 } | 3578 } |
3606 | 3579 |
3607 ThisFunction* NewThisFunction(int pos) { | 3580 ThisFunction* NewThisFunction(int pos) { |
3608 return new (zone_) ThisFunction(zone_, pos); | 3581 return new (zone_) ThisFunction(zone_, pos); |
3609 } | 3582 } |
3610 | 3583 |
3611 SuperPropertyReference* NewSuperPropertyReference( | 3584 SuperReference* NewSuperReference(VariableProxy* this_var, |
3612 VariableProxy* this_var, VariableProxy* home_object_var, int pos) { | 3585 VariableProxy* home_object_var, int pos) { |
3613 return new (zone_) | 3586 return new (zone_) SuperReference(zone_, this_var, home_object_var, pos); |
3614 SuperPropertyReference(zone_, this_var, home_object_var, pos); | |
3615 } | |
3616 | |
3617 SuperCallReference* NewSuperCallReference(VariableProxy* this_var, | |
3618 VariableProxy* new_target_var, | |
3619 VariableProxy* this_function_var, | |
3620 int pos) { | |
3621 return new (zone_) SuperCallReference(zone_, this_var, new_target_var, | |
3622 this_function_var, pos); | |
3623 } | 3587 } |
3624 | 3588 |
3625 private: | 3589 private: |
3626 Zone* zone_; | 3590 Zone* zone_; |
3627 AstValueFactory* ast_value_factory_; | 3591 AstValueFactory* ast_value_factory_; |
3628 }; | 3592 }; |
3629 | 3593 |
3630 | 3594 |
3631 } } // namespace v8::internal | 3595 } } // namespace v8::internal |
3632 | 3596 |
3633 #endif // V8_AST_H_ | 3597 #endif // V8_AST_H_ |
OLD | NEW |