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 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1830 | 1830 |
1831 Token::Value op() const { return op_; } | 1831 Token::Value op() const { return op_; } |
1832 Expression* expression() const { return expression_; } | 1832 Expression* expression() const { return expression_; } |
1833 virtual int position() const { return pos_; } | 1833 virtual int position() const { return pos_; } |
1834 | 1834 |
1835 BailoutId MaterializeTrueId() { return materialize_true_id_; } | 1835 BailoutId MaterializeTrueId() { return materialize_true_id_; } |
1836 BailoutId MaterializeFalseId() { return materialize_false_id_; } | 1836 BailoutId MaterializeFalseId() { return materialize_false_id_; } |
1837 | 1837 |
1838 TypeFeedbackId UnaryOperationFeedbackId() const { return reuse(id()); } | 1838 TypeFeedbackId UnaryOperationFeedbackId() const { return reuse(id()); } |
1839 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1839 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
1840 TypeInfo type() const { return type_; } | 1840 Handle<Type> type() const { return type_; } |
1841 | 1841 |
1842 protected: | 1842 protected: |
1843 UnaryOperation(Isolate* isolate, | 1843 UnaryOperation(Isolate* isolate, |
1844 Token::Value op, | 1844 Token::Value op, |
1845 Expression* expression, | 1845 Expression* expression, |
1846 int pos) | 1846 int pos) |
1847 : Expression(isolate), | 1847 : Expression(isolate), |
1848 op_(op), | 1848 op_(op), |
1849 expression_(expression), | 1849 expression_(expression), |
1850 pos_(pos), | 1850 pos_(pos), |
1851 materialize_true_id_(GetNextId(isolate)), | 1851 materialize_true_id_(GetNextId(isolate)), |
1852 materialize_false_id_(GetNextId(isolate)) { | 1852 materialize_false_id_(GetNextId(isolate)) { |
1853 ASSERT(Token::IsUnaryOp(op)); | 1853 ASSERT(Token::IsUnaryOp(op)); |
1854 } | 1854 } |
1855 | 1855 |
1856 private: | 1856 private: |
1857 Token::Value op_; | 1857 Token::Value op_; |
1858 Expression* expression_; | 1858 Expression* expression_; |
1859 int pos_; | 1859 int pos_; |
1860 | 1860 |
1861 TypeInfo type_; | 1861 Handle<Type> type_; |
1862 | 1862 |
1863 // For unary not (Token::NOT), the AST ids where true and false will | 1863 // For unary not (Token::NOT), the AST ids where true and false will |
1864 // actually be materialized, respectively. | 1864 // actually be materialized, respectively. |
1865 const BailoutId materialize_true_id_; | 1865 const BailoutId materialize_true_id_; |
1866 const BailoutId materialize_false_id_; | 1866 const BailoutId materialize_false_id_; |
1867 }; | 1867 }; |
1868 | 1868 |
1869 | 1869 |
1870 class BinaryOperation: public Expression { | 1870 class BinaryOperation: public Expression { |
1871 public: | 1871 public: |
1872 DECLARE_NODE_TYPE(BinaryOperation) | 1872 DECLARE_NODE_TYPE(BinaryOperation) |
1873 | 1873 |
1874 virtual bool ResultOverwriteAllowed(); | 1874 virtual bool ResultOverwriteAllowed(); |
1875 | 1875 |
1876 Token::Value op() const { return op_; } | 1876 Token::Value op() const { return op_; } |
1877 Expression* left() const { return left_; } | 1877 Expression* left() const { return left_; } |
1878 Expression* right() const { return right_; } | 1878 Expression* right() const { return right_; } |
1879 virtual int position() const { return pos_; } | 1879 virtual int position() const { return pos_; } |
1880 | 1880 |
1881 BailoutId RightId() const { return right_id_; } | 1881 BailoutId RightId() const { return right_id_; } |
1882 | 1882 |
1883 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); } | 1883 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); } |
1884 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1884 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
1885 TypeInfo left_type() const { return left_type_; } | 1885 Handle<Type> left_type() const { return left_type_; } |
1886 TypeInfo right_type() const { return right_type_; } | 1886 Handle<Type> right_type() const { return right_type_; } |
1887 TypeInfo result_type() const { return result_type_; } | 1887 Handle<Type> result_type() const { return result_type_; } |
1888 bool has_fixed_right_arg() const { return has_fixed_right_arg_; } | 1888 bool has_fixed_right_arg() const { return has_fixed_right_arg_; } |
1889 int fixed_right_arg_value() const { return fixed_right_arg_value_; } | 1889 int fixed_right_arg_value() const { return fixed_right_arg_value_; } |
1890 | 1890 |
1891 protected: | 1891 protected: |
1892 BinaryOperation(Isolate* isolate, | 1892 BinaryOperation(Isolate* isolate, |
1893 Token::Value op, | 1893 Token::Value op, |
1894 Expression* left, | 1894 Expression* left, |
1895 Expression* right, | 1895 Expression* right, |
1896 int pos) | 1896 int pos) |
1897 : Expression(isolate), | 1897 : Expression(isolate), |
1898 op_(op), | 1898 op_(op), |
1899 left_(left), | 1899 left_(left), |
1900 right_(right), | 1900 right_(right), |
1901 pos_(pos), | 1901 pos_(pos), |
1902 right_id_(GetNextId(isolate)) { | 1902 right_id_(GetNextId(isolate)) { |
1903 ASSERT(Token::IsBinaryOp(op)); | 1903 ASSERT(Token::IsBinaryOp(op)); |
1904 } | 1904 } |
1905 | 1905 |
1906 private: | 1906 private: |
1907 Token::Value op_; | 1907 Token::Value op_; |
1908 Expression* left_; | 1908 Expression* left_; |
1909 Expression* right_; | 1909 Expression* right_; |
1910 int pos_; | 1910 int pos_; |
1911 | 1911 |
1912 TypeInfo left_type_; | 1912 Handle<Type> left_type_; |
1913 TypeInfo right_type_; | 1913 Handle<Type> right_type_; |
1914 TypeInfo result_type_; | 1914 Handle<Type> result_type_; |
1915 bool has_fixed_right_arg_; | 1915 bool has_fixed_right_arg_; |
1916 int fixed_right_arg_value_; | 1916 int fixed_right_arg_value_; |
1917 | 1917 |
1918 // The short-circuit logical operations need an AST ID for their | 1918 // The short-circuit logical operations need an AST ID for their |
1919 // right-hand subexpression. | 1919 // right-hand subexpression. |
1920 const BailoutId right_id_; | 1920 const BailoutId right_id_; |
1921 }; | 1921 }; |
1922 | 1922 |
1923 | 1923 |
1924 class CountOperation: public Expression { | 1924 class CountOperation: public Expression { |
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3218 private: | 3218 private: |
3219 Isolate* isolate_; | 3219 Isolate* isolate_; |
3220 Zone* zone_; | 3220 Zone* zone_; |
3221 Visitor visitor_; | 3221 Visitor visitor_; |
3222 }; | 3222 }; |
3223 | 3223 |
3224 | 3224 |
3225 } } // namespace v8::internal | 3225 } } // namespace v8::internal |
3226 | 3226 |
3227 #endif // V8_AST_H_ | 3227 #endif // V8_AST_H_ |
OLD | NEW |