| 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 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1789 | 1789 |
| 1790 Handle<AllocationSite> allocation_site() { return allocation_site_; } | 1790 Handle<AllocationSite> allocation_site() { return allocation_site_; } |
| 1791 | 1791 |
| 1792 void set_target(Handle<JSFunction> target) { target_ = target; } | 1792 void set_target(Handle<JSFunction> target) { target_ = target; } |
| 1793 void set_allocation_site(Handle<AllocationSite> site) { | 1793 void set_allocation_site(Handle<AllocationSite> site) { |
| 1794 allocation_site_ = site; | 1794 allocation_site_ = site; |
| 1795 } | 1795 } |
| 1796 bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupIterator* it); | 1796 bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupIterator* it); |
| 1797 | 1797 |
| 1798 BailoutId ReturnId() const { return return_id_; } | 1798 BailoutId ReturnId() const { return return_id_; } |
| 1799 BailoutId EvalOrLookupId() const { return eval_or_lookup_id_; } |
| 1799 | 1800 |
| 1800 enum CallType { | 1801 enum CallType { |
| 1801 POSSIBLY_EVAL_CALL, | 1802 POSSIBLY_EVAL_CALL, |
| 1802 GLOBAL_CALL, | 1803 GLOBAL_CALL, |
| 1803 LOOKUP_SLOT_CALL, | 1804 LOOKUP_SLOT_CALL, |
| 1804 PROPERTY_CALL, | 1805 PROPERTY_CALL, |
| 1805 OTHER_CALL | 1806 OTHER_CALL |
| 1806 }; | 1807 }; |
| 1807 | 1808 |
| 1808 // Helpers to determine how to handle the call. | 1809 // Helpers to determine how to handle the call. |
| 1809 CallType GetCallType(Isolate* isolate) const; | 1810 CallType GetCallType(Isolate* isolate) const; |
| 1810 bool IsUsingCallFeedbackSlot(Isolate* isolate) const; | 1811 bool IsUsingCallFeedbackSlot(Isolate* isolate) const; |
| 1811 | 1812 |
| 1812 #ifdef DEBUG | 1813 #ifdef DEBUG |
| 1813 // Used to assert that the FullCodeGenerator records the return site. | 1814 // Used to assert that the FullCodeGenerator records the return site. |
| 1814 bool return_is_recorded_; | 1815 bool return_is_recorded_; |
| 1815 #endif | 1816 #endif |
| 1816 | 1817 |
| 1817 protected: | 1818 protected: |
| 1818 Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, | 1819 Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, |
| 1819 int pos, IdGen* id_gen) | 1820 int pos, IdGen* id_gen) |
| 1820 : Expression(zone, pos, id_gen), | 1821 : Expression(zone, pos, id_gen), |
| 1821 expression_(expression), | 1822 expression_(expression), |
| 1822 arguments_(arguments), | 1823 arguments_(arguments), |
| 1823 call_feedback_slot_(kInvalidFeedbackSlot), | 1824 call_feedback_slot_(kInvalidFeedbackSlot), |
| 1824 return_id_(id_gen->GetNextId()) { | 1825 return_id_(id_gen->GetNextId()), |
| 1826 eval_or_lookup_id_(id_gen->GetNextId()) { |
| 1825 if (expression->IsProperty()) { | 1827 if (expression->IsProperty()) { |
| 1826 expression->AsProperty()->mark_for_call(); | 1828 expression->AsProperty()->mark_for_call(); |
| 1827 } | 1829 } |
| 1828 } | 1830 } |
| 1829 | 1831 |
| 1830 private: | 1832 private: |
| 1831 Expression* expression_; | 1833 Expression* expression_; |
| 1832 ZoneList<Expression*>* arguments_; | 1834 ZoneList<Expression*>* arguments_; |
| 1833 | 1835 |
| 1834 Handle<JSFunction> target_; | 1836 Handle<JSFunction> target_; |
| 1835 Handle<Cell> cell_; | 1837 Handle<Cell> cell_; |
| 1836 Handle<AllocationSite> allocation_site_; | 1838 Handle<AllocationSite> allocation_site_; |
| 1837 int call_feedback_slot_; | 1839 int call_feedback_slot_; |
| 1838 | 1840 |
| 1839 const BailoutId return_id_; | 1841 const BailoutId return_id_; |
| 1842 // TODO(jarin) Only allocate the bailout id for the POSSIBLY_EVAL_CALL and |
| 1843 // LOOKUP_SLOT_CALL types. |
| 1844 const BailoutId eval_or_lookup_id_; |
| 1840 }; | 1845 }; |
| 1841 | 1846 |
| 1842 | 1847 |
| 1843 class CallNew FINAL : public Expression, public FeedbackSlotInterface { | 1848 class CallNew FINAL : public Expression, public FeedbackSlotInterface { |
| 1844 public: | 1849 public: |
| 1845 DECLARE_NODE_TYPE(CallNew) | 1850 DECLARE_NODE_TYPE(CallNew) |
| 1846 | 1851 |
| 1847 Expression* expression() const { return expression_; } | 1852 Expression* expression() const { return expression_; } |
| 1848 ZoneList<Expression*>* arguments() const { return arguments_; } | 1853 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1849 | 1854 |
| (...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3531 Zone* zone_; | 3536 Zone* zone_; |
| 3532 Visitor visitor_; | 3537 Visitor visitor_; |
| 3533 AstValueFactory* ast_value_factory_; | 3538 AstValueFactory* ast_value_factory_; |
| 3534 AstNode::IdGen* id_gen_; | 3539 AstNode::IdGen* id_gen_; |
| 3535 }; | 3540 }; |
| 3536 | 3541 |
| 3537 | 3542 |
| 3538 } } // namespace v8::internal | 3543 } } // namespace v8::internal |
| 3539 | 3544 |
| 3540 #endif // V8_AST_H_ | 3545 #endif // V8_AST_H_ |
| OLD | NEW |