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 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1770 public: | 1770 public: |
1771 DECLARE_NODE_TYPE(CompareOperation) | 1771 DECLARE_NODE_TYPE(CompareOperation) |
1772 | 1772 |
1773 Token::Value op() const { return op_; } | 1773 Token::Value op() const { return op_; } |
1774 Expression* left() const { return left_; } | 1774 Expression* left() const { return left_; } |
1775 Expression* right() const { return right_; } | 1775 Expression* right() const { return right_; } |
1776 virtual int position() const { return pos_; } | 1776 virtual int position() const { return pos_; } |
1777 | 1777 |
1778 // Type feedback information. | 1778 // Type feedback information. |
1779 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); } | 1779 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); } |
1780 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | |
1781 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } | |
1782 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; } | |
1783 | 1780 |
1784 // Match special cases. | 1781 // Match special cases. |
1785 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); | 1782 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); |
1786 bool IsLiteralCompareUndefined(Expression** expr); | 1783 bool IsLiteralCompareUndefined(Expression** expr); |
1787 bool IsLiteralCompareNull(Expression** expr); | 1784 bool IsLiteralCompareNull(Expression** expr); |
1788 | 1785 |
1789 protected: | 1786 protected: |
1790 CompareOperation(Isolate* isolate, | 1787 CompareOperation(Isolate* isolate, |
1791 Token::Value op, | 1788 Token::Value op, |
1792 Expression* left, | 1789 Expression* left, |
1793 Expression* right, | 1790 Expression* right, |
1794 int pos) | 1791 int pos) |
1795 : Expression(isolate), | 1792 : Expression(isolate), |
1796 op_(op), | 1793 op_(op), |
1797 left_(left), | 1794 left_(left), |
1798 right_(right), | 1795 right_(right), |
1799 pos_(pos), | 1796 pos_(pos) { |
1800 compare_type_(NONE) { | |
1801 ASSERT(Token::IsCompareOp(op)); | 1797 ASSERT(Token::IsCompareOp(op)); |
1802 } | 1798 } |
1803 | 1799 |
1804 private: | 1800 private: |
1805 Token::Value op_; | 1801 Token::Value op_; |
1806 Expression* left_; | 1802 Expression* left_; |
1807 Expression* right_; | 1803 Expression* right_; |
1808 int pos_; | 1804 int pos_; |
1809 | |
1810 enum CompareTypeFeedback { NONE, SMI_ONLY, OBJECT_ONLY }; | |
1811 CompareTypeFeedback compare_type_; | |
1812 }; | 1805 }; |
1813 | 1806 |
1814 | 1807 |
1815 class Conditional: public Expression { | 1808 class Conditional: public Expression { |
1816 public: | 1809 public: |
1817 DECLARE_NODE_TYPE(Conditional) | 1810 DECLARE_NODE_TYPE(Conditional) |
1818 | 1811 |
1819 Expression* condition() const { return condition_; } | 1812 Expression* condition() const { return condition_; } |
1820 Expression* then_expression() const { return then_expression_; } | 1813 Expression* then_expression() const { return then_expression_; } |
1821 Expression* else_expression() const { return else_expression_; } | 1814 Expression* else_expression() const { return else_expression_; } |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2903 private: | 2896 private: |
2904 Isolate* isolate_; | 2897 Isolate* isolate_; |
2905 Zone* zone_; | 2898 Zone* zone_; |
2906 Visitor visitor_; | 2899 Visitor visitor_; |
2907 }; | 2900 }; |
2908 | 2901 |
2909 | 2902 |
2910 } } // namespace v8::internal | 2903 } } // namespace v8::internal |
2911 | 2904 |
2912 #endif // V8_AST_H_ | 2905 #endif // V8_AST_H_ |
OLD | NEW |