Chromium Code Reviews| 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 "v8.h" | 8 #include "v8.h" |
| 9 | 9 |
| 10 #include "assembler.h" | 10 #include "assembler.h" |
| (...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1723 const BailoutId load_id_; | 1723 const BailoutId load_id_; |
| 1724 | 1724 |
| 1725 SmallMapList receiver_types_; | 1725 SmallMapList receiver_types_; |
| 1726 bool is_for_call_ : 1; | 1726 bool is_for_call_ : 1; |
| 1727 bool is_uninitialized_ : 1; | 1727 bool is_uninitialized_ : 1; |
| 1728 bool is_string_access_ : 1; | 1728 bool is_string_access_ : 1; |
| 1729 bool is_function_prototype_ : 1; | 1729 bool is_function_prototype_ : 1; |
| 1730 }; | 1730 }; |
| 1731 | 1731 |
| 1732 | 1732 |
| 1733 class AllocationSiteInfo: public ZoneObject { | |
|
danno
2014/05/16 16:34:11
CallInfo? Don't wrap this puppy until we actually
mvstanton
2014/05/19 13:45:24
Sounds good.
| |
| 1734 public: | |
| 1735 explicit AllocationSiteInfo(Handle<AllocationSite> allocation_site) | |
| 1736 : allocation_site_(allocation_site) {} | |
| 1737 | |
| 1738 ElementsKind elements_kind() const { | |
| 1739 return allocation_site_->GetElementsKind(); | |
| 1740 } | |
| 1741 Handle<AllocationSite> allocation_site() const { | |
| 1742 return allocation_site_; | |
| 1743 } | |
| 1744 | |
| 1745 private: | |
| 1746 Handle<AllocationSite> allocation_site_; | |
| 1747 }; | |
| 1748 | |
| 1749 | |
| 1733 class Call V8_FINAL : public Expression, public FeedbackSlotInterface { | 1750 class Call V8_FINAL : public Expression, public FeedbackSlotInterface { |
| 1734 public: | 1751 public: |
| 1735 DECLARE_NODE_TYPE(Call) | 1752 DECLARE_NODE_TYPE(Call) |
| 1736 | 1753 |
| 1737 Expression* expression() const { return expression_; } | 1754 Expression* expression() const { return expression_; } |
| 1738 ZoneList<Expression*>* arguments() const { return arguments_; } | 1755 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1739 | 1756 |
| 1740 // Type feedback information. | 1757 // Type feedback information. |
| 1741 virtual int ComputeFeedbackSlotCount() { return 1; } | 1758 virtual int ComputeFeedbackSlotCount() { return 1; } |
| 1742 virtual void SetFirstFeedbackSlot(int slot) { | 1759 virtual void SetFirstFeedbackSlot(int slot) { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1755 return NULL; | 1772 return NULL; |
| 1756 } | 1773 } |
| 1757 | 1774 |
| 1758 virtual bool IsMonomorphic() V8_OVERRIDE { | 1775 virtual bool IsMonomorphic() V8_OVERRIDE { |
| 1759 if (expression()->IsProperty()) { | 1776 if (expression()->IsProperty()) { |
| 1760 return expression()->AsProperty()->IsMonomorphic(); | 1777 return expression()->AsProperty()->IsMonomorphic(); |
| 1761 } | 1778 } |
| 1762 return !target_.is_null(); | 1779 return !target_.is_null(); |
| 1763 } | 1780 } |
| 1764 | 1781 |
| 1782 bool global_call() const { | |
| 1783 VariableProxy* proxy = expression_->AsVariableProxy(); | |
| 1784 return proxy != NULL && proxy->var()->IsUnallocated(); | |
| 1785 } | |
| 1786 | |
| 1787 bool known_global_function() const { | |
| 1788 return global_call() && !target_.is_null(); | |
| 1789 } | |
| 1790 | |
| 1765 Handle<JSFunction> target() { return target_; } | 1791 Handle<JSFunction> target() { return target_; } |
| 1766 | 1792 |
| 1767 Handle<Cell> cell() { return cell_; } | 1793 Handle<Cell> cell() { return cell_; } |
| 1768 | 1794 |
| 1769 void set_target(Handle<JSFunction> target) { target_ = target; } | 1795 void set_target(Handle<JSFunction> target) { target_ = target; } |
| 1796 void set_extra_info(Zone* zone, Handle<AllocationSite> site); | |
| 1770 bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupResult* lookup); | 1797 bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupResult* lookup); |
| 1771 | 1798 |
| 1772 BailoutId ReturnId() const { return return_id_; } | 1799 BailoutId ReturnId() const { return return_id_; } |
| 1773 | 1800 |
| 1801 ZoneObject* extra_info() { return extra_info_; } | |
| 1802 | |
| 1774 enum CallType { | 1803 enum CallType { |
| 1775 POSSIBLY_EVAL_CALL, | 1804 POSSIBLY_EVAL_CALL, |
| 1776 GLOBAL_CALL, | 1805 GLOBAL_CALL, |
| 1777 LOOKUP_SLOT_CALL, | 1806 LOOKUP_SLOT_CALL, |
| 1778 PROPERTY_CALL, | 1807 PROPERTY_CALL, |
| 1779 OTHER_CALL | 1808 OTHER_CALL |
| 1780 }; | 1809 }; |
| 1781 | 1810 |
| 1782 // Helpers to determine how to handle the call. | 1811 // Helpers to determine how to handle the call. |
| 1783 CallType GetCallType(Isolate* isolate) const; | 1812 CallType GetCallType(Isolate* isolate) const; |
| 1784 bool IsUsingCallFeedbackSlot(Isolate* isolate) const; | 1813 bool IsUsingCallFeedbackSlot(Isolate* isolate) const; |
| 1785 | 1814 |
| 1786 #ifdef DEBUG | 1815 #ifdef DEBUG |
| 1787 // Used to assert that the FullCodeGenerator records the return site. | 1816 // Used to assert that the FullCodeGenerator records the return site. |
| 1788 bool return_is_recorded_; | 1817 bool return_is_recorded_; |
| 1789 #endif | 1818 #endif |
| 1790 | 1819 |
| 1791 protected: | 1820 protected: |
| 1792 Call(Zone* zone, | 1821 Call(Zone* zone, |
| 1793 Expression* expression, | 1822 Expression* expression, |
| 1794 ZoneList<Expression*>* arguments, | 1823 ZoneList<Expression*>* arguments, |
| 1795 int pos) | 1824 int pos) |
| 1796 : Expression(zone, pos), | 1825 : Expression(zone, pos), |
| 1797 expression_(expression), | 1826 expression_(expression), |
| 1798 arguments_(arguments), | 1827 arguments_(arguments), |
| 1828 extra_info_(NULL), | |
| 1799 call_feedback_slot_(kInvalidFeedbackSlot), | 1829 call_feedback_slot_(kInvalidFeedbackSlot), |
| 1800 return_id_(GetNextId(zone)) { | 1830 return_id_(GetNextId(zone)) { |
| 1801 if (expression->IsProperty()) { | 1831 if (expression->IsProperty()) { |
| 1802 expression->AsProperty()->mark_for_call(); | 1832 expression->AsProperty()->mark_for_call(); |
| 1803 } | 1833 } |
| 1804 } | 1834 } |
| 1805 | 1835 |
| 1806 private: | 1836 private: |
| 1807 Expression* expression_; | 1837 Expression* expression_; |
| 1808 ZoneList<Expression*>* arguments_; | 1838 ZoneList<Expression*>* arguments_; |
| 1809 | 1839 |
| 1810 Handle<JSFunction> target_; | 1840 Handle<JSFunction> target_; |
| 1811 Handle<Cell> cell_; | 1841 Handle<Cell> cell_; |
| 1842 ZoneObject* extra_info_; | |
| 1812 int call_feedback_slot_; | 1843 int call_feedback_slot_; |
| 1813 | 1844 |
| 1814 const BailoutId return_id_; | 1845 const BailoutId return_id_; |
| 1815 }; | 1846 }; |
| 1816 | 1847 |
| 1817 | 1848 |
| 1818 class CallNew V8_FINAL : public Expression, public FeedbackSlotInterface { | 1849 class CallNew V8_FINAL : public Expression, public FeedbackSlotInterface { |
| 1819 public: | 1850 public: |
| 1820 DECLARE_NODE_TYPE(CallNew) | 1851 DECLARE_NODE_TYPE(CallNew) |
| 1821 | 1852 |
| (...skipping 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3333 | 3364 |
| 3334 private: | 3365 private: |
| 3335 Zone* zone_; | 3366 Zone* zone_; |
| 3336 Visitor visitor_; | 3367 Visitor visitor_; |
| 3337 }; | 3368 }; |
| 3338 | 3369 |
| 3339 | 3370 |
| 3340 } } // namespace v8::internal | 3371 } } // namespace v8::internal |
| 3341 | 3372 |
| 3342 #endif // V8_AST_H_ | 3373 #endif // V8_AST_H_ |
| OLD | NEW |