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