| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 virtual SmallMapList* GetReceiverTypes() { | 342 virtual SmallMapList* GetReceiverTypes() { |
| 343 UNREACHABLE(); | 343 UNREACHABLE(); |
| 344 return NULL; | 344 return NULL; |
| 345 } | 345 } |
| 346 Handle<Map> GetMonomorphicReceiverType() { | 346 Handle<Map> GetMonomorphicReceiverType() { |
| 347 ASSERT(IsMonomorphic()); | 347 ASSERT(IsMonomorphic()); |
| 348 SmallMapList* types = GetReceiverTypes(); | 348 SmallMapList* types = GetReceiverTypes(); |
| 349 ASSERT(types != NULL && types->length() == 1); | 349 ASSERT(types != NULL && types->length() == 1); |
| 350 return types->at(0); | 350 return types->at(0); |
| 351 } | 351 } |
| 352 virtual KeyedAccessStoreMode GetStoreMode() { |
| 353 UNREACHABLE(); |
| 354 return STANDARD_STORE; |
| 355 } |
| 352 | 356 |
| 353 BailoutId id() const { return id_; } | 357 BailoutId id() const { return id_; } |
| 354 TypeFeedbackId test_id() const { return test_id_; } | 358 TypeFeedbackId test_id() const { return test_id_; } |
| 355 | 359 |
| 356 protected: | 360 protected: |
| 357 explicit Expression(Isolate* isolate) | 361 explicit Expression(Isolate* isolate) |
| 358 : id_(GetNextId(isolate)), | 362 : id_(GetNextId(isolate)), |
| 359 test_id_(GetNextId(isolate)) {} | 363 test_id_(GetNextId(isolate)) {} |
| 360 | 364 |
| 361 private: | 365 private: |
| (...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1474 BailoutId LoadId() const { return load_id_; } | 1478 BailoutId LoadId() const { return load_id_; } |
| 1475 | 1479 |
| 1476 bool IsStringLength() const { return is_string_length_; } | 1480 bool IsStringLength() const { return is_string_length_; } |
| 1477 bool IsStringAccess() const { return is_string_access_; } | 1481 bool IsStringAccess() const { return is_string_access_; } |
| 1478 bool IsFunctionPrototype() const { return is_function_prototype_; } | 1482 bool IsFunctionPrototype() const { return is_function_prototype_; } |
| 1479 | 1483 |
| 1480 // Type feedback information. | 1484 // Type feedback information. |
| 1481 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); | 1485 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); |
| 1482 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1486 virtual bool IsMonomorphic() { return is_monomorphic_; } |
| 1483 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } | 1487 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } |
| 1488 virtual KeyedAccessStoreMode GetStoreMode() { |
| 1489 return STANDARD_STORE; |
| 1490 } |
| 1484 bool IsArrayLength() { return is_array_length_; } | 1491 bool IsArrayLength() { return is_array_length_; } |
| 1485 bool IsUninitialized() { return is_uninitialized_; } | 1492 bool IsUninitialized() { return is_uninitialized_; } |
| 1486 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } | 1493 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } |
| 1487 | 1494 |
| 1488 protected: | 1495 protected: |
| 1489 Property(Isolate* isolate, | 1496 Property(Isolate* isolate, |
| 1490 Expression* obj, | 1497 Expression* obj, |
| 1491 Expression* key, | 1498 Expression* key, |
| 1492 int pos) | 1499 int pos) |
| 1493 : Expression(isolate), | 1500 : Expression(isolate), |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1750 } | 1757 } |
| 1751 | 1758 |
| 1752 Expression* expression() const { return expression_; } | 1759 Expression* expression() const { return expression_; } |
| 1753 virtual int position() const { return pos_; } | 1760 virtual int position() const { return pos_; } |
| 1754 | 1761 |
| 1755 virtual void MarkAsStatement() { is_prefix_ = true; } | 1762 virtual void MarkAsStatement() { is_prefix_ = true; } |
| 1756 | 1763 |
| 1757 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* znoe); | 1764 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* znoe); |
| 1758 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1765 virtual bool IsMonomorphic() { return is_monomorphic_; } |
| 1759 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } | 1766 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } |
| 1767 virtual KeyedAccessStoreMode GetStoreMode() { |
| 1768 return store_mode_; |
| 1769 } |
| 1760 | 1770 |
| 1761 BailoutId AssignmentId() const { return assignment_id_; } | 1771 BailoutId AssignmentId() const { return assignment_id_; } |
| 1762 | 1772 |
| 1763 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } | 1773 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } |
| 1764 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } | 1774 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } |
| 1765 | 1775 |
| 1766 protected: | 1776 protected: |
| 1767 CountOperation(Isolate* isolate, | 1777 CountOperation(Isolate* isolate, |
| 1768 Token::Value op, | 1778 Token::Value op, |
| 1769 bool is_prefix, | 1779 bool is_prefix, |
| 1770 Expression* expr, | 1780 Expression* expr, |
| 1771 int pos) | 1781 int pos) |
| 1772 : Expression(isolate), | 1782 : Expression(isolate), |
| 1773 op_(op), | 1783 op_(op), |
| 1774 is_prefix_(is_prefix), | 1784 is_prefix_(is_prefix), |
| 1785 is_monomorphic_(false), |
| 1786 store_mode_(STANDARD_STORE), |
| 1775 expression_(expr), | 1787 expression_(expr), |
| 1776 pos_(pos), | 1788 pos_(pos), |
| 1777 assignment_id_(GetNextId(isolate)), | 1789 assignment_id_(GetNextId(isolate)), |
| 1778 count_id_(GetNextId(isolate)) {} | 1790 count_id_(GetNextId(isolate)) {} |
| 1779 | 1791 |
| 1780 private: | 1792 private: |
| 1781 Token::Value op_; | 1793 Token::Value op_; |
| 1782 bool is_prefix_; | 1794 bool is_prefix_ : 1; |
| 1783 bool is_monomorphic_; | 1795 bool is_monomorphic_ : 1; |
| 1796 KeyedAccessStoreMode store_mode_: 4; |
| 1784 Expression* expression_; | 1797 Expression* expression_; |
| 1785 int pos_; | 1798 int pos_; |
| 1786 const BailoutId assignment_id_; | 1799 const BailoutId assignment_id_; |
| 1787 const TypeFeedbackId count_id_; | 1800 const TypeFeedbackId count_id_; |
| 1788 SmallMapList receiver_types_; | 1801 SmallMapList receiver_types_; |
| 1789 }; | 1802 }; |
| 1790 | 1803 |
| 1791 | 1804 |
| 1792 class CompareOperation: public Expression { | 1805 class CompareOperation: public Expression { |
| 1793 public: | 1806 public: |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 // This check relies on the definition order of token in token.h. | 1899 // This check relies on the definition order of token in token.h. |
| 1887 bool is_compound() const { return op() > Token::ASSIGN; } | 1900 bool is_compound() const { return op() > Token::ASSIGN; } |
| 1888 | 1901 |
| 1889 BailoutId AssignmentId() const { return assignment_id_; } | 1902 BailoutId AssignmentId() const { return assignment_id_; } |
| 1890 | 1903 |
| 1891 // Type feedback information. | 1904 // Type feedback information. |
| 1892 TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); } | 1905 TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); } |
| 1893 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); | 1906 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); |
| 1894 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1907 virtual bool IsMonomorphic() { return is_monomorphic_; } |
| 1895 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } | 1908 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } |
| 1909 virtual KeyedAccessStoreMode GetStoreMode() { |
| 1910 return store_mode_; |
| 1911 } |
| 1896 | 1912 |
| 1897 protected: | 1913 protected: |
| 1898 Assignment(Isolate* isolate, | 1914 Assignment(Isolate* isolate, |
| 1899 Token::Value op, | 1915 Token::Value op, |
| 1900 Expression* target, | 1916 Expression* target, |
| 1901 Expression* value, | 1917 Expression* value, |
| 1902 int pos); | 1918 int pos); |
| 1903 | 1919 |
| 1904 template<class Visitor> | 1920 template<class Visitor> |
| 1905 void Init(Isolate* isolate, AstNodeFactory<Visitor>* factory) { | 1921 void Init(Isolate* isolate, AstNodeFactory<Visitor>* factory) { |
| 1906 ASSERT(Token::IsAssignmentOp(op_)); | 1922 ASSERT(Token::IsAssignmentOp(op_)); |
| 1907 if (is_compound()) { | 1923 if (is_compound()) { |
| 1908 binary_operation_ = | 1924 binary_operation_ = |
| 1909 factory->NewBinaryOperation(binary_op(), target_, value_, pos_ + 1); | 1925 factory->NewBinaryOperation(binary_op(), target_, value_, pos_ + 1); |
| 1910 } | 1926 } |
| 1911 } | 1927 } |
| 1912 | 1928 |
| 1913 private: | 1929 private: |
| 1914 Token::Value op_; | 1930 Token::Value op_; |
| 1915 Expression* target_; | 1931 Expression* target_; |
| 1916 Expression* value_; | 1932 Expression* value_; |
| 1917 int pos_; | 1933 int pos_; |
| 1918 BinaryOperation* binary_operation_; | 1934 BinaryOperation* binary_operation_; |
| 1919 const BailoutId assignment_id_; | 1935 const BailoutId assignment_id_; |
| 1920 | 1936 |
| 1921 bool is_monomorphic_; | 1937 bool is_monomorphic_ : 1; |
| 1938 KeyedAccessStoreMode store_mode_ : 4; |
| 1922 SmallMapList receiver_types_; | 1939 SmallMapList receiver_types_; |
| 1923 }; | 1940 }; |
| 1924 | 1941 |
| 1925 | 1942 |
| 1926 class Throw: public Expression { | 1943 class Throw: public Expression { |
| 1927 public: | 1944 public: |
| 1928 DECLARE_NODE_TYPE(Throw) | 1945 DECLARE_NODE_TYPE(Throw) |
| 1929 | 1946 |
| 1930 Expression* exception() const { return exception_; } | 1947 Expression* exception() const { return exception_; } |
| 1931 virtual int position() const { return pos_; } | 1948 virtual int position() const { return pos_; } |
| (...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2935 private: | 2952 private: |
| 2936 Isolate* isolate_; | 2953 Isolate* isolate_; |
| 2937 Zone* zone_; | 2954 Zone* zone_; |
| 2938 Visitor visitor_; | 2955 Visitor visitor_; |
| 2939 }; | 2956 }; |
| 2940 | 2957 |
| 2941 | 2958 |
| 2942 } } // namespace v8::internal | 2959 } } // namespace v8::internal |
| 2943 | 2960 |
| 2944 #endif // V8_AST_H_ | 2961 #endif // V8_AST_H_ |
| OLD | NEW |