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 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 | 789 |
790 void Initialize(Expression* each, Expression* subject, Statement* body) { | 790 void Initialize(Expression* each, Expression* subject, Statement* body) { |
791 IterationStatement::Initialize(body); | 791 IterationStatement::Initialize(body); |
792 each_ = each; | 792 each_ = each; |
793 subject_ = subject; | 793 subject_ = subject; |
794 } | 794 } |
795 | 795 |
796 Expression* each() const { return each_; } | 796 Expression* each() const { return each_; } |
797 Expression* subject() const { return subject_; } | 797 Expression* subject() const { return subject_; } |
798 | 798 |
| 799 FeedbackVectorRequirements ComputeFeedbackRequirements( |
| 800 Isolate* isolate, const ICSlotCache* cache) override; |
| 801 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
| 802 ICSlotCache* cache) override { |
| 803 each_slot_ = slot; |
| 804 } |
| 805 Code::Kind FeedbackICSlotKind(int index) override; |
| 806 FeedbackVectorICSlot EachFeedbackSlot() const { return each_slot_; } |
| 807 |
799 protected: | 808 protected: |
800 ForEachStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 809 ForEachStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) |
801 : IterationStatement(zone, labels, pos), each_(NULL), subject_(NULL) {} | 810 : IterationStatement(zone, labels, pos), |
| 811 each_(NULL), |
| 812 subject_(NULL), |
| 813 each_slot_(FeedbackVectorICSlot::Invalid()) {} |
802 | 814 |
803 private: | 815 private: |
804 Expression* each_; | 816 Expression* each_; |
805 Expression* subject_; | 817 Expression* subject_; |
| 818 FeedbackVectorICSlot each_slot_; |
806 }; | 819 }; |
807 | 820 |
808 | 821 |
809 class ForInStatement final : public ForEachStatement { | 822 class ForInStatement final : public ForEachStatement { |
810 public: | 823 public: |
811 DECLARE_NODE_TYPE(ForInStatement) | 824 DECLARE_NODE_TYPE(ForInStatement) |
812 | 825 |
813 Expression* enumerable() const { | 826 Expression* enumerable() const { |
814 return subject(); | 827 return subject(); |
815 } | 828 } |
816 | 829 |
817 // Type feedback information. | 830 // Type feedback information. |
818 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( | 831 FeedbackVectorRequirements ComputeFeedbackRequirements( |
819 Isolate* isolate, const ICSlotCache* cache) override { | 832 Isolate* isolate, const ICSlotCache* cache) override { |
820 return FeedbackVectorRequirements(1, 0); | 833 FeedbackVectorRequirements base = |
| 834 ForEachStatement::ComputeFeedbackRequirements(isolate, cache); |
| 835 DCHECK(base.slots() == 0 && base.ic_slots() <= 1); |
| 836 return FeedbackVectorRequirements(1, base.ic_slots()); |
821 } | 837 } |
822 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) override { | 838 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) override { |
823 for_in_feedback_slot_ = slot; | 839 for_in_feedback_slot_ = slot; |
824 } | 840 } |
825 | 841 |
826 FeedbackVectorSlot ForInFeedbackSlot() { | 842 FeedbackVectorSlot ForInFeedbackSlot() { |
827 DCHECK(!for_in_feedback_slot_.IsInvalid()); | 843 DCHECK(!for_in_feedback_slot_.IsInvalid()); |
828 return for_in_feedback_slot_; | 844 return for_in_feedback_slot_; |
829 } | 845 } |
830 | 846 |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 | 1466 |
1451 BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); } | 1467 BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); } |
1452 | 1468 |
1453 // Return an AST id for a property that is used in simulate instructions. | 1469 // Return an AST id for a property that is used in simulate instructions. |
1454 BailoutId GetIdForProperty(int i) { return BailoutId(local_id(i + 1)); } | 1470 BailoutId GetIdForProperty(int i) { return BailoutId(local_id(i + 1)); } |
1455 | 1471 |
1456 // Unlike other AST nodes, this number of bailout IDs allocated for an | 1472 // Unlike other AST nodes, this number of bailout IDs allocated for an |
1457 // ObjectLiteral can vary, so num_ids() is not a static method. | 1473 // ObjectLiteral can vary, so num_ids() is not a static method. |
1458 int num_ids() const { return parent_num_ids() + 1 + properties()->length(); } | 1474 int num_ids() const { return parent_num_ids() + 1 + properties()->length(); } |
1459 | 1475 |
| 1476 // Object literals need one feedback slot for each non-trivial value, as well |
| 1477 // as some slots for home objects. |
| 1478 FeedbackVectorRequirements ComputeFeedbackRequirements( |
| 1479 Isolate* isolate, const ICSlotCache* cache) override; |
| 1480 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
| 1481 ICSlotCache* cache) override { |
| 1482 slot_ = slot; |
| 1483 } |
| 1484 Code::Kind FeedbackICSlotKind(int index) override { return Code::STORE_IC; } |
| 1485 FeedbackVectorICSlot GetNthSlot(int n) const { |
| 1486 return FeedbackVectorICSlot(slot_.ToInt() + n); |
| 1487 } |
| 1488 |
| 1489 // If value needs a home object, returns a valid feedback vector ic slot |
| 1490 // given by slot_index, and increments slot_index. |
| 1491 FeedbackVectorICSlot SlotForHomeObject(Expression* value, |
| 1492 int* slot_index) const; |
| 1493 |
| 1494 #ifdef DEBUG |
| 1495 int slot_count() const { return slot_count_; } |
| 1496 #endif |
| 1497 |
1460 protected: | 1498 protected: |
1461 ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index, | 1499 ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index, |
1462 int boilerplate_properties, bool has_function, | 1500 int boilerplate_properties, bool has_function, bool is_strong, |
1463 bool is_strong, int pos) | 1501 int pos) |
1464 : MaterializedLiteral(zone, literal_index, is_strong, pos), | 1502 : MaterializedLiteral(zone, literal_index, is_strong, pos), |
1465 properties_(properties), | 1503 properties_(properties), |
1466 boilerplate_properties_(boilerplate_properties), | 1504 boilerplate_properties_(boilerplate_properties), |
1467 fast_elements_(false), | 1505 fast_elements_(false), |
1468 has_elements_(false), | 1506 has_elements_(false), |
1469 may_store_doubles_(false), | 1507 may_store_doubles_(false), |
1470 has_function_(has_function) {} | 1508 has_function_(has_function), |
| 1509 #ifdef DEBUG |
| 1510 slot_count_(0), |
| 1511 #endif |
| 1512 slot_(FeedbackVectorICSlot::Invalid()) { |
| 1513 } |
1471 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } | 1514 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } |
1472 | 1515 |
1473 private: | 1516 private: |
1474 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1517 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
1475 Handle<FixedArray> constant_properties_; | 1518 Handle<FixedArray> constant_properties_; |
1476 ZoneList<Property*>* properties_; | 1519 ZoneList<Property*>* properties_; |
1477 int boilerplate_properties_; | 1520 int boilerplate_properties_; |
1478 bool fast_elements_; | 1521 bool fast_elements_; |
1479 bool has_elements_; | 1522 bool has_elements_; |
1480 bool may_store_doubles_; | 1523 bool may_store_doubles_; |
1481 bool has_function_; | 1524 bool has_function_; |
| 1525 #ifdef DEBUG |
| 1526 // slot_count_ helps validate that the logic to allocate ic slots and the |
| 1527 // logic to use them are in sync. |
| 1528 int slot_count_; |
| 1529 #endif |
| 1530 FeedbackVectorICSlot slot_; |
1482 }; | 1531 }; |
1483 | 1532 |
1484 | 1533 |
1485 // Node for capturing a regexp literal. | 1534 // Node for capturing a regexp literal. |
1486 class RegExpLiteral final : public MaterializedLiteral { | 1535 class RegExpLiteral final : public MaterializedLiteral { |
1487 public: | 1536 public: |
1488 DECLARE_NODE_TYPE(RegExpLiteral) | 1537 DECLARE_NODE_TYPE(RegExpLiteral) |
1489 | 1538 |
1490 Handle<String> pattern() const { return pattern_->string(); } | 1539 Handle<String> pattern() const { return pattern_->string(); } |
1491 Handle<String> flags() const { return flags_->string(); } | 1540 Handle<String> flags() const { return flags_->string(); } |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1647 const AstRawString* raw_name_; // if !is_resolved_ | 1696 const AstRawString* raw_name_; // if !is_resolved_ |
1648 Variable* var_; // if is_resolved_ | 1697 Variable* var_; // if is_resolved_ |
1649 }; | 1698 }; |
1650 // Position is stored in the AstNode superclass, but VariableProxy needs to | 1699 // Position is stored in the AstNode superclass, but VariableProxy needs to |
1651 // know its end position too (for error messages). It cannot be inferred from | 1700 // know its end position too (for error messages). It cannot be inferred from |
1652 // the variable name length because it can contain escapes. | 1701 // the variable name length because it can contain escapes. |
1653 int end_position_; | 1702 int end_position_; |
1654 }; | 1703 }; |
1655 | 1704 |
1656 | 1705 |
| 1706 // Left-hand side can only be a property, a global or a (parameter or local) |
| 1707 // slot. |
| 1708 enum LhsKind { |
| 1709 VARIABLE, |
| 1710 NAMED_PROPERTY, |
| 1711 KEYED_PROPERTY, |
| 1712 NAMED_SUPER_PROPERTY, |
| 1713 KEYED_SUPER_PROPERTY |
| 1714 }; |
| 1715 |
| 1716 |
1657 class Property final : public Expression { | 1717 class Property final : public Expression { |
1658 public: | 1718 public: |
1659 DECLARE_NODE_TYPE(Property) | 1719 DECLARE_NODE_TYPE(Property) |
1660 | 1720 |
1661 bool IsValidReferenceExpression() const override { return true; } | 1721 bool IsValidReferenceExpression() const override { return true; } |
1662 | 1722 |
1663 Expression* obj() const { return obj_; } | 1723 Expression* obj() const { return obj_; } |
1664 Expression* key() const { return key_; } | 1724 Expression* key() const { return key_; } |
1665 | 1725 |
1666 static int num_ids() { return parent_num_ids() + 1; } | 1726 static int num_ids() { return parent_num_ids() + 1; } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 } | 1774 } |
1715 Code::Kind FeedbackICSlotKind(int index) override { | 1775 Code::Kind FeedbackICSlotKind(int index) override { |
1716 return key()->IsPropertyName() ? Code::LOAD_IC : Code::KEYED_LOAD_IC; | 1776 return key()->IsPropertyName() ? Code::LOAD_IC : Code::KEYED_LOAD_IC; |
1717 } | 1777 } |
1718 | 1778 |
1719 FeedbackVectorICSlot PropertyFeedbackSlot() const { | 1779 FeedbackVectorICSlot PropertyFeedbackSlot() const { |
1720 DCHECK(!property_feedback_slot_.IsInvalid()); | 1780 DCHECK(!property_feedback_slot_.IsInvalid()); |
1721 return property_feedback_slot_; | 1781 return property_feedback_slot_; |
1722 } | 1782 } |
1723 | 1783 |
| 1784 static LhsKind GetAssignType(Property* property) { |
| 1785 if (property == NULL) return VARIABLE; |
| 1786 bool super_access = property->IsSuperAccess(); |
| 1787 return (property->key()->IsPropertyName()) |
| 1788 ? (super_access ? NAMED_SUPER_PROPERTY : NAMED_PROPERTY) |
| 1789 : (super_access ? KEYED_SUPER_PROPERTY : KEYED_PROPERTY); |
| 1790 } |
| 1791 |
1724 protected: | 1792 protected: |
1725 Property(Zone* zone, Expression* obj, Expression* key, int pos) | 1793 Property(Zone* zone, Expression* obj, Expression* key, int pos) |
1726 : Expression(zone, pos), | 1794 : Expression(zone, pos), |
1727 bit_field_(IsForCallField::encode(false) | | 1795 bit_field_(IsForCallField::encode(false) | |
1728 IsStringAccessField::encode(false) | | 1796 IsStringAccessField::encode(false) | |
1729 InlineCacheStateField::encode(UNINITIALIZED)), | 1797 InlineCacheStateField::encode(UNINITIALIZED)), |
1730 property_feedback_slot_(FeedbackVectorICSlot::Invalid()), | 1798 property_feedback_slot_(FeedbackVectorICSlot::Invalid()), |
1731 obj_(obj), | 1799 obj_(obj), |
1732 key_(key) {} | 1800 key_(key) {} |
1733 static int parent_num_ids() { return Expression::num_ids(); } | 1801 static int parent_num_ids() { return Expression::num_ids(); } |
(...skipping 18 matching lines...) Expand all Loading... |
1752 DECLARE_NODE_TYPE(Call) | 1820 DECLARE_NODE_TYPE(Call) |
1753 | 1821 |
1754 Expression* expression() const { return expression_; } | 1822 Expression* expression() const { return expression_; } |
1755 ZoneList<Expression*>* arguments() const { return arguments_; } | 1823 ZoneList<Expression*>* arguments() const { return arguments_; } |
1756 | 1824 |
1757 // Type feedback information. | 1825 // Type feedback information. |
1758 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( | 1826 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( |
1759 Isolate* isolate, const ICSlotCache* cache) override; | 1827 Isolate* isolate, const ICSlotCache* cache) override; |
1760 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, | 1828 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
1761 ICSlotCache* cache) override { | 1829 ICSlotCache* cache) override { |
1762 ic_slot_or_slot_ = slot.ToInt(); | 1830 ic_slot_ = slot; |
1763 } | 1831 } |
1764 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) override { | 1832 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) override { slot_ = slot; } |
1765 ic_slot_or_slot_ = slot.ToInt(); | |
1766 } | |
1767 Code::Kind FeedbackICSlotKind(int index) override { return Code::CALL_IC; } | 1833 Code::Kind FeedbackICSlotKind(int index) override { return Code::CALL_IC; } |
1768 | 1834 |
1769 FeedbackVectorSlot CallFeedbackSlot() const { | 1835 FeedbackVectorSlot CallFeedbackSlot() const { return slot_; } |
1770 DCHECK(ic_slot_or_slot_ != FeedbackVectorSlot::Invalid().ToInt()); | |
1771 return FeedbackVectorSlot(ic_slot_or_slot_); | |
1772 } | |
1773 | 1836 |
1774 FeedbackVectorICSlot CallFeedbackICSlot() const { | 1837 FeedbackVectorICSlot CallFeedbackICSlot() const { return ic_slot_; } |
1775 DCHECK(ic_slot_or_slot_ != FeedbackVectorICSlot::Invalid().ToInt()); | |
1776 return FeedbackVectorICSlot(ic_slot_or_slot_); | |
1777 } | |
1778 | 1838 |
1779 SmallMapList* GetReceiverTypes() override { | 1839 SmallMapList* GetReceiverTypes() override { |
1780 if (expression()->IsProperty()) { | 1840 if (expression()->IsProperty()) { |
1781 return expression()->AsProperty()->GetReceiverTypes(); | 1841 return expression()->AsProperty()->GetReceiverTypes(); |
1782 } | 1842 } |
1783 return NULL; | 1843 return NULL; |
1784 } | 1844 } |
1785 | 1845 |
1786 bool IsMonomorphic() override { | 1846 bool IsMonomorphic() override { |
1787 if (expression()->IsProperty()) { | 1847 if (expression()->IsProperty()) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1839 | 1899 |
1840 #ifdef DEBUG | 1900 #ifdef DEBUG |
1841 // Used to assert that the FullCodeGenerator records the return site. | 1901 // Used to assert that the FullCodeGenerator records the return site. |
1842 bool return_is_recorded_; | 1902 bool return_is_recorded_; |
1843 #endif | 1903 #endif |
1844 | 1904 |
1845 protected: | 1905 protected: |
1846 Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, | 1906 Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, |
1847 int pos) | 1907 int pos) |
1848 : Expression(zone, pos), | 1908 : Expression(zone, pos), |
1849 ic_slot_or_slot_(FeedbackVectorICSlot::Invalid().ToInt()), | 1909 ic_slot_(FeedbackVectorICSlot::Invalid()), |
| 1910 slot_(FeedbackVectorSlot::Invalid()), |
1850 expression_(expression), | 1911 expression_(expression), |
1851 arguments_(arguments), | 1912 arguments_(arguments), |
1852 bit_field_(IsUninitializedField::encode(false)) { | 1913 bit_field_(IsUninitializedField::encode(false)) { |
1853 if (expression->IsProperty()) { | 1914 if (expression->IsProperty()) { |
1854 expression->AsProperty()->mark_for_call(); | 1915 expression->AsProperty()->mark_for_call(); |
1855 } | 1916 } |
1856 } | 1917 } |
1857 static int parent_num_ids() { return Expression::num_ids(); } | 1918 static int parent_num_ids() { return Expression::num_ids(); } |
1858 | 1919 |
1859 private: | 1920 private: |
1860 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1921 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
1861 | 1922 |
1862 // We store this as an integer because we don't know if we have a slot or | 1923 FeedbackVectorICSlot ic_slot_; |
1863 // an ic slot until scoping time. | 1924 FeedbackVectorSlot slot_; |
1864 int ic_slot_or_slot_; | |
1865 Expression* expression_; | 1925 Expression* expression_; |
1866 ZoneList<Expression*>* arguments_; | 1926 ZoneList<Expression*>* arguments_; |
1867 Handle<JSFunction> target_; | 1927 Handle<JSFunction> target_; |
1868 Handle<AllocationSite> allocation_site_; | 1928 Handle<AllocationSite> allocation_site_; |
1869 class IsUninitializedField : public BitField8<bool, 0, 1> {}; | 1929 class IsUninitializedField : public BitField8<bool, 0, 1> {}; |
1870 uint8_t bit_field_; | 1930 uint8_t bit_field_; |
1871 }; | 1931 }; |
1872 | 1932 |
1873 | 1933 |
1874 class CallNew final : public Expression { | 1934 class CallNew final : public Expression { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2113 static int num_ids() { return parent_num_ids() + 4; } | 2173 static int num_ids() { return parent_num_ids() + 4; } |
2114 BailoutId AssignmentId() const { return BailoutId(local_id(0)); } | 2174 BailoutId AssignmentId() const { return BailoutId(local_id(0)); } |
2115 BailoutId ToNumberId() const { return BailoutId(local_id(1)); } | 2175 BailoutId ToNumberId() const { return BailoutId(local_id(1)); } |
2116 TypeFeedbackId CountBinOpFeedbackId() const { | 2176 TypeFeedbackId CountBinOpFeedbackId() const { |
2117 return TypeFeedbackId(local_id(2)); | 2177 return TypeFeedbackId(local_id(2)); |
2118 } | 2178 } |
2119 TypeFeedbackId CountStoreFeedbackId() const { | 2179 TypeFeedbackId CountStoreFeedbackId() const { |
2120 return TypeFeedbackId(local_id(3)); | 2180 return TypeFeedbackId(local_id(3)); |
2121 } | 2181 } |
2122 | 2182 |
| 2183 FeedbackVectorRequirements ComputeFeedbackRequirements( |
| 2184 Isolate* isolate, const ICSlotCache* cache) override; |
| 2185 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
| 2186 ICSlotCache* cache) override { |
| 2187 slot_ = slot; |
| 2188 } |
| 2189 Code::Kind FeedbackICSlotKind(int index) override; |
| 2190 FeedbackVectorICSlot CountSlot() const { return slot_; } |
| 2191 |
2123 protected: | 2192 protected: |
2124 CountOperation(Zone* zone, Token::Value op, bool is_prefix, Expression* expr, | 2193 CountOperation(Zone* zone, Token::Value op, bool is_prefix, Expression* expr, |
2125 int pos) | 2194 int pos) |
2126 : Expression(zone, pos), | 2195 : Expression(zone, pos), |
2127 bit_field_(IsPrefixField::encode(is_prefix) | | 2196 bit_field_( |
2128 KeyTypeField::encode(ELEMENT) | | 2197 IsPrefixField::encode(is_prefix) | KeyTypeField::encode(ELEMENT) | |
2129 StoreModeField::encode(STANDARD_STORE) | | 2198 StoreModeField::encode(STANDARD_STORE) | TokenField::encode(op)), |
2130 TokenField::encode(op)), | |
2131 type_(NULL), | 2199 type_(NULL), |
2132 expression_(expr) {} | 2200 expression_(expr), |
| 2201 slot_(FeedbackVectorICSlot::Invalid()) {} |
2133 static int parent_num_ids() { return Expression::num_ids(); } | 2202 static int parent_num_ids() { return Expression::num_ids(); } |
2134 | 2203 |
2135 private: | 2204 private: |
2136 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2205 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
2137 | 2206 |
2138 class IsPrefixField : public BitField16<bool, 0, 1> {}; | 2207 class IsPrefixField : public BitField16<bool, 0, 1> {}; |
2139 class KeyTypeField : public BitField16<IcCheckType, 1, 1> {}; | 2208 class KeyTypeField : public BitField16<IcCheckType, 1, 1> {}; |
2140 class StoreModeField : public BitField16<KeyedAccessStoreMode, 2, 4> {}; | 2209 class StoreModeField : public BitField16<KeyedAccessStoreMode, 2, 4> {}; |
2141 class TokenField : public BitField16<Token::Value, 6, 8> {}; | 2210 class TokenField : public BitField16<Token::Value, 6, 8> {}; |
2142 | 2211 |
2143 // Starts with 16-bit field, which should get packed together with | 2212 // Starts with 16-bit field, which should get packed together with |
2144 // Expression's trailing 16-bit field. | 2213 // Expression's trailing 16-bit field. |
2145 uint16_t bit_field_; | 2214 uint16_t bit_field_; |
2146 Type* type_; | 2215 Type* type_; |
2147 Expression* expression_; | 2216 Expression* expression_; |
2148 SmallMapList receiver_types_; | 2217 SmallMapList receiver_types_; |
| 2218 FeedbackVectorICSlot slot_; |
2149 }; | 2219 }; |
2150 | 2220 |
2151 | 2221 |
2152 class CompareOperation final : public Expression { | 2222 class CompareOperation final : public Expression { |
2153 public: | 2223 public: |
2154 DECLARE_NODE_TYPE(CompareOperation) | 2224 DECLARE_NODE_TYPE(CompareOperation) |
2155 | 2225 |
2156 Token::Value op() const { return op_; } | 2226 Token::Value op() const { return op_; } |
2157 Expression* left() const { return left_; } | 2227 Expression* left() const { return left_; } |
2158 Expression* right() const { return right_; } | 2228 Expression* right() const { return right_; } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2281 void set_is_uninitialized(bool b) { | 2351 void set_is_uninitialized(bool b) { |
2282 bit_field_ = IsUninitializedField::update(bit_field_, b); | 2352 bit_field_ = IsUninitializedField::update(bit_field_, b); |
2283 } | 2353 } |
2284 void set_key_type(IcCheckType key_type) { | 2354 void set_key_type(IcCheckType key_type) { |
2285 bit_field_ = KeyTypeField::update(bit_field_, key_type); | 2355 bit_field_ = KeyTypeField::update(bit_field_, key_type); |
2286 } | 2356 } |
2287 void set_store_mode(KeyedAccessStoreMode mode) { | 2357 void set_store_mode(KeyedAccessStoreMode mode) { |
2288 bit_field_ = StoreModeField::update(bit_field_, mode); | 2358 bit_field_ = StoreModeField::update(bit_field_, mode); |
2289 } | 2359 } |
2290 | 2360 |
| 2361 FeedbackVectorRequirements ComputeFeedbackRequirements( |
| 2362 Isolate* isolate, const ICSlotCache* cache) override; |
| 2363 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
| 2364 ICSlotCache* cache) override { |
| 2365 slot_ = slot; |
| 2366 } |
| 2367 Code::Kind FeedbackICSlotKind(int index) override; |
| 2368 FeedbackVectorICSlot AssignmentSlot() const { return slot_; } |
| 2369 |
2291 protected: | 2370 protected: |
2292 Assignment(Zone* zone, Token::Value op, Expression* target, Expression* value, | 2371 Assignment(Zone* zone, Token::Value op, Expression* target, Expression* value, |
2293 int pos); | 2372 int pos); |
2294 static int parent_num_ids() { return Expression::num_ids(); } | 2373 static int parent_num_ids() { return Expression::num_ids(); } |
2295 | 2374 |
2296 private: | 2375 private: |
2297 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2376 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
2298 | 2377 |
2299 class IsUninitializedField : public BitField16<bool, 0, 1> {}; | 2378 class IsUninitializedField : public BitField16<bool, 0, 1> {}; |
2300 class KeyTypeField : public BitField16<IcCheckType, 1, 1> {}; | 2379 class KeyTypeField : public BitField16<IcCheckType, 1, 1> {}; |
2301 class StoreModeField : public BitField16<KeyedAccessStoreMode, 2, 4> {}; | 2380 class StoreModeField : public BitField16<KeyedAccessStoreMode, 2, 4> {}; |
2302 class TokenField : public BitField16<Token::Value, 6, 8> {}; | 2381 class TokenField : public BitField16<Token::Value, 6, 8> {}; |
2303 | 2382 |
2304 // Starts with 16-bit field, which should get packed together with | 2383 // Starts with 16-bit field, which should get packed together with |
2305 // Expression's trailing 16-bit field. | 2384 // Expression's trailing 16-bit field. |
2306 uint16_t bit_field_; | 2385 uint16_t bit_field_; |
2307 Expression* target_; | 2386 Expression* target_; |
2308 Expression* value_; | 2387 Expression* value_; |
2309 BinaryOperation* binary_operation_; | 2388 BinaryOperation* binary_operation_; |
2310 SmallMapList receiver_types_; | 2389 SmallMapList receiver_types_; |
| 2390 FeedbackVectorICSlot slot_; |
2311 }; | 2391 }; |
2312 | 2392 |
2313 | 2393 |
2314 class Yield final : public Expression { | 2394 class Yield final : public Expression { |
2315 public: | 2395 public: |
2316 DECLARE_NODE_TYPE(Yield) | 2396 DECLARE_NODE_TYPE(Yield) |
2317 | 2397 |
2318 enum Kind { | 2398 enum Kind { |
2319 kInitial, // The initial yield that returns the unboxed generator object. | 2399 kInitial, // The initial yield that returns the unboxed generator object. |
2320 kSuspend, // A normal yield: { value: EXPRESSION, done: false } | 2400 kSuspend, // A normal yield: { value: EXPRESSION, done: false } |
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3497 | 3577 |
3498 private: | 3578 private: |
3499 Zone* zone_; | 3579 Zone* zone_; |
3500 AstValueFactory* ast_value_factory_; | 3580 AstValueFactory* ast_value_factory_; |
3501 }; | 3581 }; |
3502 | 3582 |
3503 | 3583 |
3504 } } // namespace v8::internal | 3584 } } // namespace v8::internal |
3505 | 3585 |
3506 #endif // V8_AST_H_ | 3586 #endif // V8_AST_H_ |
OLD | NEW |