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 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1806 public: | 1806 public: |
1807 DECLARE_NODE_TYPE(Call) | 1807 DECLARE_NODE_TYPE(Call) |
1808 | 1808 |
1809 Expression* expression() const { return expression_; } | 1809 Expression* expression() const { return expression_; } |
1810 ZoneList<Expression*>* arguments() const { return arguments_; } | 1810 ZoneList<Expression*>* arguments() const { return arguments_; } |
1811 | 1811 |
1812 // Type feedback information. | 1812 // Type feedback information. |
1813 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( | 1813 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( |
1814 Isolate* isolate) OVERRIDE; | 1814 Isolate* isolate) OVERRIDE; |
1815 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { | 1815 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { |
1816 call_feedback_slot_ = slot; | 1816 ic_slot_or_slot_ = slot.ToInt(); |
| 1817 } |
| 1818 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE { |
| 1819 ic_slot_or_slot_ = slot.ToInt(); |
1817 } | 1820 } |
1818 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::CALL_IC; } | 1821 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::CALL_IC; } |
1819 | 1822 |
1820 bool HasCallFeedbackSlot() const { return !call_feedback_slot_.IsInvalid(); } | 1823 FeedbackVectorSlot CallFeedbackSlot() const { |
1821 FeedbackVectorICSlot CallFeedbackSlot() const { | 1824 DCHECK(ic_slot_or_slot_ != FeedbackVectorSlot::Invalid().ToInt()); |
1822 DCHECK(!call_feedback_slot_.IsInvalid()); | 1825 return FeedbackVectorSlot(ic_slot_or_slot_); |
1823 return call_feedback_slot_; | 1826 } |
| 1827 |
| 1828 FeedbackVectorICSlot CallFeedbackICSlot() const { |
| 1829 DCHECK(ic_slot_or_slot_ != FeedbackVectorICSlot::Invalid().ToInt()); |
| 1830 return FeedbackVectorICSlot(ic_slot_or_slot_); |
1824 } | 1831 } |
1825 | 1832 |
1826 SmallMapList* GetReceiverTypes() OVERRIDE { | 1833 SmallMapList* GetReceiverTypes() OVERRIDE { |
1827 if (expression()->IsProperty()) { | 1834 if (expression()->IsProperty()) { |
1828 return expression()->AsProperty()->GetReceiverTypes(); | 1835 return expression()->AsProperty()->GetReceiverTypes(); |
1829 } | 1836 } |
1830 return NULL; | 1837 return NULL; |
1831 } | 1838 } |
1832 | 1839 |
1833 bool IsMonomorphic() OVERRIDE { | 1840 bool IsMonomorphic() OVERRIDE { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 GLOBAL_CALL, | 1881 GLOBAL_CALL, |
1875 LOOKUP_SLOT_CALL, | 1882 LOOKUP_SLOT_CALL, |
1876 PROPERTY_CALL, | 1883 PROPERTY_CALL, |
1877 SUPER_CALL, | 1884 SUPER_CALL, |
1878 OTHER_CALL | 1885 OTHER_CALL |
1879 }; | 1886 }; |
1880 | 1887 |
1881 // Helpers to determine how to handle the call. | 1888 // Helpers to determine how to handle the call. |
1882 CallType GetCallType(Isolate* isolate) const; | 1889 CallType GetCallType(Isolate* isolate) const; |
1883 bool IsUsingCallFeedbackSlot(Isolate* isolate) const; | 1890 bool IsUsingCallFeedbackSlot(Isolate* isolate) const; |
| 1891 bool IsUsingCallFeedbackICSlot(Isolate* isolate) const; |
1884 | 1892 |
1885 #ifdef DEBUG | 1893 #ifdef DEBUG |
1886 // Used to assert that the FullCodeGenerator records the return site. | 1894 // Used to assert that the FullCodeGenerator records the return site. |
1887 bool return_is_recorded_; | 1895 bool return_is_recorded_; |
1888 #endif | 1896 #endif |
1889 | 1897 |
1890 protected: | 1898 protected: |
1891 Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, | 1899 Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, |
1892 int pos) | 1900 int pos) |
1893 : Expression(zone, pos), | 1901 : Expression(zone, pos), |
1894 call_feedback_slot_(FeedbackVectorICSlot::Invalid()), | 1902 ic_slot_or_slot_(FeedbackVectorICSlot::Invalid().ToInt()), |
1895 expression_(expression), | 1903 expression_(expression), |
1896 arguments_(arguments), | 1904 arguments_(arguments), |
1897 bit_field_(IsUninitializedField::encode(false)) { | 1905 bit_field_(IsUninitializedField::encode(false)) { |
1898 if (expression->IsProperty()) { | 1906 if (expression->IsProperty()) { |
1899 expression->AsProperty()->mark_for_call(); | 1907 expression->AsProperty()->mark_for_call(); |
1900 } | 1908 } |
1901 } | 1909 } |
1902 static int parent_num_ids() { return Expression::num_ids(); } | 1910 static int parent_num_ids() { return Expression::num_ids(); } |
1903 | 1911 |
1904 private: | 1912 private: |
1905 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 1913 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
1906 | 1914 |
1907 FeedbackVectorICSlot call_feedback_slot_; | 1915 // We store this as an integer because we don't know if we have a slot or |
| 1916 // an ic slot until scoping time. |
| 1917 int ic_slot_or_slot_; |
1908 Expression* expression_; | 1918 Expression* expression_; |
1909 ZoneList<Expression*>* arguments_; | 1919 ZoneList<Expression*>* arguments_; |
1910 Handle<JSFunction> target_; | 1920 Handle<JSFunction> target_; |
1911 Handle<Cell> cell_; | 1921 Handle<Cell> cell_; |
1912 Handle<AllocationSite> allocation_site_; | 1922 Handle<AllocationSite> allocation_site_; |
1913 class IsUninitializedField : public BitField8<bool, 0, 1> {}; | 1923 class IsUninitializedField : public BitField8<bool, 0, 1> {}; |
1914 uint8_t bit_field_; | 1924 uint8_t bit_field_; |
1915 }; | 1925 }; |
1916 | 1926 |
1917 | 1927 |
(...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3548 | 3558 |
3549 private: | 3559 private: |
3550 Zone* zone_; | 3560 Zone* zone_; |
3551 AstValueFactory* ast_value_factory_; | 3561 AstValueFactory* ast_value_factory_; |
3552 }; | 3562 }; |
3553 | 3563 |
3554 | 3564 |
3555 } } // namespace v8::internal | 3565 } } // namespace v8::internal |
3556 | 3566 |
3557 #endif // V8_AST_H_ | 3567 #endif // V8_AST_H_ |
OLD | NEW |