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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
934 | 934 |
935 class ForInStatement FINAL : public ForEachStatement { | 935 class ForInStatement FINAL : public ForEachStatement { |
936 public: | 936 public: |
937 DECLARE_NODE_TYPE(ForInStatement) | 937 DECLARE_NODE_TYPE(ForInStatement) |
938 | 938 |
939 Expression* enumerable() const { | 939 Expression* enumerable() const { |
940 return subject(); | 940 return subject(); |
941 } | 941 } |
942 | 942 |
943 // Type feedback information. | 943 // Type feedback information. |
944 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() { | 944 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { |
945 return FeedbackVectorRequirements(1, 0); | 945 return FeedbackVectorRequirements(1, 0); |
946 } | 946 } |
947 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) { | 947 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE { |
948 for_in_feedback_slot_ = slot; | 948 for_in_feedback_slot_ = slot; |
949 } | 949 } |
950 | 950 |
951 FeedbackVectorSlot ForInFeedbackSlot() { | 951 FeedbackVectorSlot ForInFeedbackSlot() { |
952 DCHECK(!for_in_feedback_slot_.IsInvalid()); | 952 DCHECK(!for_in_feedback_slot_.IsInvalid()); |
953 return for_in_feedback_slot_; | 953 return for_in_feedback_slot_; |
954 } | 954 } |
955 | 955 |
956 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; | 956 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; |
957 ForInType for_in_type() const { return for_in_type_; } | 957 ForInType for_in_type() const { return for_in_type_; } |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1703 void set_is_assigned() { is_assigned_ = true; } | 1703 void set_is_assigned() { is_assigned_ = true; } |
1704 | 1704 |
1705 bool is_resolved() const { return is_resolved_; } | 1705 bool is_resolved() const { return is_resolved_; } |
1706 void set_is_resolved() { is_resolved_ = true; } | 1706 void set_is_resolved() { is_resolved_ = true; } |
1707 | 1707 |
1708 Interface* interface() const { return interface_; } | 1708 Interface* interface() const { return interface_; } |
1709 | 1709 |
1710 // Bind this proxy to the variable var. Interfaces must match. | 1710 // Bind this proxy to the variable var. Interfaces must match. |
1711 void BindTo(Variable* var); | 1711 void BindTo(Variable* var); |
1712 | 1712 |
1713 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() { | 1713 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { |
1714 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); | 1714 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); |
1715 } | 1715 } |
1716 virtual void SetFirstICFeedbackSlot(FeedbackVectorICSlot slot) { | 1716 virtual void SetFirstICFeedbackSlot(FeedbackVectorICSlot slot) { |
Jakob Kummerow
2014/10/29 10:17:45
The fact that we don't need OVERRIDE here smells b
| |
1717 variable_feedback_slot_ = slot; | 1717 variable_feedback_slot_ = slot; |
1718 } | 1718 } |
1719 | 1719 |
1720 FeedbackVectorICSlot VariableFeedbackSlot() { | 1720 FeedbackVectorICSlot VariableFeedbackSlot() { |
1721 return variable_feedback_slot_; | 1721 return variable_feedback_slot_; |
1722 } | 1722 } |
1723 | 1723 |
1724 protected: | 1724 protected: |
1725 VariableProxy(Zone* zone, Variable* var, int position); | 1725 VariableProxy(Zone* zone, Variable* var, int position); |
1726 | 1726 |
(...skipping 30 matching lines...) Expand all Loading... | |
1757 // Type feedback information. | 1757 // Type feedback information. |
1758 virtual bool IsMonomorphic() OVERRIDE { | 1758 virtual bool IsMonomorphic() OVERRIDE { |
1759 return receiver_types_.length() == 1; | 1759 return receiver_types_.length() == 1; |
1760 } | 1760 } |
1761 virtual SmallMapList* GetReceiverTypes() OVERRIDE { | 1761 virtual SmallMapList* GetReceiverTypes() OVERRIDE { |
1762 return &receiver_types_; | 1762 return &receiver_types_; |
1763 } | 1763 } |
1764 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE { | 1764 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE { |
1765 return STANDARD_STORE; | 1765 return STANDARD_STORE; |
1766 } | 1766 } |
1767 virtual IcCheckType GetKeyType() { | 1767 virtual IcCheckType GetKeyType() OVERRIDE { |
1768 // PROPERTY key types currently aren't implemented for KeyedLoadICs. | 1768 // PROPERTY key types currently aren't implemented for KeyedLoadICs. |
1769 return ELEMENT; | 1769 return ELEMENT; |
1770 } | 1770 } |
1771 bool IsUninitialized() { return !is_for_call_ && is_uninitialized_; } | 1771 bool IsUninitialized() { return !is_for_call_ && is_uninitialized_; } |
1772 bool HasNoTypeInformation() { | 1772 bool HasNoTypeInformation() { |
1773 return is_uninitialized_; | 1773 return is_uninitialized_; |
1774 } | 1774 } |
1775 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } | 1775 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } |
1776 void set_is_string_access(bool b) { is_string_access_ = b; } | 1776 void set_is_string_access(bool b) { is_string_access_ = b; } |
1777 void mark_for_call() { is_for_call_ = true; } | 1777 void mark_for_call() { is_for_call_ = true; } |
1778 bool IsForCall() { return is_for_call_; } | 1778 bool IsForCall() { return is_for_call_; } |
1779 | 1779 |
1780 bool IsSuperAccess() { | 1780 bool IsSuperAccess() { |
1781 return obj()->IsSuperReference(); | 1781 return obj()->IsSuperReference(); |
1782 } | 1782 } |
1783 | 1783 |
1784 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() { | 1784 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { |
1785 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); | 1785 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); |
1786 } | 1786 } |
1787 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) { | 1787 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { |
1788 property_feedback_slot_ = slot; | 1788 property_feedback_slot_ = slot; |
1789 } | 1789 } |
1790 | 1790 |
1791 FeedbackVectorICSlot PropertyFeedbackSlot() const { | 1791 FeedbackVectorICSlot PropertyFeedbackSlot() const { |
1792 return property_feedback_slot_; | 1792 return property_feedback_slot_; |
1793 } | 1793 } |
1794 | 1794 |
1795 protected: | 1795 protected: |
1796 Property(Zone* zone, Expression* obj, Expression* key, int pos) | 1796 Property(Zone* zone, Expression* obj, Expression* key, int pos) |
1797 : Expression(zone, pos), | 1797 : Expression(zone, pos), |
(...skipping 19 matching lines...) Expand all Loading... | |
1817 | 1817 |
1818 | 1818 |
1819 class Call FINAL : public Expression { | 1819 class Call FINAL : public Expression { |
1820 public: | 1820 public: |
1821 DECLARE_NODE_TYPE(Call) | 1821 DECLARE_NODE_TYPE(Call) |
1822 | 1822 |
1823 Expression* expression() const { return expression_; } | 1823 Expression* expression() const { return expression_; } |
1824 ZoneList<Expression*>* arguments() const { return arguments_; } | 1824 ZoneList<Expression*>* arguments() const { return arguments_; } |
1825 | 1825 |
1826 // Type feedback information. | 1826 // Type feedback information. |
1827 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() { | 1827 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { |
1828 return FeedbackVectorRequirements(0, 1); | 1828 return FeedbackVectorRequirements(0, 1); |
1829 } | 1829 } |
1830 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) { | 1830 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { |
1831 call_feedback_slot_ = slot; | 1831 call_feedback_slot_ = slot; |
1832 } | 1832 } |
1833 | 1833 |
1834 bool HasCallFeedbackSlot() const { return !call_feedback_slot_.IsInvalid(); } | 1834 bool HasCallFeedbackSlot() const { return !call_feedback_slot_.IsInvalid(); } |
1835 FeedbackVectorICSlot CallFeedbackSlot() const { return call_feedback_slot_; } | 1835 FeedbackVectorICSlot CallFeedbackSlot() const { return call_feedback_slot_; } |
1836 | 1836 |
1837 virtual SmallMapList* GetReceiverTypes() OVERRIDE { | 1837 virtual SmallMapList* GetReceiverTypes() OVERRIDE { |
1838 if (expression()->IsProperty()) { | 1838 if (expression()->IsProperty()) { |
1839 return expression()->AsProperty()->GetReceiverTypes(); | 1839 return expression()->AsProperty()->GetReceiverTypes(); |
1840 } | 1840 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1917 | 1917 |
1918 | 1918 |
1919 class CallNew FINAL : public Expression { | 1919 class CallNew FINAL : public Expression { |
1920 public: | 1920 public: |
1921 DECLARE_NODE_TYPE(CallNew) | 1921 DECLARE_NODE_TYPE(CallNew) |
1922 | 1922 |
1923 Expression* expression() const { return expression_; } | 1923 Expression* expression() const { return expression_; } |
1924 ZoneList<Expression*>* arguments() const { return arguments_; } | 1924 ZoneList<Expression*>* arguments() const { return arguments_; } |
1925 | 1925 |
1926 // Type feedback information. | 1926 // Type feedback information. |
1927 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() { | 1927 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { |
1928 return FeedbackVectorRequirements(FLAG_pretenuring_call_new ? 2 : 1, 0); | 1928 return FeedbackVectorRequirements(FLAG_pretenuring_call_new ? 2 : 1, 0); |
1929 } | 1929 } |
1930 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) { | 1930 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE { |
1931 callnew_feedback_slot_ = slot; | 1931 callnew_feedback_slot_ = slot; |
1932 } | 1932 } |
1933 | 1933 |
1934 FeedbackVectorSlot CallNewFeedbackSlot() { return callnew_feedback_slot_; } | 1934 FeedbackVectorSlot CallNewFeedbackSlot() { return callnew_feedback_slot_; } |
1935 FeedbackVectorSlot AllocationSiteFeedbackSlot() { | 1935 FeedbackVectorSlot AllocationSiteFeedbackSlot() { |
1936 DCHECK(FLAG_pretenuring_call_new); | 1936 DCHECK(FLAG_pretenuring_call_new); |
1937 return CallNewFeedbackSlot().next(); | 1937 return CallNewFeedbackSlot().next(); |
1938 } | 1938 } |
1939 | 1939 |
1940 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1940 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1979 public: | 1979 public: |
1980 DECLARE_NODE_TYPE(CallRuntime) | 1980 DECLARE_NODE_TYPE(CallRuntime) |
1981 | 1981 |
1982 Handle<String> name() const { return raw_name_->string(); } | 1982 Handle<String> name() const { return raw_name_->string(); } |
1983 const AstRawString* raw_name() const { return raw_name_; } | 1983 const AstRawString* raw_name() const { return raw_name_; } |
1984 const Runtime::Function* function() const { return function_; } | 1984 const Runtime::Function* function() const { return function_; } |
1985 ZoneList<Expression*>* arguments() const { return arguments_; } | 1985 ZoneList<Expression*>* arguments() const { return arguments_; } |
1986 bool is_jsruntime() const { return function_ == NULL; } | 1986 bool is_jsruntime() const { return function_ == NULL; } |
1987 | 1987 |
1988 // Type feedback information. | 1988 // Type feedback information. |
1989 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() { | 1989 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { |
1990 return FeedbackVectorRequirements( | 1990 return FeedbackVectorRequirements( |
1991 0, (FLAG_vector_ics && is_jsruntime()) ? 1 : 0); | 1991 0, (FLAG_vector_ics && is_jsruntime()) ? 1 : 0); |
1992 } | 1992 } |
1993 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) { | 1993 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { |
1994 callruntime_feedback_slot_ = slot; | 1994 callruntime_feedback_slot_ = slot; |
1995 } | 1995 } |
1996 | 1996 |
1997 FeedbackVectorICSlot CallRuntimeFeedbackSlot() { | 1997 FeedbackVectorICSlot CallRuntimeFeedbackSlot() { |
1998 return callruntime_feedback_slot_; | 1998 return callruntime_feedback_slot_; |
1999 } | 1999 } |
2000 | 2000 |
2001 static int num_ids() { return parent_num_ids() + 1; } | 2001 static int num_ids() { return parent_num_ids() + 1; } |
2002 TypeFeedbackId CallRuntimeFeedbackId() const { | 2002 TypeFeedbackId CallRuntimeFeedbackId() const { |
2003 return TypeFeedbackId(local_id(0)); | 2003 return TypeFeedbackId(local_id(0)); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2340 int index() const { | 2340 int index() const { |
2341 DCHECK_EQ(kDelegating, yield_kind()); | 2341 DCHECK_EQ(kDelegating, yield_kind()); |
2342 return index_; | 2342 return index_; |
2343 } | 2343 } |
2344 void set_index(int index) { | 2344 void set_index(int index) { |
2345 DCHECK_EQ(kDelegating, yield_kind()); | 2345 DCHECK_EQ(kDelegating, yield_kind()); |
2346 index_ = index; | 2346 index_ = index; |
2347 } | 2347 } |
2348 | 2348 |
2349 // Type feedback information. | 2349 // Type feedback information. |
2350 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() { | 2350 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { |
2351 return FeedbackVectorRequirements( | 2351 return FeedbackVectorRequirements( |
2352 0, (FLAG_vector_ics && yield_kind() == kDelegating) ? 3 : 0); | 2352 0, (FLAG_vector_ics && yield_kind() == kDelegating) ? 3 : 0); |
2353 } | 2353 } |
2354 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) { | 2354 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { |
2355 yield_first_feedback_slot_ = slot; | 2355 yield_first_feedback_slot_ = slot; |
2356 } | 2356 } |
2357 | 2357 |
2358 FeedbackVectorICSlot KeyedLoadFeedbackSlot() { | 2358 FeedbackVectorICSlot KeyedLoadFeedbackSlot() { |
2359 return yield_first_feedback_slot_; | 2359 return yield_first_feedback_slot_; |
2360 } | 2360 } |
2361 | 2361 |
2362 FeedbackVectorICSlot DoneFeedbackSlot() { | 2362 FeedbackVectorICSlot DoneFeedbackSlot() { |
2363 return KeyedLoadFeedbackSlot().next(); | 2363 return KeyedLoadFeedbackSlot().next(); |
2364 } | 2364 } |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2660 class SuperReference FINAL : public Expression { | 2660 class SuperReference FINAL : public Expression { |
2661 public: | 2661 public: |
2662 DECLARE_NODE_TYPE(SuperReference) | 2662 DECLARE_NODE_TYPE(SuperReference) |
2663 | 2663 |
2664 VariableProxy* this_var() const { return this_var_; } | 2664 VariableProxy* this_var() const { return this_var_; } |
2665 | 2665 |
2666 static int num_ids() { return parent_num_ids() + 1; } | 2666 static int num_ids() { return parent_num_ids() + 1; } |
2667 TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); } | 2667 TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); } |
2668 | 2668 |
2669 // Type feedback information. | 2669 // Type feedback information. |
2670 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() { | 2670 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { |
2671 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); | 2671 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); |
2672 } | 2672 } |
2673 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) { | 2673 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { |
2674 homeobject_feedback_slot_ = slot; | 2674 homeobject_feedback_slot_ = slot; |
2675 } | 2675 } |
2676 | 2676 |
2677 FeedbackVectorICSlot HomeObjectFeedbackSlot() { | 2677 FeedbackVectorICSlot HomeObjectFeedbackSlot() { |
2678 DCHECK(!FLAG_vector_ics || !homeobject_feedback_slot_.IsInvalid()); | 2678 DCHECK(!FLAG_vector_ics || !homeobject_feedback_slot_.IsInvalid()); |
2679 return homeobject_feedback_slot_; | 2679 return homeobject_feedback_slot_; |
2680 } | 2680 } |
2681 | 2681 |
2682 protected: | 2682 protected: |
2683 SuperReference(Zone* zone, VariableProxy* this_var, int pos) | 2683 SuperReference(Zone* zone, VariableProxy* this_var, int pos) |
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3650 private: | 3650 private: |
3651 Zone* zone_; | 3651 Zone* zone_; |
3652 Visitor visitor_; | 3652 Visitor visitor_; |
3653 AstValueFactory* ast_value_factory_; | 3653 AstValueFactory* ast_value_factory_; |
3654 }; | 3654 }; |
3655 | 3655 |
3656 | 3656 |
3657 } } // namespace v8::internal | 3657 } } // namespace v8::internal |
3658 | 3658 |
3659 #endif // V8_AST_H_ | 3659 #endif // V8_AST_H_ |
OLD | NEW |