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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 bool IsNullLiteral() const; | 352 bool IsNullLiteral() const; |
353 | 353 |
354 // True if we can prove that the expression is the undefined literal. | 354 // True if we can prove that the expression is the undefined literal. |
355 bool IsUndefinedLiteral(Isolate* isolate) const; | 355 bool IsUndefinedLiteral(Isolate* isolate) const; |
356 | 356 |
357 // Expression type bounds | 357 // Expression type bounds |
358 Bounds bounds() const { return bounds_; } | 358 Bounds bounds() const { return bounds_; } |
359 void set_bounds(Bounds bounds) { bounds_ = bounds; } | 359 void set_bounds(Bounds bounds) { bounds_ = bounds; } |
360 | 360 |
361 // Whether the expression is parenthesized | 361 // Whether the expression is parenthesized |
362 bool is_parenthesized() const { return is_parenthesized_; } | 362 bool is_parenthesized() const { |
363 bool is_multi_parenthesized() const { return is_multi_parenthesized_; } | 363 return IsParenthesizedField::decode(bit_field_); |
364 } | |
365 bool is_multi_parenthesized() const { | |
366 return IsMultiParenthesizedField::decode(bit_field_); | |
367 } | |
364 void increase_parenthesization_level() { | 368 void increase_parenthesization_level() { |
365 is_multi_parenthesized_ = is_parenthesized_; | 369 bit_field_ = |
366 is_parenthesized_ = true; | 370 IsMultiParenthesizedField::update(bit_field_, is_parenthesized()); |
371 bit_field_ = IsParenthesizedField::update(bit_field_, true); | |
367 } | 372 } |
368 | 373 |
369 // Type feedback information for assignments and properties. | 374 // Type feedback information for assignments and properties. |
370 virtual bool IsMonomorphic() { | 375 virtual bool IsMonomorphic() { |
371 UNREACHABLE(); | 376 UNREACHABLE(); |
372 return false; | 377 return false; |
373 } | 378 } |
374 virtual SmallMapList* GetReceiverTypes() { | 379 virtual SmallMapList* GetReceiverTypes() { |
375 UNREACHABLE(); | 380 UNREACHABLE(); |
376 return NULL; | 381 return NULL; |
377 } | 382 } |
378 virtual KeyedAccessStoreMode GetStoreMode() { | 383 virtual KeyedAccessStoreMode GetStoreMode() const { |
379 UNREACHABLE(); | 384 UNREACHABLE(); |
380 return STANDARD_STORE; | 385 return STANDARD_STORE; |
381 } | 386 } |
382 virtual IcCheckType GetKeyType() { | 387 virtual IcCheckType GetKeyType() const { |
383 UNREACHABLE(); | 388 UNREACHABLE(); |
384 return ELEMENT; | 389 return ELEMENT; |
385 } | 390 } |
386 | 391 |
387 // TODO(rossberg): this should move to its own AST node eventually. | 392 // TODO(rossberg): this should move to its own AST node eventually. |
388 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); | 393 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); |
389 byte to_boolean_types() const { return to_boolean_types_; } | 394 byte to_boolean_types() const { |
395 return ToBooleanTypesField::decode(bit_field_); | |
396 } | |
390 | 397 |
391 void set_base_id(int id) { base_id_ = id; } | 398 void set_base_id(int id) { base_id_ = id; } |
392 static int num_ids() { return parent_num_ids() + 2; } | 399 static int num_ids() { return parent_num_ids() + 2; } |
393 BailoutId id() const { return BailoutId(local_id(0)); } | 400 BailoutId id() const { return BailoutId(local_id(0)); } |
394 TypeFeedbackId test_id() const { return TypeFeedbackId(local_id(1)); } | 401 TypeFeedbackId test_id() const { return TypeFeedbackId(local_id(1)); } |
395 | 402 |
396 protected: | 403 protected: |
397 Expression(Zone* zone, int pos) | 404 Expression(Zone* zone, int pos) |
398 : AstNode(pos), | 405 : AstNode(pos), |
399 base_id_(BailoutId::None().ToInt()), | 406 base_id_(BailoutId::None().ToInt()), |
400 bounds_(Bounds::Unbounded(zone)), | 407 bounds_(Bounds::Unbounded(zone)), |
401 is_parenthesized_(false), | 408 bit_field_(0) {} |
402 is_multi_parenthesized_(false) {} | |
403 static int parent_num_ids() { return 0; } | 409 static int parent_num_ids() { return 0; } |
404 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } | 410 void set_to_boolean_types(byte types) { |
411 bit_field_ = ToBooleanTypesField::update(bit_field_, types); | |
412 } | |
405 | 413 |
406 int base_id() const { | 414 int base_id() const { |
407 DCHECK(!BailoutId(base_id_).IsNone()); | 415 DCHECK(!BailoutId(base_id_).IsNone()); |
408 return base_id_; | 416 return base_id_; |
409 } | 417 } |
410 | 418 |
411 private: | 419 private: |
412 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 420 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
413 | 421 |
414 int base_id_; | 422 int base_id_; |
415 Bounds bounds_; | 423 Bounds bounds_; |
416 byte to_boolean_types_; | 424 class ToBooleanTypesField : public BitField<byte, 0, 8> {}; |
417 bool is_parenthesized_ : 1; | 425 class IsParenthesizedField : public BitField<bool, 8, 1> {}; |
418 bool is_multi_parenthesized_ : 1; | 426 class IsMultiParenthesizedField : public BitField<bool, 9, 1> {}; |
427 uint32_t bit_field_; | |
brucedawson
2014/11/05 01:33:17
Why use a bit field at all? byte/bool/bool take up
Sven Panne
2014/11/05 09:11:49
All the code in ast.h *must* stay as it is, for th
Jakob Kummerow
2014/11/05 12:13:46
Used a smaller field per offline discussion.
| |
419 }; | 428 }; |
420 | 429 |
421 | 430 |
422 class BreakableStatement : public Statement { | 431 class BreakableStatement : public Statement { |
423 public: | 432 public: |
424 enum BreakableType { | 433 enum BreakableType { |
425 TARGET_FOR_ANONYMOUS, | 434 TARGET_FOR_ANONYMOUS, |
426 TARGET_FOR_NAMED_ONLY | 435 TARGET_FOR_NAMED_ONLY |
427 }; | 436 }; |
428 | 437 |
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1690 Variable* var() const { | 1699 Variable* var() const { |
1691 DCHECK(is_resolved()); | 1700 DCHECK(is_resolved()); |
1692 return var_; | 1701 return var_; |
1693 } | 1702 } |
1694 void set_var(Variable* v) { | 1703 void set_var(Variable* v) { |
1695 DCHECK(!is_resolved()); | 1704 DCHECK(!is_resolved()); |
1696 DCHECK_NOT_NULL(v); | 1705 DCHECK_NOT_NULL(v); |
1697 var_ = v; | 1706 var_ = v; |
1698 } | 1707 } |
1699 | 1708 |
1700 bool is_this() const { return is_this_; } | 1709 bool is_this() const { return IsThisField::decode(bit_field_); } |
1701 | 1710 |
1702 bool is_assigned() const { return is_assigned_; } | 1711 bool is_assigned() const { return IsAssignedField::decode(bit_field_); } |
1703 void set_is_assigned() { is_assigned_ = true; } | 1712 void set_is_assigned() { |
1713 bit_field_ = IsAssignedField::update(bit_field_, true); | |
1714 } | |
1704 | 1715 |
1705 bool is_resolved() const { return is_resolved_; } | 1716 bool is_resolved() const { return IsResolvedField::decode(bit_field_); } |
1706 void set_is_resolved() { is_resolved_ = true; } | 1717 void set_is_resolved() { |
1718 bit_field_ = IsResolvedField::update(bit_field_, true); | |
1719 } | |
1707 | 1720 |
1708 Interface* interface() const { return interface_; } | 1721 Interface* interface() const { return interface_; } |
1709 | 1722 |
1710 // Bind this proxy to the variable var. Interfaces must match. | 1723 // Bind this proxy to the variable var. Interfaces must match. |
1711 void BindTo(Variable* var); | 1724 void BindTo(Variable* var); |
1712 | 1725 |
1713 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { | 1726 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { |
1714 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); | 1727 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); |
1715 } | 1728 } |
1716 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { | 1729 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { |
1717 variable_feedback_slot_ = slot; | 1730 variable_feedback_slot_ = slot; |
1718 } | 1731 } |
1719 | 1732 |
1720 FeedbackVectorICSlot VariableFeedbackSlot() { | 1733 FeedbackVectorICSlot VariableFeedbackSlot() { |
1721 return variable_feedback_slot_; | 1734 return variable_feedback_slot_; |
1722 } | 1735 } |
1723 | 1736 |
1724 protected: | 1737 protected: |
1725 VariableProxy(Zone* zone, Variable* var, int position); | 1738 VariableProxy(Zone* zone, Variable* var, int position); |
1726 | 1739 |
1727 VariableProxy(Zone* zone, const AstRawString* name, bool is_this, | 1740 VariableProxy(Zone* zone, const AstRawString* name, bool is_this, |
1728 Interface* interface, int position); | 1741 Interface* interface, int position); |
1729 | 1742 |
1730 bool is_this_ : 1; | 1743 class IsThisField : public BitField<bool, 0, 1> {}; |
1731 bool is_assigned_ : 1; | 1744 class IsAssignedField : public BitField<bool, 1, 1> {}; |
1732 bool is_resolved_ : 1; | 1745 class IsResolvedField : public BitField<bool, 2, 1> {}; |
1746 uint32_t bit_field_; | |
1733 FeedbackVectorICSlot variable_feedback_slot_; | 1747 FeedbackVectorICSlot variable_feedback_slot_; |
1734 union { | 1748 union { |
1735 const AstRawString* raw_name_; // if !is_resolved_ | 1749 const AstRawString* raw_name_; // if !is_resolved_ |
1736 Variable* var_; // if is_resolved_ | 1750 Variable* var_; // if is_resolved_ |
1737 }; | 1751 }; |
1738 Interface* interface_; | 1752 Interface* interface_; |
1739 }; | 1753 }; |
1740 | 1754 |
1741 | 1755 |
1742 class Property FINAL : public Expression { | 1756 class Property FINAL : public Expression { |
1743 public: | 1757 public: |
1744 DECLARE_NODE_TYPE(Property) | 1758 DECLARE_NODE_TYPE(Property) |
1745 | 1759 |
1746 virtual bool IsValidReferenceExpression() const OVERRIDE { return true; } | 1760 virtual bool IsValidReferenceExpression() const OVERRIDE { return true; } |
1747 | 1761 |
1748 Expression* obj() const { return obj_; } | 1762 Expression* obj() const { return obj_; } |
1749 Expression* key() const { return key_; } | 1763 Expression* key() const { return key_; } |
1750 | 1764 |
1751 static int num_ids() { return parent_num_ids() + 2; } | 1765 static int num_ids() { return parent_num_ids() + 2; } |
1752 BailoutId LoadId() const { return BailoutId(local_id(0)); } | 1766 BailoutId LoadId() const { return BailoutId(local_id(0)); } |
1753 TypeFeedbackId PropertyFeedbackId() { return TypeFeedbackId(local_id(1)); } | 1767 TypeFeedbackId PropertyFeedbackId() { return TypeFeedbackId(local_id(1)); } |
1754 | 1768 |
1755 bool IsStringAccess() const { return is_string_access_; } | 1769 bool IsStringAccess() const { |
1770 return IsStringAccessField::decode(bit_field_); | |
1771 } | |
1756 | 1772 |
1757 // Type feedback information. | 1773 // Type feedback information. |
1758 virtual bool IsMonomorphic() OVERRIDE { | 1774 virtual bool IsMonomorphic() OVERRIDE { |
1759 return receiver_types_.length() == 1; | 1775 return receiver_types_.length() == 1; |
1760 } | 1776 } |
1761 virtual SmallMapList* GetReceiverTypes() OVERRIDE { | 1777 virtual SmallMapList* GetReceiverTypes() OVERRIDE { |
1762 return &receiver_types_; | 1778 return &receiver_types_; |
1763 } | 1779 } |
1764 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE { | 1780 virtual KeyedAccessStoreMode GetStoreMode() const OVERRIDE { |
1765 return STANDARD_STORE; | 1781 return STANDARD_STORE; |
1766 } | 1782 } |
1767 virtual IcCheckType GetKeyType() OVERRIDE { | 1783 virtual IcCheckType GetKeyType() const OVERRIDE { |
1768 // PROPERTY key types currently aren't implemented for KeyedLoadICs. | 1784 // PROPERTY key types currently aren't implemented for KeyedLoadICs. |
1769 return ELEMENT; | 1785 return ELEMENT; |
1770 } | 1786 } |
1771 bool IsUninitialized() { return !is_for_call_ && is_uninitialized_; } | 1787 bool IsUninitialized() const { |
1772 bool HasNoTypeInformation() { | 1788 return !is_for_call() && HasNoTypeInformation(); |
1773 return is_uninitialized_; | |
1774 } | 1789 } |
1775 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } | 1790 bool HasNoTypeInformation() const { |
1776 void set_is_string_access(bool b) { is_string_access_ = b; } | 1791 return IsUninitializedField::decode(bit_field_); |
1777 void mark_for_call() { is_for_call_ = true; } | 1792 } |
1778 bool IsForCall() { return is_for_call_; } | 1793 void set_is_uninitialized(bool b) { |
1794 bit_field_ = IsUninitializedField::update(bit_field_, b); | |
1795 } | |
1796 void set_is_string_access(bool b) { | |
1797 bit_field_ = IsStringAccessField::update(bit_field_, b); | |
1798 } | |
1799 void mark_for_call() { | |
1800 bit_field_ = IsForCallField::update(bit_field_, true); | |
1801 } | |
1802 bool is_for_call() const { return IsForCallField::decode(bit_field_); } | |
1779 | 1803 |
1780 bool IsSuperAccess() { | 1804 bool IsSuperAccess() { |
1781 return obj()->IsSuperReference(); | 1805 return obj()->IsSuperReference(); |
1782 } | 1806 } |
1783 | 1807 |
1784 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { | 1808 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { |
1785 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); | 1809 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); |
1786 } | 1810 } |
1787 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { | 1811 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { |
1788 property_feedback_slot_ = slot; | 1812 property_feedback_slot_ = slot; |
1789 } | 1813 } |
1790 | 1814 |
1791 FeedbackVectorICSlot PropertyFeedbackSlot() const { | 1815 FeedbackVectorICSlot PropertyFeedbackSlot() const { |
1792 return property_feedback_slot_; | 1816 return property_feedback_slot_; |
1793 } | 1817 } |
1794 | 1818 |
1795 protected: | 1819 protected: |
1796 Property(Zone* zone, Expression* obj, Expression* key, int pos) | 1820 Property(Zone* zone, Expression* obj, Expression* key, int pos) |
1797 : Expression(zone, pos), | 1821 : Expression(zone, pos), |
1798 is_for_call_(false), | 1822 bit_field_(IsForCallField::encode(false) | |
1799 is_uninitialized_(false), | 1823 IsUninitializedField::encode(false) | |
1800 is_string_access_(false), | 1824 IsStringAccessField::encode(false)), |
1801 property_feedback_slot_(FeedbackVectorICSlot::Invalid()), | 1825 property_feedback_slot_(FeedbackVectorICSlot::Invalid()), |
1802 obj_(obj), | 1826 obj_(obj), |
1803 key_(key) {} | 1827 key_(key) {} |
1804 static int parent_num_ids() { return Expression::num_ids(); } | 1828 static int parent_num_ids() { return Expression::num_ids(); } |
1805 | 1829 |
1806 private: | 1830 private: |
1807 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1831 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
1808 | 1832 |
1809 bool is_for_call_ : 1; | 1833 class IsForCallField : public BitField<bool, 0, 1> {}; |
1810 bool is_uninitialized_ : 1; | 1834 class IsUninitializedField : public BitField<bool, 1, 1> {}; |
1811 bool is_string_access_ : 1; | 1835 class IsStringAccessField : public BitField<bool, 2, 1> {}; |
1836 uint32_t bit_field_; | |
1812 FeedbackVectorICSlot property_feedback_slot_; | 1837 FeedbackVectorICSlot property_feedback_slot_; |
1813 Expression* obj_; | 1838 Expression* obj_; |
1814 Expression* key_; | 1839 Expression* key_; |
1815 SmallMapList receiver_types_; | 1840 SmallMapList receiver_types_; |
1816 }; | 1841 }; |
1817 | 1842 |
1818 | 1843 |
1819 class Call FINAL : public Expression { | 1844 class Call FINAL : public Expression { |
1820 public: | 1845 public: |
1821 DECLARE_NODE_TYPE(Call) | 1846 DECLARE_NODE_TYPE(Call) |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2113 Expression* left_; | 2138 Expression* left_; |
2114 Expression* right_; | 2139 Expression* right_; |
2115 Handle<AllocationSite> allocation_site_; | 2140 Handle<AllocationSite> allocation_site_; |
2116 }; | 2141 }; |
2117 | 2142 |
2118 | 2143 |
2119 class CountOperation FINAL : public Expression { | 2144 class CountOperation FINAL : public Expression { |
2120 public: | 2145 public: |
2121 DECLARE_NODE_TYPE(CountOperation) | 2146 DECLARE_NODE_TYPE(CountOperation) |
2122 | 2147 |
2123 bool is_prefix() const { return is_prefix_; } | 2148 bool is_prefix() const { return IsPrefixField::decode(bit_field_); } |
2124 bool is_postfix() const { return !is_prefix_; } | 2149 bool is_postfix() const { return !is_prefix(); } |
2125 | 2150 |
2126 Token::Value op() const { return op_; } | 2151 Token::Value op() const { return op_; } |
2127 Token::Value binary_op() { | 2152 Token::Value binary_op() { |
2128 return (op() == Token::INC) ? Token::ADD : Token::SUB; | 2153 return (op() == Token::INC) ? Token::ADD : Token::SUB; |
2129 } | 2154 } |
2130 | 2155 |
2131 Expression* expression() const { return expression_; } | 2156 Expression* expression() const { return expression_; } |
2132 | 2157 |
2133 virtual bool IsMonomorphic() OVERRIDE { | 2158 virtual bool IsMonomorphic() OVERRIDE { |
2134 return receiver_types_.length() == 1; | 2159 return receiver_types_.length() == 1; |
2135 } | 2160 } |
2136 virtual SmallMapList* GetReceiverTypes() OVERRIDE { | 2161 virtual SmallMapList* GetReceiverTypes() OVERRIDE { |
2137 return &receiver_types_; | 2162 return &receiver_types_; |
2138 } | 2163 } |
2139 virtual IcCheckType GetKeyType() OVERRIDE { return key_type_; } | 2164 virtual IcCheckType GetKeyType() const OVERRIDE { |
2140 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE { | 2165 return KeyTypeField::decode(bit_field_); |
2141 return store_mode_; | 2166 } |
2167 virtual KeyedAccessStoreMode GetStoreMode() const OVERRIDE { | |
2168 return StoreModeField::decode(bit_field_); | |
2142 } | 2169 } |
2143 Type* type() const { return type_; } | 2170 Type* type() const { return type_; } |
2144 void set_key_type(IcCheckType type) { key_type_ = type; } | 2171 void set_key_type(IcCheckType type) { |
2145 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } | 2172 bit_field_ = KeyTypeField::update(bit_field_, type); |
2173 } | |
2174 void set_store_mode(KeyedAccessStoreMode mode) { | |
2175 bit_field_ = StoreModeField::update(bit_field_, mode); | |
2176 } | |
2146 void set_type(Type* type) { type_ = type; } | 2177 void set_type(Type* type) { type_ = type; } |
2147 | 2178 |
2148 static int num_ids() { return parent_num_ids() + 3; } | 2179 static int num_ids() { return parent_num_ids() + 3; } |
2149 BailoutId AssignmentId() const { return BailoutId(local_id(0)); } | 2180 BailoutId AssignmentId() const { return BailoutId(local_id(0)); } |
2150 TypeFeedbackId CountBinOpFeedbackId() const { | 2181 TypeFeedbackId CountBinOpFeedbackId() const { |
2151 return TypeFeedbackId(local_id(1)); | 2182 return TypeFeedbackId(local_id(1)); |
2152 } | 2183 } |
2153 TypeFeedbackId CountStoreFeedbackId() const { | 2184 TypeFeedbackId CountStoreFeedbackId() const { |
2154 return TypeFeedbackId(local_id(2)); | 2185 return TypeFeedbackId(local_id(2)); |
2155 } | 2186 } |
2156 | 2187 |
2157 protected: | 2188 protected: |
2158 CountOperation(Zone* zone, Token::Value op, bool is_prefix, Expression* expr, | 2189 CountOperation(Zone* zone, Token::Value op, bool is_prefix, Expression* expr, |
2159 int pos) | 2190 int pos) |
2160 : Expression(zone, pos), | 2191 : Expression(zone, pos), |
2161 op_(op), | 2192 op_(op), |
2162 is_prefix_(is_prefix), | 2193 bit_field_(IsPrefixField::encode(is_prefix) | |
2163 key_type_(ELEMENT), | 2194 KeyTypeField::encode(ELEMENT) | |
2164 store_mode_(STANDARD_STORE), | 2195 StoreModeField::encode(STANDARD_STORE)), |
2196 type_(NULL), | |
2165 expression_(expr) {} | 2197 expression_(expr) {} |
2166 static int parent_num_ids() { return Expression::num_ids(); } | 2198 static int parent_num_ids() { return Expression::num_ids(); } |
2167 | 2199 |
2168 private: | 2200 private: |
2169 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2201 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
2170 | 2202 |
2203 class IsPrefixField : public BitField<bool, 0, 1> {}; | |
2204 class KeyTypeField : public BitField<IcCheckType, 1, 1> {}; | |
2205 class StoreModeField : public BitField<KeyedAccessStoreMode, 2, 4> {}; | |
2206 | |
2171 Token::Value op_; | 2207 Token::Value op_; |
2172 bool is_prefix_ : 1; | 2208 uint32_t bit_field_; |
2173 IcCheckType key_type_ : 1; | |
2174 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, | |
2175 // must have extra bit. | |
2176 Type* type_; | 2209 Type* type_; |
2177 Expression* expression_; | 2210 Expression* expression_; |
2178 SmallMapList receiver_types_; | 2211 SmallMapList receiver_types_; |
2179 }; | 2212 }; |
2180 | 2213 |
2181 | 2214 |
2182 class CompareOperation FINAL : public Expression { | 2215 class CompareOperation FINAL : public Expression { |
2183 public: | 2216 public: |
2184 DECLARE_NODE_TYPE(CompareOperation) | 2217 DECLARE_NODE_TYPE(CompareOperation) |
2185 | 2218 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2270 bool is_compound() const { return op() > Token::ASSIGN; } | 2303 bool is_compound() const { return op() > Token::ASSIGN; } |
2271 | 2304 |
2272 static int num_ids() { return parent_num_ids() + 2; } | 2305 static int num_ids() { return parent_num_ids() + 2; } |
2273 BailoutId AssignmentId() const { return BailoutId(local_id(0)); } | 2306 BailoutId AssignmentId() const { return BailoutId(local_id(0)); } |
2274 | 2307 |
2275 // Type feedback information. | 2308 // Type feedback information. |
2276 TypeFeedbackId AssignmentFeedbackId() { return TypeFeedbackId(local_id(1)); } | 2309 TypeFeedbackId AssignmentFeedbackId() { return TypeFeedbackId(local_id(1)); } |
2277 virtual bool IsMonomorphic() OVERRIDE { | 2310 virtual bool IsMonomorphic() OVERRIDE { |
2278 return receiver_types_.length() == 1; | 2311 return receiver_types_.length() == 1; |
2279 } | 2312 } |
2280 bool IsUninitialized() { return is_uninitialized_; } | 2313 bool IsUninitialized() const { |
2314 return IsUninitializedField::decode(bit_field_); | |
2315 } | |
2281 bool HasNoTypeInformation() { | 2316 bool HasNoTypeInformation() { |
2282 return is_uninitialized_; | 2317 return IsUninitializedField::decode(bit_field_); |
2283 } | 2318 } |
2284 virtual SmallMapList* GetReceiverTypes() OVERRIDE { | 2319 virtual SmallMapList* GetReceiverTypes() OVERRIDE { |
2285 return &receiver_types_; | 2320 return &receiver_types_; |
2286 } | 2321 } |
2287 virtual IcCheckType GetKeyType() OVERRIDE { return key_type_; } | 2322 virtual IcCheckType GetKeyType() const OVERRIDE { |
2288 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE { | 2323 return KeyTypeField::decode(bit_field_); |
2289 return store_mode_; | |
2290 } | 2324 } |
2291 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } | 2325 virtual KeyedAccessStoreMode GetStoreMode() const OVERRIDE { |
2292 void set_key_type(IcCheckType key_type) { key_type_ = key_type; } | 2326 return StoreModeField::decode(bit_field_); |
2293 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } | 2327 } |
2328 void set_is_uninitialized(bool b) { | |
2329 bit_field_ = IsUninitializedField::update(bit_field_, b); | |
2330 } | |
2331 void set_key_type(IcCheckType key_type) { | |
2332 bit_field_ = KeyTypeField::update(bit_field_, key_type); | |
2333 } | |
2334 void set_store_mode(KeyedAccessStoreMode mode) { | |
2335 bit_field_ = StoreModeField::update(bit_field_, mode); | |
2336 } | |
2294 | 2337 |
2295 protected: | 2338 protected: |
2296 Assignment(Zone* zone, Token::Value op, Expression* target, Expression* value, | 2339 Assignment(Zone* zone, Token::Value op, Expression* target, Expression* value, |
2297 int pos); | 2340 int pos); |
2298 static int parent_num_ids() { return Expression::num_ids(); } | 2341 static int parent_num_ids() { return Expression::num_ids(); } |
2299 | 2342 |
2300 template <class Visitor> | 2343 template <class Visitor> |
2301 void Init(AstNodeFactory<Visitor>* factory) { | 2344 void Init(AstNodeFactory<Visitor>* factory) { |
2302 DCHECK(Token::IsAssignmentOp(op_)); | 2345 DCHECK(Token::IsAssignmentOp(op_)); |
2303 if (is_compound()) { | 2346 if (is_compound()) { |
2304 binary_operation_ = factory->NewBinaryOperation( | 2347 binary_operation_ = factory->NewBinaryOperation( |
2305 binary_op(), target_, value_, position() + 1); | 2348 binary_op(), target_, value_, position() + 1); |
2306 } | 2349 } |
2307 } | 2350 } |
2308 | 2351 |
2309 private: | 2352 private: |
2310 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2353 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
2311 | 2354 |
2312 bool is_uninitialized_ : 1; | 2355 class IsUninitializedField : public BitField<bool, 0, 1> {}; |
2313 IcCheckType key_type_ : 1; | 2356 class KeyTypeField : public BitField<IcCheckType, 1, 1> {}; |
2314 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, | 2357 class StoreModeField : public BitField<KeyedAccessStoreMode, 2, 4> {}; |
2315 // must have extra bit. | 2358 uint32_t bit_field_; |
2316 Token::Value op_; | 2359 Token::Value op_; |
2317 Expression* target_; | 2360 Expression* target_; |
2318 Expression* value_; | 2361 Expression* value_; |
2319 BinaryOperation* binary_operation_; | 2362 BinaryOperation* binary_operation_; |
2320 SmallMapList receiver_types_; | 2363 SmallMapList receiver_types_; |
2321 }; | 2364 }; |
2322 | 2365 |
2323 | 2366 |
2324 class Yield FINAL : public Expression { | 2367 class Yield FINAL : public Expression { |
2325 public: | 2368 public: |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3645 private: | 3688 private: |
3646 Zone* zone_; | 3689 Zone* zone_; |
3647 Visitor visitor_; | 3690 Visitor visitor_; |
3648 AstValueFactory* ast_value_factory_; | 3691 AstValueFactory* ast_value_factory_; |
3649 }; | 3692 }; |
3650 | 3693 |
3651 | 3694 |
3652 } } // namespace v8::internal | 3695 } } // namespace v8::internal |
3653 | 3696 |
3654 #endif // V8_AST_H_ | 3697 #endif // V8_AST_H_ |
OLD | NEW |