| 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 14 matching lines...) Expand all Loading... |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_AST_H_ | 28 #ifndef V8_AST_H_ |
| 29 #define V8_AST_H_ | 29 #define V8_AST_H_ |
| 30 | 30 |
| 31 #include "v8.h" | 31 #include "v8.h" |
| 32 | 32 |
| 33 #include "assembler.h" | 33 #include "assembler.h" |
| 34 #include "factory.h" | 34 #include "factory.h" |
| 35 #include "feedback-slots.h" | |
| 36 #include "isolate.h" | 35 #include "isolate.h" |
| 37 #include "jsregexp.h" | 36 #include "jsregexp.h" |
| 38 #include "list-inl.h" | 37 #include "list-inl.h" |
| 39 #include "runtime.h" | 38 #include "runtime.h" |
| 40 #include "small-pointer-list.h" | 39 #include "small-pointer-list.h" |
| 41 #include "smart-pointers.h" | 40 #include "smart-pointers.h" |
| 42 #include "token.h" | 41 #include "token.h" |
| 43 #include "types.h" | 42 #include "types.h" |
| 44 #include "utils.h" | 43 #include "utils.h" |
| 45 #include "variables.h" | 44 #include "variables.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 kDontSelfOptimize, | 174 kDontSelfOptimize, |
| 176 kDontSoftInline, | 175 kDontSoftInline, |
| 177 kDontCache | 176 kDontCache |
| 178 }; | 177 }; |
| 179 | 178 |
| 180 | 179 |
| 181 class AstProperties V8_FINAL BASE_EMBEDDED { | 180 class AstProperties V8_FINAL BASE_EMBEDDED { |
| 182 public: | 181 public: |
| 183 class Flags : public EnumSet<AstPropertiesFlag, int> {}; | 182 class Flags : public EnumSet<AstPropertiesFlag, int> {}; |
| 184 | 183 |
| 185 AstProperties() : node_count_(0) {} | 184 AstProperties() : node_count_(0) { } |
| 186 | 185 |
| 187 Flags* flags() { return &flags_; } | 186 Flags* flags() { return &flags_; } |
| 188 int node_count() { return node_count_; } | 187 int node_count() { return node_count_; } |
| 189 void add_node_count(int count) { node_count_ += count; } | 188 void add_node_count(int count) { node_count_ += count; } |
| 190 | 189 |
| 191 private: | 190 private: |
| 192 Flags flags_; | 191 Flags flags_; |
| 193 int node_count_; | 192 int node_count_; |
| 194 }; | 193 }; |
| 195 | 194 |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 each_(NULL), | 907 each_(NULL), |
| 909 subject_(NULL) { | 908 subject_(NULL) { |
| 910 } | 909 } |
| 911 | 910 |
| 912 private: | 911 private: |
| 913 Expression* each_; | 912 Expression* each_; |
| 914 Expression* subject_; | 913 Expression* subject_; |
| 915 }; | 914 }; |
| 916 | 915 |
| 917 | 916 |
| 918 class ForInStatement V8_FINAL : public ForEachStatement, | 917 class ForInStatement V8_FINAL : public ForEachStatement { |
| 919 public FeedbackSlotInterface { | |
| 920 public: | 918 public: |
| 921 DECLARE_NODE_TYPE(ForInStatement) | 919 DECLARE_NODE_TYPE(ForInStatement) |
| 922 | 920 |
| 923 Expression* enumerable() const { | 921 Expression* enumerable() const { |
| 924 return subject(); | 922 return subject(); |
| 925 } | 923 } |
| 926 | 924 |
| 927 // Type feedback information. | 925 TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); } |
| 928 virtual ComputablePhase GetComputablePhase() { return DURING_PARSE; } | |
| 929 virtual int ComputeFeedbackSlotCount(Isolate* isolate) { return 1; } | |
| 930 virtual void SetFirstFeedbackSlot(int slot) { for_in_feedback_slot_ = slot; } | |
| 931 | |
| 932 int ForInFeedbackSlot() { | |
| 933 ASSERT(for_in_feedback_slot_ != kInvalidFeedbackSlot); | |
| 934 return for_in_feedback_slot_; | |
| 935 } | |
| 936 | |
| 937 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; | 926 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; |
| 938 ForInType for_in_type() const { return for_in_type_; } | 927 ForInType for_in_type() const { return for_in_type_; } |
| 939 void set_for_in_type(ForInType type) { for_in_type_ = type; } | 928 void set_for_in_type(ForInType type) { for_in_type_ = type; } |
| 940 | 929 |
| 941 BailoutId BodyId() const { return body_id_; } | 930 BailoutId BodyId() const { return body_id_; } |
| 942 BailoutId PrepareId() const { return prepare_id_; } | 931 BailoutId PrepareId() const { return prepare_id_; } |
| 943 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 932 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
| 944 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 933 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
| 945 | 934 |
| 946 protected: | 935 protected: |
| 947 ForInStatement(Zone* zone, ZoneStringList* labels, int pos) | 936 ForInStatement(Zone* zone, ZoneStringList* labels, int pos) |
| 948 : ForEachStatement(zone, labels, pos), | 937 : ForEachStatement(zone, labels, pos), |
| 949 for_in_type_(SLOW_FOR_IN), | 938 for_in_type_(SLOW_FOR_IN), |
| 950 for_in_feedback_slot_(kInvalidFeedbackSlot), | |
| 951 body_id_(GetNextId(zone)), | 939 body_id_(GetNextId(zone)), |
| 952 prepare_id_(GetNextId(zone)) { | 940 prepare_id_(GetNextId(zone)) { |
| 953 } | 941 } |
| 954 | 942 |
| 955 ForInType for_in_type_; | 943 ForInType for_in_type_; |
| 956 int for_in_feedback_slot_; | |
| 957 const BailoutId body_id_; | 944 const BailoutId body_id_; |
| 958 const BailoutId prepare_id_; | 945 const BailoutId prepare_id_; |
| 959 }; | 946 }; |
| 960 | 947 |
| 961 | 948 |
| 962 class ForOfStatement V8_FINAL : public ForEachStatement { | 949 class ForOfStatement V8_FINAL : public ForEachStatement { |
| 963 public: | 950 public: |
| 964 DECLARE_NODE_TYPE(ForOfStatement) | 951 DECLARE_NODE_TYPE(ForOfStatement) |
| 965 | 952 |
| 966 void Initialize(Expression* each, | 953 void Initialize(Expression* each, |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1739 const BailoutId load_id_; | 1726 const BailoutId load_id_; |
| 1740 | 1727 |
| 1741 SmallMapList receiver_types_; | 1728 SmallMapList receiver_types_; |
| 1742 bool is_for_call_ : 1; | 1729 bool is_for_call_ : 1; |
| 1743 bool is_uninitialized_ : 1; | 1730 bool is_uninitialized_ : 1; |
| 1744 bool is_string_access_ : 1; | 1731 bool is_string_access_ : 1; |
| 1745 bool is_function_prototype_ : 1; | 1732 bool is_function_prototype_ : 1; |
| 1746 }; | 1733 }; |
| 1747 | 1734 |
| 1748 | 1735 |
| 1749 class Call V8_FINAL : public Expression, public FeedbackSlotInterface { | 1736 class Call V8_FINAL : public Expression { |
| 1750 public: | 1737 public: |
| 1751 DECLARE_NODE_TYPE(Call) | 1738 DECLARE_NODE_TYPE(Call) |
| 1752 | 1739 |
| 1753 Expression* expression() const { return expression_; } | 1740 Expression* expression() const { return expression_; } |
| 1754 ZoneList<Expression*>* arguments() const { return arguments_; } | 1741 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1755 | 1742 |
| 1756 // Type feedback information. | 1743 // Type feedback information. |
| 1757 virtual ComputablePhase GetComputablePhase() { return AFTER_SCOPING; } | 1744 TypeFeedbackId CallFeedbackId() const { return reuse(id()); } |
| 1758 virtual int ComputeFeedbackSlotCount(Isolate* isolate); | |
| 1759 virtual void SetFirstFeedbackSlot(int slot) { | |
| 1760 call_feedback_slot_ = slot; | |
| 1761 } | |
| 1762 | |
| 1763 bool HasCallFeedbackSlot() const { | |
| 1764 return call_feedback_slot_ != kInvalidFeedbackSlot; | |
| 1765 } | |
| 1766 int CallFeedbackSlot() const { return call_feedback_slot_; } | |
| 1767 | 1745 |
| 1768 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { | 1746 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { |
| 1769 if (expression()->IsProperty()) { | 1747 if (expression()->IsProperty()) { |
| 1770 return expression()->AsProperty()->GetReceiverTypes(); | 1748 return expression()->AsProperty()->GetReceiverTypes(); |
| 1771 } | 1749 } |
| 1772 return NULL; | 1750 return NULL; |
| 1773 } | 1751 } |
| 1774 | 1752 |
| 1775 virtual bool IsMonomorphic() V8_OVERRIDE { | 1753 virtual bool IsMonomorphic() V8_OVERRIDE { |
| 1776 if (expression()->IsProperty()) { | 1754 if (expression()->IsProperty()) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1805 #endif | 1783 #endif |
| 1806 | 1784 |
| 1807 protected: | 1785 protected: |
| 1808 Call(Zone* zone, | 1786 Call(Zone* zone, |
| 1809 Expression* expression, | 1787 Expression* expression, |
| 1810 ZoneList<Expression*>* arguments, | 1788 ZoneList<Expression*>* arguments, |
| 1811 int pos) | 1789 int pos) |
| 1812 : Expression(zone, pos), | 1790 : Expression(zone, pos), |
| 1813 expression_(expression), | 1791 expression_(expression), |
| 1814 arguments_(arguments), | 1792 arguments_(arguments), |
| 1815 call_feedback_slot_(kInvalidFeedbackSlot), | |
| 1816 return_id_(GetNextId(zone)) { | 1793 return_id_(GetNextId(zone)) { |
| 1817 if (expression->IsProperty()) { | 1794 if (expression->IsProperty()) { |
| 1818 expression->AsProperty()->mark_for_call(); | 1795 expression->AsProperty()->mark_for_call(); |
| 1819 } | 1796 } |
| 1820 } | 1797 } |
| 1821 | 1798 |
| 1822 private: | 1799 private: |
| 1823 Expression* expression_; | 1800 Expression* expression_; |
| 1824 ZoneList<Expression*>* arguments_; | 1801 ZoneList<Expression*>* arguments_; |
| 1825 | 1802 |
| 1826 Handle<JSFunction> target_; | 1803 Handle<JSFunction> target_; |
| 1827 Handle<Cell> cell_; | 1804 Handle<Cell> cell_; |
| 1828 int call_feedback_slot_; | |
| 1829 | 1805 |
| 1830 const BailoutId return_id_; | 1806 const BailoutId return_id_; |
| 1831 }; | 1807 }; |
| 1832 | 1808 |
| 1833 | 1809 |
| 1834 class CallNew V8_FINAL : public Expression, public FeedbackSlotInterface { | 1810 class CallNew V8_FINAL : public Expression { |
| 1835 public: | 1811 public: |
| 1836 DECLARE_NODE_TYPE(CallNew) | 1812 DECLARE_NODE_TYPE(CallNew) |
| 1837 | 1813 |
| 1838 Expression* expression() const { return expression_; } | 1814 Expression* expression() const { return expression_; } |
| 1839 ZoneList<Expression*>* arguments() const { return arguments_; } | 1815 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1840 | 1816 |
| 1841 // Type feedback information. | 1817 // Type feedback information. |
| 1842 virtual ComputablePhase GetComputablePhase() { return DURING_PARSE; } | |
| 1843 virtual int ComputeFeedbackSlotCount(Isolate* isolate) { return 1; } | |
| 1844 virtual void SetFirstFeedbackSlot(int slot) { | |
| 1845 callnew_feedback_slot_ = slot; | |
| 1846 } | |
| 1847 | |
| 1848 int CallNewFeedbackSlot() { | |
| 1849 ASSERT(callnew_feedback_slot_ != kInvalidFeedbackSlot); | |
| 1850 return callnew_feedback_slot_; | |
| 1851 } | |
| 1852 | |
| 1853 TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); } | 1818 TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); } |
| 1854 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1819 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1855 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } | 1820 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } |
| 1856 Handle<JSFunction> target() const { return target_; } | 1821 Handle<JSFunction> target() const { return target_; } |
| 1857 ElementsKind elements_kind() const { return elements_kind_; } | 1822 ElementsKind elements_kind() const { return elements_kind_; } |
| 1858 Handle<AllocationSite> allocation_site() const { | 1823 Handle<AllocationSite> allocation_site() const { |
| 1859 return allocation_site_; | 1824 return allocation_site_; |
| 1860 } | 1825 } |
| 1861 | 1826 |
| 1862 static int feedback_slots() { return 1; } | |
| 1863 | |
| 1864 BailoutId ReturnId() const { return return_id_; } | 1827 BailoutId ReturnId() const { return return_id_; } |
| 1865 | 1828 |
| 1866 protected: | 1829 protected: |
| 1867 CallNew(Zone* zone, | 1830 CallNew(Zone* zone, |
| 1868 Expression* expression, | 1831 Expression* expression, |
| 1869 ZoneList<Expression*>* arguments, | 1832 ZoneList<Expression*>* arguments, |
| 1870 int pos) | 1833 int pos) |
| 1871 : Expression(zone, pos), | 1834 : Expression(zone, pos), |
| 1872 expression_(expression), | 1835 expression_(expression), |
| 1873 arguments_(arguments), | 1836 arguments_(arguments), |
| 1874 is_monomorphic_(false), | 1837 is_monomorphic_(false), |
| 1875 elements_kind_(GetInitialFastElementsKind()), | 1838 elements_kind_(GetInitialFastElementsKind()), |
| 1876 callnew_feedback_slot_(kInvalidFeedbackSlot), | |
| 1877 return_id_(GetNextId(zone)) { } | 1839 return_id_(GetNextId(zone)) { } |
| 1878 | 1840 |
| 1879 private: | 1841 private: |
| 1880 Expression* expression_; | 1842 Expression* expression_; |
| 1881 ZoneList<Expression*>* arguments_; | 1843 ZoneList<Expression*>* arguments_; |
| 1882 | 1844 |
| 1883 bool is_monomorphic_; | 1845 bool is_monomorphic_; |
| 1884 Handle<JSFunction> target_; | 1846 Handle<JSFunction> target_; |
| 1885 ElementsKind elements_kind_; | 1847 ElementsKind elements_kind_; |
| 1886 Handle<AllocationSite> allocation_site_; | 1848 Handle<AllocationSite> allocation_site_; |
| 1887 int callnew_feedback_slot_; | |
| 1888 | 1849 |
| 1889 const BailoutId return_id_; | 1850 const BailoutId return_id_; |
| 1890 }; | 1851 }; |
| 1891 | 1852 |
| 1892 | 1853 |
| 1893 // The CallRuntime class does not represent any official JavaScript | 1854 // The CallRuntime class does not represent any official JavaScript |
| 1894 // language construct. Instead it is used to call a C or JS function | 1855 // language construct. Instead it is used to call a C or JS function |
| 1895 // with a set of arguments. This is used from the builtins that are | 1856 // with a set of arguments. This is used from the builtins that are |
| 1896 // implemented in JavaScript (see "v8natives.js"). | 1857 // implemented in JavaScript (see "v8natives.js"). |
| 1897 class CallRuntime V8_FINAL : public Expression { | 1858 class CallRuntime V8_FINAL : public Expression { |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2364 | 2325 |
| 2365 bool is_generator() { | 2326 bool is_generator() { |
| 2366 return IsGenerator::decode(bitfield_) == kIsGenerator; | 2327 return IsGenerator::decode(bitfield_) == kIsGenerator; |
| 2367 } | 2328 } |
| 2368 | 2329 |
| 2369 int ast_node_count() { return ast_properties_.node_count(); } | 2330 int ast_node_count() { return ast_properties_.node_count(); } |
| 2370 AstProperties::Flags* flags() { return ast_properties_.flags(); } | 2331 AstProperties::Flags* flags() { return ast_properties_.flags(); } |
| 2371 void set_ast_properties(AstProperties* ast_properties) { | 2332 void set_ast_properties(AstProperties* ast_properties) { |
| 2372 ast_properties_ = *ast_properties; | 2333 ast_properties_ = *ast_properties; |
| 2373 } | 2334 } |
| 2374 void set_slot_processor(DeferredFeedbackSlotProcessor* slot_processor) { | 2335 |
| 2375 slot_processor_ = *slot_processor; | |
| 2376 } | |
| 2377 void ProcessFeedbackSlots(Isolate* isolate) { | |
| 2378 slot_processor_.ProcessFeedbackSlots(isolate); | |
| 2379 } | |
| 2380 int slot_count() { | |
| 2381 return slot_processor_.slot_count(); | |
| 2382 } | |
| 2383 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } | 2336 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } |
| 2384 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } | 2337 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } |
| 2385 void set_dont_optimize_reason(BailoutReason reason) { | 2338 void set_dont_optimize_reason(BailoutReason reason) { |
| 2386 dont_optimize_reason_ = reason; | 2339 dont_optimize_reason_ = reason; |
| 2387 } | 2340 } |
| 2388 | 2341 |
| 2389 protected: | 2342 protected: |
| 2390 FunctionLiteral(Zone* zone, | 2343 FunctionLiteral(Zone* zone, |
| 2391 Handle<String> name, | 2344 Handle<String> name, |
| 2392 Scope* scope, | 2345 Scope* scope, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2422 IsGenerator::encode(is_generator); | 2375 IsGenerator::encode(is_generator); |
| 2423 } | 2376 } |
| 2424 | 2377 |
| 2425 private: | 2378 private: |
| 2426 Handle<String> name_; | 2379 Handle<String> name_; |
| 2427 Handle<SharedFunctionInfo> shared_info_; | 2380 Handle<SharedFunctionInfo> shared_info_; |
| 2428 Scope* scope_; | 2381 Scope* scope_; |
| 2429 ZoneList<Statement*>* body_; | 2382 ZoneList<Statement*>* body_; |
| 2430 Handle<String> inferred_name_; | 2383 Handle<String> inferred_name_; |
| 2431 AstProperties ast_properties_; | 2384 AstProperties ast_properties_; |
| 2432 DeferredFeedbackSlotProcessor slot_processor_; | |
| 2433 BailoutReason dont_optimize_reason_; | 2385 BailoutReason dont_optimize_reason_; |
| 2434 | 2386 |
| 2435 int materialized_literal_count_; | 2387 int materialized_literal_count_; |
| 2436 int expected_property_count_; | 2388 int expected_property_count_; |
| 2437 int handler_count_; | 2389 int handler_count_; |
| 2438 int parameter_count_; | 2390 int parameter_count_; |
| 2439 int function_token_position_; | 2391 int function_token_position_; |
| 2440 | 2392 |
| 2441 unsigned bitfield_; | 2393 unsigned bitfield_; |
| 2442 class IsExpression: public BitField<bool, 0, 1> {}; | 2394 class IsExpression: public BitField<bool, 0, 1> {}; |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2897 \ | 2849 \ |
| 2898 Zone* zone_; \ | 2850 Zone* zone_; \ |
| 2899 bool stack_overflow_ | 2851 bool stack_overflow_ |
| 2900 | 2852 |
| 2901 | 2853 |
| 2902 // ---------------------------------------------------------------------------- | 2854 // ---------------------------------------------------------------------------- |
| 2903 // Construction time visitor. | 2855 // Construction time visitor. |
| 2904 | 2856 |
| 2905 class AstConstructionVisitor BASE_EMBEDDED { | 2857 class AstConstructionVisitor BASE_EMBEDDED { |
| 2906 public: | 2858 public: |
| 2907 explicit AstConstructionVisitor(Zone* zone) | 2859 AstConstructionVisitor() : dont_optimize_reason_(kNoReason) { } |
| 2908 : dont_optimize_reason_(kNoReason), | |
| 2909 zone_(zone) { } | |
| 2910 | 2860 |
| 2911 AstProperties* ast_properties() { return &properties_; } | 2861 AstProperties* ast_properties() { return &properties_; } |
| 2912 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } | 2862 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } |
| 2913 DeferredFeedbackSlotProcessor* slot_processor() { return &slot_processor_; } | |
| 2914 | 2863 |
| 2915 private: | 2864 private: |
| 2916 template<class> friend class AstNodeFactory; | 2865 template<class> friend class AstNodeFactory; |
| 2917 | 2866 |
| 2918 // Node visitors. | 2867 // Node visitors. |
| 2919 #define DEF_VISIT(type) \ | 2868 #define DEF_VISIT(type) \ |
| 2920 void Visit##type(type* node); | 2869 void Visit##type(type* node); |
| 2921 AST_NODE_LIST(DEF_VISIT) | 2870 AST_NODE_LIST(DEF_VISIT) |
| 2922 #undef DEF_VISIT | 2871 #undef DEF_VISIT |
| 2923 | 2872 |
| 2924 void increase_node_count() { properties_.add_node_count(1); } | 2873 void increase_node_count() { properties_.add_node_count(1); } |
| 2925 void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); } | 2874 void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); } |
| 2926 void set_dont_optimize_reason(BailoutReason reason) { | 2875 void set_dont_optimize_reason(BailoutReason reason) { |
| 2927 dont_optimize_reason_ = reason; | 2876 dont_optimize_reason_ = reason; |
| 2928 } | 2877 } |
| 2929 | 2878 |
| 2930 void add_slot_node(FeedbackSlotInterface* slot_node) { | |
| 2931 slot_processor_.add_slot_node(zone_, slot_node); | |
| 2932 } | |
| 2933 | |
| 2934 AstProperties properties_; | 2879 AstProperties properties_; |
| 2935 DeferredFeedbackSlotProcessor slot_processor_; | |
| 2936 BailoutReason dont_optimize_reason_; | 2880 BailoutReason dont_optimize_reason_; |
| 2937 Zone* zone_; | |
| 2938 }; | 2881 }; |
| 2939 | 2882 |
| 2940 | 2883 |
| 2941 class AstNullVisitor BASE_EMBEDDED { | 2884 class AstNullVisitor BASE_EMBEDDED { |
| 2942 public: | 2885 public: |
| 2943 explicit AstNullVisitor(Zone* zone) {} | |
| 2944 | |
| 2945 // Node visitors. | 2886 // Node visitors. |
| 2946 #define DEF_VISIT(type) \ | 2887 #define DEF_VISIT(type) \ |
| 2947 void Visit##type(type* node) {} | 2888 void Visit##type(type* node) {} |
| 2948 AST_NODE_LIST(DEF_VISIT) | 2889 AST_NODE_LIST(DEF_VISIT) |
| 2949 #undef DEF_VISIT | 2890 #undef DEF_VISIT |
| 2950 }; | 2891 }; |
| 2951 | 2892 |
| 2952 | 2893 |
| 2953 | 2894 |
| 2954 // ---------------------------------------------------------------------------- | 2895 // ---------------------------------------------------------------------------- |
| 2955 // AstNode factory | 2896 // AstNode factory |
| 2956 | 2897 |
| 2957 template<class Visitor> | 2898 template<class Visitor> |
| 2958 class AstNodeFactory V8_FINAL BASE_EMBEDDED { | 2899 class AstNodeFactory V8_FINAL BASE_EMBEDDED { |
| 2959 public: | 2900 public: |
| 2960 explicit AstNodeFactory(Zone* zone) | 2901 explicit AstNodeFactory(Zone* zone) : zone_(zone) { } |
| 2961 : zone_(zone), | |
| 2962 visitor_(zone) { } | |
| 2963 | 2902 |
| 2964 Visitor* visitor() { return &visitor_; } | 2903 Visitor* visitor() { return &visitor_; } |
| 2965 | 2904 |
| 2966 #define VISIT_AND_RETURN(NodeType, node) \ | 2905 #define VISIT_AND_RETURN(NodeType, node) \ |
| 2967 visitor_.Visit##NodeType((node)); \ | 2906 visitor_.Visit##NodeType((node)); \ |
| 2968 return node; | 2907 return node; |
| 2969 | 2908 |
| 2970 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, | 2909 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, |
| 2971 VariableMode mode, | 2910 VariableMode mode, |
| 2972 Scope* scope, | 2911 Scope* scope, |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3357 | 3296 |
| 3358 private: | 3297 private: |
| 3359 Zone* zone_; | 3298 Zone* zone_; |
| 3360 Visitor visitor_; | 3299 Visitor visitor_; |
| 3361 }; | 3300 }; |
| 3362 | 3301 |
| 3363 | 3302 |
| 3364 } } // namespace v8::internal | 3303 } } // namespace v8::internal |
| 3365 | 3304 |
| 3366 #endif // V8_AST_H_ | 3305 #endif // V8_AST_H_ |
| OLD | NEW |