| 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 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 } | 725 } |
| 726 | 726 |
| 727 Expression* each() const { return each_; } | 727 Expression* each() const { return each_; } |
| 728 Expression* subject() const { return subject_; } | 728 Expression* subject() const { return subject_; } |
| 729 | 729 |
| 730 void set_each(Expression* e) { each_ = e; } | 730 void set_each(Expression* e) { each_ = e; } |
| 731 void set_subject(Expression* e) { subject_ = e; } | 731 void set_subject(Expression* e) { subject_ = e; } |
| 732 | 732 |
| 733 // Type feedback information. | 733 // Type feedback information. |
| 734 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 734 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 735 LanguageMode language_mode, |
| 735 FeedbackVectorSlotCache* cache); | 736 FeedbackVectorSlotCache* cache); |
| 736 FeedbackVectorSlot EachFeedbackSlot() const { return each_slot_; } | 737 FeedbackVectorSlot EachFeedbackSlot() const { return each_slot_; } |
| 737 FeedbackVectorSlot ForInFeedbackSlot() { | 738 FeedbackVectorSlot ForInFeedbackSlot() { |
| 738 DCHECK(!for_in_feedback_slot_.IsInvalid()); | 739 DCHECK(!for_in_feedback_slot_.IsInvalid()); |
| 739 return for_in_feedback_slot_; | 740 return for_in_feedback_slot_; |
| 740 } | 741 } |
| 741 | 742 |
| 742 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; | 743 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; |
| 743 ForInType for_in_type() const { return ForInTypeField::decode(bit_field_); } | 744 ForInType for_in_type() const { return ForInTypeField::decode(bit_field_); } |
| 744 void set_for_in_type(ForInType type) { | 745 void set_for_in_type(ForInType type) { |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 BailoutId EntryId() const { return BailoutId(local_id(0)); } | 948 BailoutId EntryId() const { return BailoutId(local_id(0)); } |
| 948 TypeFeedbackId CompareId() { return TypeFeedbackId(local_id(1)); } | 949 TypeFeedbackId CompareId() { return TypeFeedbackId(local_id(1)); } |
| 949 | 950 |
| 950 AstType* compare_type() { return compare_type_; } | 951 AstType* compare_type() { return compare_type_; } |
| 951 void set_compare_type(AstType* type) { compare_type_ = type; } | 952 void set_compare_type(AstType* type) { compare_type_ = type; } |
| 952 | 953 |
| 953 // CaseClause will have both a slot in the feedback vector and the | 954 // CaseClause will have both a slot in the feedback vector and the |
| 954 // TypeFeedbackId to record the type information. TypeFeedbackId is used by | 955 // TypeFeedbackId to record the type information. TypeFeedbackId is used by |
| 955 // full codegen and the feedback vector slot is used by interpreter. | 956 // full codegen and the feedback vector slot is used by interpreter. |
| 956 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 957 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 958 LanguageMode language_mode, |
| 957 FeedbackVectorSlotCache* cache); | 959 FeedbackVectorSlotCache* cache); |
| 958 | 960 |
| 959 FeedbackVectorSlot CompareOperationFeedbackSlot() { | 961 FeedbackVectorSlot CompareOperationFeedbackSlot() { |
| 960 return type_feedback_slot_; | 962 return type_feedback_slot_; |
| 961 } | 963 } |
| 962 | 964 |
| 963 private: | 965 private: |
| 964 friend class AstNodeFactory; | 966 friend class AstNodeFactory; |
| 965 | 967 |
| 966 static int parent_num_ids() { return Expression::num_ids(); } | 968 static int parent_num_ids() { return Expression::num_ids(); } |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 // Base class for literals that need space in the type feedback vector. | 1229 // Base class for literals that need space in the type feedback vector. |
| 1228 class MaterializedLiteral : public Expression { | 1230 class MaterializedLiteral : public Expression { |
| 1229 public: | 1231 public: |
| 1230 int depth() const { | 1232 int depth() const { |
| 1231 // only callable after initialization. | 1233 // only callable after initialization. |
| 1232 DCHECK(depth_ >= 1); | 1234 DCHECK(depth_ >= 1); |
| 1233 return depth_; | 1235 return depth_; |
| 1234 } | 1236 } |
| 1235 | 1237 |
| 1236 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 1238 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 1239 LanguageMode language_mode, |
| 1237 FeedbackVectorSlotCache* cache) { | 1240 FeedbackVectorSlotCache* cache) { |
| 1238 literal_slot_ = spec->AddLiteralSlot(); | 1241 literal_slot_ = spec->AddLiteralSlot(); |
| 1239 } | 1242 } |
| 1240 | 1243 |
| 1241 FeedbackVectorSlot literal_slot() const { return literal_slot_; } | 1244 FeedbackVectorSlot literal_slot() const { return literal_slot_; } |
| 1242 | 1245 |
| 1243 private: | 1246 private: |
| 1244 int depth_ : 31; | 1247 int depth_ : 31; |
| 1245 FeedbackVectorSlot literal_slot_; | 1248 FeedbackVectorSlot literal_slot_; |
| 1246 | 1249 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1444 // Return an AST id for a property that is used in simulate instructions. | 1447 // Return an AST id for a property that is used in simulate instructions. |
| 1445 BailoutId GetIdForPropertySet(int i) { return BailoutId(local_id(i + 1)); } | 1448 BailoutId GetIdForPropertySet(int i) { return BailoutId(local_id(i + 1)); } |
| 1446 | 1449 |
| 1447 // Unlike other AST nodes, this number of bailout IDs allocated for an | 1450 // Unlike other AST nodes, this number of bailout IDs allocated for an |
| 1448 // ObjectLiteral can vary, so num_ids() is not a static method. | 1451 // ObjectLiteral can vary, so num_ids() is not a static method. |
| 1449 int num_ids() const { return parent_num_ids() + 1 + properties()->length(); } | 1452 int num_ids() const { return parent_num_ids() + 1 + properties()->length(); } |
| 1450 | 1453 |
| 1451 // Object literals need one feedback slot for each non-trivial value, as well | 1454 // Object literals need one feedback slot for each non-trivial value, as well |
| 1452 // as some slots for home objects. | 1455 // as some slots for home objects. |
| 1453 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 1456 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 1457 LanguageMode language_mode, |
| 1454 FeedbackVectorSlotCache* cache); | 1458 FeedbackVectorSlotCache* cache); |
| 1455 | 1459 |
| 1456 private: | 1460 private: |
| 1457 friend class AstNodeFactory; | 1461 friend class AstNodeFactory; |
| 1458 | 1462 |
| 1459 ObjectLiteral(ZoneList<Property*>* properties, | 1463 ObjectLiteral(ZoneList<Property*>* properties, |
| 1460 uint32_t boilerplate_properties, int pos, | 1464 uint32_t boilerplate_properties, int pos, |
| 1461 bool has_rest_property) | 1465 bool has_rest_property) |
| 1462 : MaterializedLiteral(pos, kObjectLiteral), | 1466 : MaterializedLiteral(pos, kObjectLiteral), |
| 1463 boilerplate_properties_(boilerplate_properties), | 1467 boilerplate_properties_(boilerplate_properties), |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 first_spread_index_ = -1; | 1593 first_spread_index_ = -1; |
| 1590 } | 1594 } |
| 1591 | 1595 |
| 1592 enum Flags { | 1596 enum Flags { |
| 1593 kNoFlags = 0, | 1597 kNoFlags = 0, |
| 1594 kShallowElements = 1, | 1598 kShallowElements = 1, |
| 1595 kDisableMementos = 1 << 1 | 1599 kDisableMementos = 1 << 1 |
| 1596 }; | 1600 }; |
| 1597 | 1601 |
| 1598 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 1602 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 1603 LanguageMode language_mode, |
| 1599 FeedbackVectorSlotCache* cache); | 1604 FeedbackVectorSlotCache* cache); |
| 1600 FeedbackVectorSlot LiteralFeedbackSlot() const { return literal_slot_; } | 1605 FeedbackVectorSlot LiteralFeedbackSlot() const { return literal_slot_; } |
| 1601 | 1606 |
| 1602 private: | 1607 private: |
| 1603 friend class AstNodeFactory; | 1608 friend class AstNodeFactory; |
| 1604 | 1609 |
| 1605 ArrayLiteral(ZoneList<Expression*>* values, int first_spread_index, int pos) | 1610 ArrayLiteral(ZoneList<Expression*>* values, int first_spread_index, int pos) |
| 1606 : MaterializedLiteral(pos, kArrayLiteral), | 1611 : MaterializedLiteral(pos, kArrayLiteral), |
| 1607 first_spread_index_(first_spread_index), | 1612 first_spread_index_(first_spread_index), |
| 1608 values_(values) {} | 1613 values_(values) {} |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1667 } | 1672 } |
| 1668 | 1673 |
| 1669 // Bind this proxy to the variable var. | 1674 // Bind this proxy to the variable var. |
| 1670 void BindTo(Variable* var); | 1675 void BindTo(Variable* var); |
| 1671 | 1676 |
| 1672 bool UsesVariableFeedbackSlot() const { | 1677 bool UsesVariableFeedbackSlot() const { |
| 1673 return var()->IsUnallocated() || var()->IsLookupSlot(); | 1678 return var()->IsUnallocated() || var()->IsLookupSlot(); |
| 1674 } | 1679 } |
| 1675 | 1680 |
| 1676 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 1681 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 1682 LanguageMode language_mode, |
| 1677 FeedbackVectorSlotCache* cache); | 1683 FeedbackVectorSlotCache* cache); |
| 1678 | 1684 |
| 1679 FeedbackVectorSlot VariableFeedbackSlot() { return variable_feedback_slot_; } | 1685 FeedbackVectorSlot VariableFeedbackSlot() { return variable_feedback_slot_; } |
| 1680 | 1686 |
| 1681 static int num_ids() { return parent_num_ids() + 1; } | 1687 static int num_ids() { return parent_num_ids() + 1; } |
| 1682 BailoutId BeforeId() const { return BailoutId(local_id(0)); } | 1688 BailoutId BeforeId() const { return BailoutId(local_id(0)); } |
| 1683 void set_next_unresolved(VariableProxy* next) { next_unresolved_ = next; } | 1689 void set_next_unresolved(VariableProxy* next) { next_unresolved_ = next; } |
| 1684 VariableProxy* next_unresolved() { return next_unresolved_; } | 1690 VariableProxy* next_unresolved() { return next_unresolved_; } |
| 1685 | 1691 |
| 1686 private: | 1692 private: |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1763 bit_field_ = InlineCacheStateField::update(bit_field_, state); | 1769 bit_field_ = InlineCacheStateField::update(bit_field_, state); |
| 1764 } | 1770 } |
| 1765 void mark_for_call() { | 1771 void mark_for_call() { |
| 1766 bit_field_ = IsForCallField::update(bit_field_, true); | 1772 bit_field_ = IsForCallField::update(bit_field_, true); |
| 1767 } | 1773 } |
| 1768 bool is_for_call() const { return IsForCallField::decode(bit_field_); } | 1774 bool is_for_call() const { return IsForCallField::decode(bit_field_); } |
| 1769 | 1775 |
| 1770 bool IsSuperAccess() { return obj()->IsSuperPropertyReference(); } | 1776 bool IsSuperAccess() { return obj()->IsSuperPropertyReference(); } |
| 1771 | 1777 |
| 1772 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 1778 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 1779 LanguageMode language_mode, |
| 1773 FeedbackVectorSlotCache* cache) { | 1780 FeedbackVectorSlotCache* cache) { |
| 1774 FeedbackVectorSlotKind kind = key()->IsPropertyName() | 1781 if (key()->IsPropertyName()) { |
| 1775 ? FeedbackVectorSlotKind::LOAD_IC | 1782 property_feedback_slot_ = spec->AddLoadICSlot(); |
| 1776 : FeedbackVectorSlotKind::KEYED_LOAD_IC; | 1783 } else { |
| 1777 property_feedback_slot_ = spec->AddSlot(kind); | 1784 property_feedback_slot_ = spec->AddKeyedLoadICSlot(); |
| 1785 } |
| 1778 } | 1786 } |
| 1779 | 1787 |
| 1780 FeedbackVectorSlot PropertyFeedbackSlot() const { | 1788 FeedbackVectorSlot PropertyFeedbackSlot() const { |
| 1781 return property_feedback_slot_; | 1789 return property_feedback_slot_; |
| 1782 } | 1790 } |
| 1783 | 1791 |
| 1784 // Returns the properties assign type. | 1792 // Returns the properties assign type. |
| 1785 static LhsKind GetAssignType(Property* property) { | 1793 static LhsKind GetAssignType(Property* property) { |
| 1786 if (property == NULL) return VARIABLE; | 1794 if (property == NULL) return VARIABLE; |
| 1787 bool super_access = property->IsSuperAccess(); | 1795 bool super_access = property->IsSuperAccess(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1821 | 1829 |
| 1822 class Call final : public Expression { | 1830 class Call final : public Expression { |
| 1823 public: | 1831 public: |
| 1824 Expression* expression() const { return expression_; } | 1832 Expression* expression() const { return expression_; } |
| 1825 ZoneList<Expression*>* arguments() const { return arguments_; } | 1833 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1826 | 1834 |
| 1827 void set_expression(Expression* e) { expression_ = e; } | 1835 void set_expression(Expression* e) { expression_ = e; } |
| 1828 | 1836 |
| 1829 // Type feedback information. | 1837 // Type feedback information. |
| 1830 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 1838 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 1839 LanguageMode language_mode, |
| 1831 FeedbackVectorSlotCache* cache); | 1840 FeedbackVectorSlotCache* cache); |
| 1832 | 1841 |
| 1833 FeedbackVectorSlot CallFeedbackICSlot() const { return ic_slot_; } | 1842 FeedbackVectorSlot CallFeedbackICSlot() const { return ic_slot_; } |
| 1834 | 1843 |
| 1835 SmallMapList* GetReceiverTypes() { | 1844 SmallMapList* GetReceiverTypes() { |
| 1836 if (expression()->IsProperty()) { | 1845 if (expression()->IsProperty()) { |
| 1837 return expression()->AsProperty()->GetReceiverTypes(); | 1846 return expression()->AsProperty()->GetReceiverTypes(); |
| 1838 } | 1847 } |
| 1839 return nullptr; | 1848 return nullptr; |
| 1840 } | 1849 } |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1943 | 1952 |
| 1944 class CallNew final : public Expression { | 1953 class CallNew final : public Expression { |
| 1945 public: | 1954 public: |
| 1946 Expression* expression() const { return expression_; } | 1955 Expression* expression() const { return expression_; } |
| 1947 ZoneList<Expression*>* arguments() const { return arguments_; } | 1956 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1948 | 1957 |
| 1949 void set_expression(Expression* e) { expression_ = e; } | 1958 void set_expression(Expression* e) { expression_ = e; } |
| 1950 | 1959 |
| 1951 // Type feedback information. | 1960 // Type feedback information. |
| 1952 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 1961 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 1962 LanguageMode language_mode, |
| 1953 FeedbackVectorSlotCache* cache) { | 1963 FeedbackVectorSlotCache* cache) { |
| 1954 // CallNew stores feedback in the exact same way as Call. We can | 1964 // CallNew stores feedback in the exact same way as Call. We can |
| 1955 // piggyback on the type feedback infrastructure for calls. | 1965 // piggyback on the type feedback infrastructure for calls. |
| 1956 callnew_feedback_slot_ = spec->AddCallICSlot(); | 1966 callnew_feedback_slot_ = spec->AddCallICSlot(); |
| 1957 } | 1967 } |
| 1958 | 1968 |
| 1959 FeedbackVectorSlot CallNewFeedbackSlot() { | 1969 FeedbackVectorSlot CallNewFeedbackSlot() { |
| 1960 DCHECK(!callnew_feedback_slot_.IsInvalid()); | 1970 DCHECK(!callnew_feedback_slot_.IsInvalid()); |
| 1961 return callnew_feedback_slot_; | 1971 return callnew_feedback_slot_; |
| 1962 } | 1972 } |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2118 | 2128 |
| 2119 // The short-circuit logical operations need an AST ID for their | 2129 // The short-circuit logical operations need an AST ID for their |
| 2120 // right-hand subexpression. | 2130 // right-hand subexpression. |
| 2121 static int num_ids() { return parent_num_ids() + 2; } | 2131 static int num_ids() { return parent_num_ids() + 2; } |
| 2122 BailoutId RightId() const { return BailoutId(local_id(0)); } | 2132 BailoutId RightId() const { return BailoutId(local_id(0)); } |
| 2123 | 2133 |
| 2124 // BinaryOperation will have both a slot in the feedback vector and the | 2134 // BinaryOperation will have both a slot in the feedback vector and the |
| 2125 // TypeFeedbackId to record the type information. TypeFeedbackId is used | 2135 // TypeFeedbackId to record the type information. TypeFeedbackId is used |
| 2126 // by full codegen and the feedback vector slot is used by interpreter. | 2136 // by full codegen and the feedback vector slot is used by interpreter. |
| 2127 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 2137 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 2138 LanguageMode language_mode, |
| 2128 FeedbackVectorSlotCache* cache); | 2139 FeedbackVectorSlotCache* cache); |
| 2129 | 2140 |
| 2130 FeedbackVectorSlot BinaryOperationFeedbackSlot() const { | 2141 FeedbackVectorSlot BinaryOperationFeedbackSlot() const { |
| 2131 return type_feedback_slot_; | 2142 return type_feedback_slot_; |
| 2132 } | 2143 } |
| 2133 | 2144 |
| 2134 TypeFeedbackId BinaryOperationFeedbackId() const { | 2145 TypeFeedbackId BinaryOperationFeedbackId() const { |
| 2135 return TypeFeedbackId(local_id(1)); | 2146 return TypeFeedbackId(local_id(1)); |
| 2136 } | 2147 } |
| 2137 Maybe<int> fixed_right_arg() const { | 2148 Maybe<int> fixed_right_arg() const { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2211 TypeFeedbackId CountStoreFeedbackId() const { | 2222 TypeFeedbackId CountStoreFeedbackId() const { |
| 2212 return TypeFeedbackId(local_id(3)); | 2223 return TypeFeedbackId(local_id(3)); |
| 2213 } | 2224 } |
| 2214 | 2225 |
| 2215 // Feedback slot for binary operation is only used by ignition. | 2226 // Feedback slot for binary operation is only used by ignition. |
| 2216 FeedbackVectorSlot CountBinaryOpFeedbackSlot() const { | 2227 FeedbackVectorSlot CountBinaryOpFeedbackSlot() const { |
| 2217 return binary_operation_slot_; | 2228 return binary_operation_slot_; |
| 2218 } | 2229 } |
| 2219 | 2230 |
| 2220 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 2231 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 2232 LanguageMode language_mode, |
| 2221 FeedbackVectorSlotCache* cache); | 2233 FeedbackVectorSlotCache* cache); |
| 2222 FeedbackVectorSlot CountSlot() const { return slot_; } | 2234 FeedbackVectorSlot CountSlot() const { return slot_; } |
| 2223 | 2235 |
| 2224 private: | 2236 private: |
| 2225 friend class AstNodeFactory; | 2237 friend class AstNodeFactory; |
| 2226 | 2238 |
| 2227 CountOperation(Token::Value op, bool is_prefix, Expression* expr, int pos) | 2239 CountOperation(Token::Value op, bool is_prefix, Expression* expr, int pos) |
| 2228 : Expression(pos, kCountOperation), type_(NULL), expression_(expr) { | 2240 : Expression(pos, kCountOperation), type_(NULL), expression_(expr) { |
| 2229 bit_field_ |= | 2241 bit_field_ |= |
| 2230 IsPrefixField::encode(is_prefix) | KeyTypeField::encode(ELEMENT) | | 2242 IsPrefixField::encode(is_prefix) | KeyTypeField::encode(ELEMENT) | |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2263 TypeFeedbackId CompareOperationFeedbackId() const { | 2275 TypeFeedbackId CompareOperationFeedbackId() const { |
| 2264 return TypeFeedbackId(local_id(0)); | 2276 return TypeFeedbackId(local_id(0)); |
| 2265 } | 2277 } |
| 2266 AstType* combined_type() const { return combined_type_; } | 2278 AstType* combined_type() const { return combined_type_; } |
| 2267 void set_combined_type(AstType* type) { combined_type_ = type; } | 2279 void set_combined_type(AstType* type) { combined_type_ = type; } |
| 2268 | 2280 |
| 2269 // CompareOperation will have both a slot in the feedback vector and the | 2281 // CompareOperation will have both a slot in the feedback vector and the |
| 2270 // TypeFeedbackId to record the type information. TypeFeedbackId is used | 2282 // TypeFeedbackId to record the type information. TypeFeedbackId is used |
| 2271 // by full codegen and the feedback vector slot is used by interpreter. | 2283 // by full codegen and the feedback vector slot is used by interpreter. |
| 2272 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 2284 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 2285 LanguageMode language_mode, |
| 2273 FeedbackVectorSlotCache* cache); | 2286 FeedbackVectorSlotCache* cache); |
| 2274 | 2287 |
| 2275 FeedbackVectorSlot CompareOperationFeedbackSlot() const { | 2288 FeedbackVectorSlot CompareOperationFeedbackSlot() const { |
| 2276 return type_feedback_slot_; | 2289 return type_feedback_slot_; |
| 2277 } | 2290 } |
| 2278 | 2291 |
| 2279 // Match special cases. | 2292 // Match special cases. |
| 2280 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); | 2293 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); |
| 2281 bool IsLiteralCompareUndefined(Expression** expr); | 2294 bool IsLiteralCompareUndefined(Expression** expr); |
| 2282 bool IsLiteralCompareNull(Expression** expr); | 2295 bool IsLiteralCompareNull(Expression** expr); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2409 bit_field_ = IsUninitializedField::update(bit_field_, b); | 2422 bit_field_ = IsUninitializedField::update(bit_field_, b); |
| 2410 } | 2423 } |
| 2411 void set_key_type(IcCheckType key_type) { | 2424 void set_key_type(IcCheckType key_type) { |
| 2412 bit_field_ = KeyTypeField::update(bit_field_, key_type); | 2425 bit_field_ = KeyTypeField::update(bit_field_, key_type); |
| 2413 } | 2426 } |
| 2414 void set_store_mode(KeyedAccessStoreMode mode) { | 2427 void set_store_mode(KeyedAccessStoreMode mode) { |
| 2415 bit_field_ = StoreModeField::update(bit_field_, mode); | 2428 bit_field_ = StoreModeField::update(bit_field_, mode); |
| 2416 } | 2429 } |
| 2417 | 2430 |
| 2418 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 2431 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 2432 LanguageMode language_mode, |
| 2419 FeedbackVectorSlotCache* cache); | 2433 FeedbackVectorSlotCache* cache); |
| 2420 FeedbackVectorSlot AssignmentSlot() const { return slot_; } | 2434 FeedbackVectorSlot AssignmentSlot() const { return slot_; } |
| 2421 | 2435 |
| 2422 private: | 2436 private: |
| 2423 friend class AstNodeFactory; | 2437 friend class AstNodeFactory; |
| 2424 | 2438 |
| 2425 Assignment(Token::Value op, Expression* target, Expression* value, int pos); | 2439 Assignment(Token::Value op, Expression* target, Expression* value, int pos); |
| 2426 | 2440 |
| 2427 static int parent_num_ids() { return Expression::num_ids(); } | 2441 static int parent_num_ids() { return Expression::num_ids(); } |
| 2428 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2442 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2576 bool is_declaration() const { return function_type() == kDeclaration; } | 2590 bool is_declaration() const { return function_type() == kDeclaration; } |
| 2577 bool is_named_expression() const { | 2591 bool is_named_expression() const { |
| 2578 return function_type() == kNamedExpression; | 2592 return function_type() == kNamedExpression; |
| 2579 } | 2593 } |
| 2580 bool is_anonymous_expression() const { | 2594 bool is_anonymous_expression() const { |
| 2581 return function_type() == kAnonymousExpression; | 2595 return function_type() == kAnonymousExpression; |
| 2582 } | 2596 } |
| 2583 LanguageMode language_mode() const; | 2597 LanguageMode language_mode() const; |
| 2584 | 2598 |
| 2585 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 2599 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 2600 LanguageMode language_mode, |
| 2586 FeedbackVectorSlotCache* cache) { | 2601 FeedbackVectorSlotCache* cache) { |
| 2587 literal_feedback_slot_ = spec->AddCreateClosureSlot(); | 2602 literal_feedback_slot_ = spec->AddCreateClosureSlot(); |
| 2588 } | 2603 } |
| 2589 | 2604 |
| 2590 FeedbackVectorSlot LiteralFeedbackSlot() const { | 2605 FeedbackVectorSlot LiteralFeedbackSlot() const { |
| 2591 return literal_feedback_slot_; | 2606 return literal_feedback_slot_; |
| 2592 } | 2607 } |
| 2593 | 2608 |
| 2594 static bool NeedsHomeObject(Expression* expr); | 2609 static bool NeedsHomeObject(Expression* expr); |
| 2595 | 2610 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2792 bool has_name_static_property() const { | 2807 bool has_name_static_property() const { |
| 2793 return HasNameStaticProperty::decode(bit_field_); | 2808 return HasNameStaticProperty::decode(bit_field_); |
| 2794 } | 2809 } |
| 2795 bool has_static_computed_names() const { | 2810 bool has_static_computed_names() const { |
| 2796 return HasStaticComputedNames::decode(bit_field_); | 2811 return HasStaticComputedNames::decode(bit_field_); |
| 2797 } | 2812 } |
| 2798 | 2813 |
| 2799 // Object literals need one feedback slot for each non-trivial value, as well | 2814 // Object literals need one feedback slot for each non-trivial value, as well |
| 2800 // as some slots for home objects. | 2815 // as some slots for home objects. |
| 2801 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 2816 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 2817 LanguageMode language_mode, |
| 2802 FeedbackVectorSlotCache* cache); | 2818 FeedbackVectorSlotCache* cache); |
| 2803 | 2819 |
| 2804 bool NeedsProxySlot() const { | 2820 bool NeedsProxySlot() const { |
| 2805 return class_variable_proxy() != nullptr && | 2821 return class_variable_proxy() != nullptr && |
| 2806 class_variable_proxy()->var()->IsUnallocated(); | 2822 class_variable_proxy()->var()->IsUnallocated(); |
| 2807 } | 2823 } |
| 2808 | 2824 |
| 2809 FeedbackVectorSlot HomeObjectSlot() const { return home_object_slot_; } | 2825 FeedbackVectorSlot HomeObjectSlot() const { return home_object_slot_; } |
| 2810 FeedbackVectorSlot ProxySlot() const { return proxy_slot_; } | 2826 FeedbackVectorSlot ProxySlot() const { return proxy_slot_; } |
| 2811 | 2827 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2843 | 2859 |
| 2844 class NativeFunctionLiteral final : public Expression { | 2860 class NativeFunctionLiteral final : public Expression { |
| 2845 public: | 2861 public: |
| 2846 Handle<String> name() const { return name_->string(); } | 2862 Handle<String> name() const { return name_->string(); } |
| 2847 v8::Extension* extension() const { return extension_; } | 2863 v8::Extension* extension() const { return extension_; } |
| 2848 FeedbackVectorSlot LiteralFeedbackSlot() const { | 2864 FeedbackVectorSlot LiteralFeedbackSlot() const { |
| 2849 return literal_feedback_slot_; | 2865 return literal_feedback_slot_; |
| 2850 } | 2866 } |
| 2851 | 2867 |
| 2852 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 2868 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 2869 LanguageMode language_mode, |
| 2853 FeedbackVectorSlotCache* cache) { | 2870 FeedbackVectorSlotCache* cache) { |
| 2854 // TODO(mvstanton): The FeedbackVectorSlotCache can be adapted | 2871 // TODO(mvstanton): The FeedbackVectorSlotCache can be adapted |
| 2855 // to always return the same slot for this case. | 2872 // to always return the same slot for this case. |
| 2856 literal_feedback_slot_ = spec->AddCreateClosureSlot(); | 2873 literal_feedback_slot_ = spec->AddCreateClosureSlot(); |
| 2857 } | 2874 } |
| 2858 | 2875 |
| 2859 private: | 2876 private: |
| 2860 friend class AstNodeFactory; | 2877 friend class AstNodeFactory; |
| 2861 | 2878 |
| 2862 NativeFunctionLiteral(const AstRawString* name, v8::Extension* extension, | 2879 NativeFunctionLiteral(const AstRawString* name, v8::Extension* extension, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2945 // desugars this into a LoadIC / JSLoadNamed, CallIC, and a type-check to | 2962 // desugars this into a LoadIC / JSLoadNamed, CallIC, and a type-check to |
| 2946 // validate return value of the Symbol.iterator() call. | 2963 // validate return value of the Symbol.iterator() call. |
| 2947 class GetIterator final : public Expression { | 2964 class GetIterator final : public Expression { |
| 2948 public: | 2965 public: |
| 2949 Expression* iterable() const { return iterable_; } | 2966 Expression* iterable() const { return iterable_; } |
| 2950 void set_iterable(Expression* iterable) { iterable_ = iterable; } | 2967 void set_iterable(Expression* iterable) { iterable_ = iterable; } |
| 2951 | 2968 |
| 2952 static int num_ids() { return parent_num_ids(); } | 2969 static int num_ids() { return parent_num_ids(); } |
| 2953 | 2970 |
| 2954 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, | 2971 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
| 2972 LanguageMode language_mode, |
| 2955 FeedbackVectorSlotCache* cache) { | 2973 FeedbackVectorSlotCache* cache) { |
| 2956 iterator_property_feedback_slot_ = | 2974 iterator_property_feedback_slot_ = spec->AddLoadICSlot(); |
| 2957 spec->AddSlot(FeedbackVectorSlotKind::LOAD_IC); | 2975 iterator_call_feedback_slot_ = spec->AddCallICSlot(); |
| 2958 iterator_call_feedback_slot_ = | |
| 2959 spec->AddSlot(FeedbackVectorSlotKind::CALL_IC); | |
| 2960 } | 2976 } |
| 2961 | 2977 |
| 2962 FeedbackVectorSlot IteratorPropertyFeedbackSlot() const { | 2978 FeedbackVectorSlot IteratorPropertyFeedbackSlot() const { |
| 2963 return iterator_property_feedback_slot_; | 2979 return iterator_property_feedback_slot_; |
| 2964 } | 2980 } |
| 2965 | 2981 |
| 2966 FeedbackVectorSlot IteratorCallFeedbackSlot() const { | 2982 FeedbackVectorSlot IteratorCallFeedbackSlot() const { |
| 2967 return iterator_call_feedback_slot_; | 2983 return iterator_call_feedback_slot_; |
| 2968 } | 2984 } |
| 2969 | 2985 |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3623 : NULL; \ | 3639 : NULL; \ |
| 3624 } | 3640 } |
| 3625 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3641 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
| 3626 #undef DECLARE_NODE_FUNCTIONS | 3642 #undef DECLARE_NODE_FUNCTIONS |
| 3627 | 3643 |
| 3628 | 3644 |
| 3629 } // namespace internal | 3645 } // namespace internal |
| 3630 } // namespace v8 | 3646 } // namespace v8 |
| 3631 | 3647 |
| 3632 #endif // V8_AST_AST_H_ | 3648 #endif // V8_AST_AST_H_ |
| OLD | NEW |