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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 } | 1773 } |
1767 | 1774 |
1768 Expression* expression() const { return expression_; } | 1775 Expression* expression() const { return expression_; } |
1769 virtual int position() const { return pos_; } | 1776 virtual int position() const { return pos_; } |
1770 | 1777 |
1771 virtual void MarkAsStatement() { is_prefix_ = true; } | 1778 virtual void MarkAsStatement() { is_prefix_ = true; } |
1772 | 1779 |
1773 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* znoe); | 1780 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* znoe); |
1774 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1781 virtual bool IsMonomorphic() { return is_monomorphic_; } |
1775 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } | 1782 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } |
| 1783 virtual KeyedAccessStoreMode GetStoreMode() { |
| 1784 return store_mode_; |
| 1785 } |
1776 | 1786 |
1777 BailoutId AssignmentId() const { return assignment_id_; } | 1787 BailoutId AssignmentId() const { return assignment_id_; } |
1778 | 1788 |
1779 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } | 1789 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } |
1780 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } | 1790 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } |
1781 | 1791 |
1782 protected: | 1792 protected: |
1783 CountOperation(Isolate* isolate, | 1793 CountOperation(Isolate* isolate, |
1784 Token::Value op, | 1794 Token::Value op, |
1785 bool is_prefix, | 1795 bool is_prefix, |
1786 Expression* expr, | 1796 Expression* expr, |
1787 int pos) | 1797 int pos) |
1788 : Expression(isolate), | 1798 : Expression(isolate), |
1789 op_(op), | 1799 op_(op), |
1790 is_prefix_(is_prefix), | 1800 is_prefix_(is_prefix), |
| 1801 is_monomorphic_(false), |
| 1802 store_mode_(STANDARD_STORE), |
1791 expression_(expr), | 1803 expression_(expr), |
1792 pos_(pos), | 1804 pos_(pos), |
1793 assignment_id_(GetNextId(isolate)), | 1805 assignment_id_(GetNextId(isolate)), |
1794 count_id_(GetNextId(isolate)) {} | 1806 count_id_(GetNextId(isolate)) {} |
1795 | 1807 |
1796 private: | 1808 private: |
1797 Token::Value op_; | 1809 Token::Value op_; |
1798 bool is_prefix_; | 1810 bool is_prefix_ : 1; |
1799 bool is_monomorphic_; | 1811 bool is_monomorphic_ : 1; |
| 1812 KeyedAccessStoreMode store_mode_: 4; |
1800 Expression* expression_; | 1813 Expression* expression_; |
1801 int pos_; | 1814 int pos_; |
1802 const BailoutId assignment_id_; | 1815 const BailoutId assignment_id_; |
1803 const TypeFeedbackId count_id_; | 1816 const TypeFeedbackId count_id_; |
1804 SmallMapList receiver_types_; | 1817 SmallMapList receiver_types_; |
1805 }; | 1818 }; |
1806 | 1819 |
1807 | 1820 |
1808 class CompareOperation: public Expression { | 1821 class CompareOperation: public Expression { |
1809 public: | 1822 public: |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1902 // This check relies on the definition order of token in token.h. | 1915 // This check relies on the definition order of token in token.h. |
1903 bool is_compound() const { return op() > Token::ASSIGN; } | 1916 bool is_compound() const { return op() > Token::ASSIGN; } |
1904 | 1917 |
1905 BailoutId AssignmentId() const { return assignment_id_; } | 1918 BailoutId AssignmentId() const { return assignment_id_; } |
1906 | 1919 |
1907 // Type feedback information. | 1920 // Type feedback information. |
1908 TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); } | 1921 TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); } |
1909 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); | 1922 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); |
1910 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1923 virtual bool IsMonomorphic() { return is_monomorphic_; } |
1911 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } | 1924 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } |
| 1925 virtual KeyedAccessStoreMode GetStoreMode() { |
| 1926 return store_mode_; |
| 1927 } |
1912 | 1928 |
1913 protected: | 1929 protected: |
1914 Assignment(Isolate* isolate, | 1930 Assignment(Isolate* isolate, |
1915 Token::Value op, | 1931 Token::Value op, |
1916 Expression* target, | 1932 Expression* target, |
1917 Expression* value, | 1933 Expression* value, |
1918 int pos); | 1934 int pos); |
1919 | 1935 |
1920 template<class Visitor> | 1936 template<class Visitor> |
1921 void Init(Isolate* isolate, AstNodeFactory<Visitor>* factory) { | 1937 void Init(Isolate* isolate, AstNodeFactory<Visitor>* factory) { |
1922 ASSERT(Token::IsAssignmentOp(op_)); | 1938 ASSERT(Token::IsAssignmentOp(op_)); |
1923 if (is_compound()) { | 1939 if (is_compound()) { |
1924 binary_operation_ = | 1940 binary_operation_ = |
1925 factory->NewBinaryOperation(binary_op(), target_, value_, pos_ + 1); | 1941 factory->NewBinaryOperation(binary_op(), target_, value_, pos_ + 1); |
1926 } | 1942 } |
1927 } | 1943 } |
1928 | 1944 |
1929 private: | 1945 private: |
1930 Token::Value op_; | 1946 Token::Value op_; |
1931 Expression* target_; | 1947 Expression* target_; |
1932 Expression* value_; | 1948 Expression* value_; |
1933 int pos_; | 1949 int pos_; |
1934 BinaryOperation* binary_operation_; | 1950 BinaryOperation* binary_operation_; |
1935 const BailoutId assignment_id_; | 1951 const BailoutId assignment_id_; |
1936 | 1952 |
1937 bool is_monomorphic_; | 1953 bool is_monomorphic_ : 1; |
| 1954 KeyedAccessStoreMode store_mode_ : 4; |
1938 SmallMapList receiver_types_; | 1955 SmallMapList receiver_types_; |
1939 }; | 1956 }; |
1940 | 1957 |
1941 | 1958 |
1942 class Throw: public Expression { | 1959 class Throw: public Expression { |
1943 public: | 1960 public: |
1944 DECLARE_NODE_TYPE(Throw) | 1961 DECLARE_NODE_TYPE(Throw) |
1945 | 1962 |
1946 Expression* exception() const { return exception_; } | 1963 Expression* exception() const { return exception_; } |
1947 virtual int position() const { return pos_; } | 1964 virtual int position() const { return pos_; } |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2951 private: | 2968 private: |
2952 Isolate* isolate_; | 2969 Isolate* isolate_; |
2953 Zone* zone_; | 2970 Zone* zone_; |
2954 Visitor visitor_; | 2971 Visitor visitor_; |
2955 }; | 2972 }; |
2956 | 2973 |
2957 | 2974 |
2958 } } // namespace v8::internal | 2975 } } // namespace v8::internal |
2959 | 2976 |
2960 #endif // V8_AST_H_ | 2977 #endif // V8_AST_H_ |
OLD | NEW |