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 // 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" | |
| 35 #include "isolate.h" | 36 #include "isolate.h" |
| 36 #include "jsregexp.h" | 37 #include "jsregexp.h" |
| 37 #include "list-inl.h" | 38 #include "list-inl.h" |
| 38 #include "runtime.h" | 39 #include "runtime.h" |
| 39 #include "small-pointer-list.h" | 40 #include "small-pointer-list.h" |
| 40 #include "smart-pointers.h" | 41 #include "smart-pointers.h" |
| 41 #include "token.h" | 42 #include "token.h" |
| 42 #include "types.h" | 43 #include "types.h" |
| 43 #include "utils.h" | 44 #include "utils.h" |
| 44 #include "variables.h" | 45 #include "variables.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 kDontSelfOptimize, | 175 kDontSelfOptimize, |
| 175 kDontSoftInline, | 176 kDontSoftInline, |
| 176 kDontCache | 177 kDontCache |
| 177 }; | 178 }; |
| 178 | 179 |
| 179 | 180 |
| 180 class AstProperties V8_FINAL BASE_EMBEDDED { | 181 class AstProperties V8_FINAL BASE_EMBEDDED { |
| 181 public: | 182 public: |
| 182 class Flags : public EnumSet<AstPropertiesFlag, int> {}; | 183 class Flags : public EnumSet<AstPropertiesFlag, int> {}; |
| 183 | 184 |
| 184 AstProperties() : node_count_(0) { } | 185 AstProperties() : node_count_(0) {} |
| 185 | 186 |
| 186 Flags* flags() { return &flags_; } | 187 Flags* flags() { return &flags_; } |
| 187 int node_count() { return node_count_; } | 188 int node_count() { return node_count_; } |
| 188 void add_node_count(int count) { node_count_ += count; } | 189 void add_node_count(int count) { node_count_ += count; } |
| 189 | 190 |
| 190 private: | 191 private: |
| 191 Flags flags_; | 192 Flags flags_; |
| 192 int node_count_; | 193 int node_count_; |
| 193 }; | 194 }; |
| 194 | 195 |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 907 each_(NULL), | 908 each_(NULL), |
| 908 subject_(NULL) { | 909 subject_(NULL) { |
| 909 } | 910 } |
| 910 | 911 |
| 911 private: | 912 private: |
| 912 Expression* each_; | 913 Expression* each_; |
| 913 Expression* subject_; | 914 Expression* subject_; |
| 914 }; | 915 }; |
| 915 | 916 |
| 916 | 917 |
| 917 class ForInStatement V8_FINAL : public ForEachStatement { | 918 class ForInStatement V8_FINAL : public ForEachStatement, |
|
Benedikt Meurer
2014/02/04 08:53:50
You mentioned offline that you got rid of this mul
mvstanton
2014/02/04 13:03:27
Per our conversation, I'll keep the interface inhe
| |
| 919 public FeedbackSlotInterface { | |
| 918 public: | 920 public: |
| 919 DECLARE_NODE_TYPE(ForInStatement) | 921 DECLARE_NODE_TYPE(ForInStatement) |
| 920 | 922 |
| 921 Expression* enumerable() const { | 923 Expression* enumerable() const { |
| 922 return subject(); | 924 return subject(); |
| 923 } | 925 } |
| 924 | 926 |
| 925 TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); } | 927 // Type feedback information. |
| 928 virtual int StaticFeedbackSlotCount() { return 1; } | |
| 929 virtual int GetFeedbackSlotCount(Isolate* isolate) { | |
| 930 UNREACHABLE(); | |
| 931 return -1; | |
| 932 } | |
| 933 virtual void SetFirstFeedbackSlot(int slot) { for_in_feedback_slot_ = slot; } | |
| 934 | |
| 935 int ForInFeedbackSlot() { | |
| 936 ASSERT(for_in_feedback_slot_ != kInvalidFeedbackSlot); | |
| 937 return for_in_feedback_slot_; | |
| 938 } | |
| 939 | |
| 926 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; | 940 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; |
| 927 ForInType for_in_type() const { return for_in_type_; } | 941 ForInType for_in_type() const { return for_in_type_; } |
| 928 void set_for_in_type(ForInType type) { for_in_type_ = type; } | 942 void set_for_in_type(ForInType type) { for_in_type_ = type; } |
| 929 | 943 |
| 930 BailoutId BodyId() const { return body_id_; } | 944 BailoutId BodyId() const { return body_id_; } |
| 931 BailoutId PrepareId() const { return prepare_id_; } | 945 BailoutId PrepareId() const { return prepare_id_; } |
| 932 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 946 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
| 933 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 947 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
| 934 | 948 |
| 935 protected: | 949 protected: |
| 936 ForInStatement(Zone* zone, ZoneStringList* labels, int pos) | 950 ForInStatement(Zone* zone, ZoneStringList* labels, int pos) |
| 937 : ForEachStatement(zone, labels, pos), | 951 : ForEachStatement(zone, labels, pos), |
| 938 for_in_type_(SLOW_FOR_IN), | 952 for_in_type_(SLOW_FOR_IN), |
| 953 for_in_feedback_slot_(kInvalidFeedbackSlot), | |
| 939 body_id_(GetNextId(zone)), | 954 body_id_(GetNextId(zone)), |
| 940 prepare_id_(GetNextId(zone)) { | 955 prepare_id_(GetNextId(zone)) { |
| 941 } | 956 } |
| 942 | 957 |
| 943 ForInType for_in_type_; | 958 ForInType for_in_type_; |
| 959 int for_in_feedback_slot_; | |
| 944 const BailoutId body_id_; | 960 const BailoutId body_id_; |
| 945 const BailoutId prepare_id_; | 961 const BailoutId prepare_id_; |
| 946 }; | 962 }; |
| 947 | 963 |
| 948 | 964 |
| 949 class ForOfStatement V8_FINAL : public ForEachStatement { | 965 class ForOfStatement V8_FINAL : public ForEachStatement { |
| 950 public: | 966 public: |
| 951 DECLARE_NODE_TYPE(ForOfStatement) | 967 DECLARE_NODE_TYPE(ForOfStatement) |
| 952 | 968 |
| 953 void Initialize(Expression* each, | 969 void Initialize(Expression* each, |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1726 const BailoutId load_id_; | 1742 const BailoutId load_id_; |
| 1727 | 1743 |
| 1728 SmallMapList receiver_types_; | 1744 SmallMapList receiver_types_; |
| 1729 bool is_pre_monomorphic_ : 1; | 1745 bool is_pre_monomorphic_ : 1; |
| 1730 bool is_uninitialized_ : 1; | 1746 bool is_uninitialized_ : 1; |
| 1731 bool is_string_access_ : 1; | 1747 bool is_string_access_ : 1; |
| 1732 bool is_function_prototype_ : 1; | 1748 bool is_function_prototype_ : 1; |
| 1733 }; | 1749 }; |
| 1734 | 1750 |
| 1735 | 1751 |
| 1736 class Call V8_FINAL : public Expression { | 1752 class Call V8_FINAL : public Expression, public FeedbackSlotInterface { |
| 1737 public: | 1753 public: |
| 1738 DECLARE_NODE_TYPE(Call) | 1754 DECLARE_NODE_TYPE(Call) |
| 1739 | 1755 |
| 1740 Expression* expression() const { return expression_; } | 1756 Expression* expression() const { return expression_; } |
| 1741 ZoneList<Expression*>* arguments() const { return arguments_; } | 1757 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1742 | 1758 |
| 1743 // Type feedback information. | 1759 // Type feedback information. |
| 1760 virtual int StaticFeedbackSlotCount() { return -1; } | |
| 1761 virtual int GetFeedbackSlotCount(Isolate* isolate); | |
| 1762 virtual void SetFirstFeedbackSlot(int slot) { | |
| 1763 call_feedback_slot_ = slot; | |
| 1764 } | |
| 1765 | |
| 1766 bool HasCallFeedbackSlot() const { | |
| 1767 return call_feedback_slot_ != kInvalidFeedbackSlot; | |
| 1768 } | |
| 1769 int CallFeedbackSlot() const { return call_feedback_slot_; } | |
| 1770 | |
| 1771 // Type feedback information. | |
| 1744 TypeFeedbackId CallFeedbackId() const { return reuse(id()); } | 1772 TypeFeedbackId CallFeedbackId() const { return reuse(id()); } |
| 1745 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1773 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1746 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { | 1774 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { |
| 1747 return &receiver_types_; | 1775 return &receiver_types_; |
| 1748 } | 1776 } |
| 1749 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } | 1777 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } |
| 1750 bool KeyedArrayCallIsHoley() { return keyed_array_call_is_holey_; } | 1778 bool KeyedArrayCallIsHoley() { return keyed_array_call_is_holey_; } |
| 1751 CheckType check_type() const { return check_type_; } | 1779 CheckType check_type() const { return check_type_; } |
| 1752 | 1780 |
| 1753 void set_string_check(Handle<JSObject> holder) { | 1781 void set_string_check(Handle<JSObject> holder) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1804 Call(Zone* zone, | 1832 Call(Zone* zone, |
| 1805 Expression* expression, | 1833 Expression* expression, |
| 1806 ZoneList<Expression*>* arguments, | 1834 ZoneList<Expression*>* arguments, |
| 1807 int pos) | 1835 int pos) |
| 1808 : Expression(zone, pos), | 1836 : Expression(zone, pos), |
| 1809 expression_(expression), | 1837 expression_(expression), |
| 1810 arguments_(arguments), | 1838 arguments_(arguments), |
| 1811 is_monomorphic_(false), | 1839 is_monomorphic_(false), |
| 1812 keyed_array_call_is_holey_(true), | 1840 keyed_array_call_is_holey_(true), |
| 1813 check_type_(RECEIVER_MAP_CHECK), | 1841 check_type_(RECEIVER_MAP_CHECK), |
| 1842 call_feedback_slot_(kInvalidFeedbackSlot), | |
| 1814 return_id_(GetNextId(zone)) { } | 1843 return_id_(GetNextId(zone)) { } |
| 1815 | 1844 |
| 1816 private: | 1845 private: |
| 1817 Expression* expression_; | 1846 Expression* expression_; |
| 1818 ZoneList<Expression*>* arguments_; | 1847 ZoneList<Expression*>* arguments_; |
| 1819 | 1848 |
| 1820 bool is_monomorphic_; | 1849 bool is_monomorphic_; |
| 1821 bool keyed_array_call_is_holey_; | 1850 bool keyed_array_call_is_holey_; |
| 1822 CheckType check_type_; | 1851 CheckType check_type_; |
| 1823 SmallMapList receiver_types_; | 1852 SmallMapList receiver_types_; |
| 1824 Handle<JSFunction> target_; | 1853 Handle<JSFunction> target_; |
| 1825 Handle<JSObject> holder_; | 1854 Handle<JSObject> holder_; |
| 1826 Handle<Cell> cell_; | 1855 Handle<Cell> cell_; |
| 1856 int call_feedback_slot_; | |
| 1827 | 1857 |
| 1828 const BailoutId return_id_; | 1858 const BailoutId return_id_; |
| 1829 }; | 1859 }; |
| 1830 | 1860 |
| 1831 | 1861 |
| 1832 class CallNew V8_FINAL : public Expression { | 1862 class CallNew V8_FINAL : public Expression, public FeedbackSlotInterface { |
| 1833 public: | 1863 public: |
| 1834 DECLARE_NODE_TYPE(CallNew) | 1864 DECLARE_NODE_TYPE(CallNew) |
| 1835 | 1865 |
| 1836 Expression* expression() const { return expression_; } | 1866 Expression* expression() const { return expression_; } |
| 1837 ZoneList<Expression*>* arguments() const { return arguments_; } | 1867 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1838 | 1868 |
| 1839 // Type feedback information. | 1869 // Type feedback information. |
| 1870 virtual int StaticFeedbackSlotCount() { return 1; } | |
| 1871 virtual int GetFeedbackSlotCount(Isolate* isolate) { | |
| 1872 UNREACHABLE(); | |
| 1873 return -1; | |
| 1874 } | |
| 1875 virtual void SetFirstFeedbackSlot(int slot) { | |
| 1876 callnew_feedback_slot_ = slot; | |
| 1877 } | |
| 1878 | |
| 1879 int CallNewFeedbackSlot() { | |
| 1880 ASSERT(callnew_feedback_slot_ != kInvalidFeedbackSlot); | |
| 1881 return callnew_feedback_slot_; | |
| 1882 } | |
| 1883 | |
| 1840 TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); } | 1884 TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); } |
| 1841 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1885 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1842 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } | 1886 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } |
| 1843 Handle<JSFunction> target() const { return target_; } | 1887 Handle<JSFunction> target() const { return target_; } |
| 1844 ElementsKind elements_kind() const { return elements_kind_; } | 1888 ElementsKind elements_kind() const { return elements_kind_; } |
| 1845 Handle<AllocationSite> allocation_site() const { | 1889 Handle<AllocationSite> allocation_site() const { |
| 1846 return allocation_site_; | 1890 return allocation_site_; |
| 1847 } | 1891 } |
| 1848 | 1892 |
| 1893 static int feedback_slots() { return 1; } | |
| 1894 | |
| 1849 BailoutId ReturnId() const { return return_id_; } | 1895 BailoutId ReturnId() const { return return_id_; } |
| 1850 | 1896 |
| 1851 protected: | 1897 protected: |
| 1852 CallNew(Zone* zone, | 1898 CallNew(Zone* zone, |
| 1853 Expression* expression, | 1899 Expression* expression, |
| 1854 ZoneList<Expression*>* arguments, | 1900 ZoneList<Expression*>* arguments, |
| 1855 int pos) | 1901 int pos) |
| 1856 : Expression(zone, pos), | 1902 : Expression(zone, pos), |
| 1857 expression_(expression), | 1903 expression_(expression), |
| 1858 arguments_(arguments), | 1904 arguments_(arguments), |
| 1859 is_monomorphic_(false), | 1905 is_monomorphic_(false), |
| 1860 elements_kind_(GetInitialFastElementsKind()), | 1906 elements_kind_(GetInitialFastElementsKind()), |
| 1907 callnew_feedback_slot_(kInvalidFeedbackSlot), | |
| 1861 return_id_(GetNextId(zone)) { } | 1908 return_id_(GetNextId(zone)) { } |
| 1862 | 1909 |
| 1863 private: | 1910 private: |
| 1864 Expression* expression_; | 1911 Expression* expression_; |
| 1865 ZoneList<Expression*>* arguments_; | 1912 ZoneList<Expression*>* arguments_; |
| 1866 | 1913 |
| 1867 bool is_monomorphic_; | 1914 bool is_monomorphic_; |
| 1868 Handle<JSFunction> target_; | 1915 Handle<JSFunction> target_; |
| 1869 ElementsKind elements_kind_; | 1916 ElementsKind elements_kind_; |
| 1870 Handle<AllocationSite> allocation_site_; | 1917 Handle<AllocationSite> allocation_site_; |
| 1918 Handle<Cell> allocation_info_cell_; | |
| 1919 int callnew_feedback_slot_; | |
| 1871 | 1920 |
| 1872 const BailoutId return_id_; | 1921 const BailoutId return_id_; |
| 1873 }; | 1922 }; |
| 1874 | 1923 |
| 1875 | 1924 |
| 1876 // The CallRuntime class does not represent any official JavaScript | 1925 // The CallRuntime class does not represent any official JavaScript |
| 1877 // language construct. Instead it is used to call a C or JS function | 1926 // language construct. Instead it is used to call a C or JS function |
| 1878 // with a set of arguments. This is used from the builtins that are | 1927 // with a set of arguments. This is used from the builtins that are |
| 1879 // implemented in JavaScript (see "v8natives.js"). | 1928 // implemented in JavaScript (see "v8natives.js"). |
| 1880 class CallRuntime V8_FINAL : public Expression { | 1929 class CallRuntime V8_FINAL : public Expression { |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2350 | 2399 |
| 2351 bool is_generator() { | 2400 bool is_generator() { |
| 2352 return IsGenerator::decode(bitfield_) == kIsGenerator; | 2401 return IsGenerator::decode(bitfield_) == kIsGenerator; |
| 2353 } | 2402 } |
| 2354 | 2403 |
| 2355 int ast_node_count() { return ast_properties_.node_count(); } | 2404 int ast_node_count() { return ast_properties_.node_count(); } |
| 2356 AstProperties::Flags* flags() { return ast_properties_.flags(); } | 2405 AstProperties::Flags* flags() { return ast_properties_.flags(); } |
| 2357 void set_ast_properties(AstProperties* ast_properties) { | 2406 void set_ast_properties(AstProperties* ast_properties) { |
| 2358 ast_properties_ = *ast_properties; | 2407 ast_properties_ = *ast_properties; |
| 2359 } | 2408 } |
| 2360 | 2409 void set_slot_processor(DeferredFeedbackSlotProcessor* slot_processor) { |
| 2410 slot_processor_ = *slot_processor; | |
| 2411 } | |
| 2412 void ProcessFeedbackSlots(Isolate* isolate) { | |
| 2413 slot_processor_.ProcessFeedbackSlots(isolate); | |
| 2414 } | |
| 2415 int slot_count() { | |
| 2416 return slot_processor_.slot_count(); | |
| 2417 } | |
| 2361 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } | 2418 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } |
| 2362 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } | 2419 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } |
| 2363 void set_dont_optimize_reason(BailoutReason reason) { | 2420 void set_dont_optimize_reason(BailoutReason reason) { |
| 2364 dont_optimize_reason_ = reason; | 2421 dont_optimize_reason_ = reason; |
| 2365 } | 2422 } |
| 2366 | 2423 |
| 2367 protected: | 2424 protected: |
| 2368 FunctionLiteral(Zone* zone, | 2425 FunctionLiteral(Zone* zone, |
| 2369 Handle<String> name, | 2426 Handle<String> name, |
| 2370 Scope* scope, | 2427 Scope* scope, |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 2400 IsGenerator::encode(is_generator); | 2457 IsGenerator::encode(is_generator); |
| 2401 } | 2458 } |
| 2402 | 2459 |
| 2403 private: | 2460 private: |
| 2404 Handle<String> name_; | 2461 Handle<String> name_; |
| 2405 Handle<SharedFunctionInfo> shared_info_; | 2462 Handle<SharedFunctionInfo> shared_info_; |
| 2406 Scope* scope_; | 2463 Scope* scope_; |
| 2407 ZoneList<Statement*>* body_; | 2464 ZoneList<Statement*>* body_; |
| 2408 Handle<String> inferred_name_; | 2465 Handle<String> inferred_name_; |
| 2409 AstProperties ast_properties_; | 2466 AstProperties ast_properties_; |
| 2467 DeferredFeedbackSlotProcessor slot_processor_; | |
| 2410 BailoutReason dont_optimize_reason_; | 2468 BailoutReason dont_optimize_reason_; |
| 2411 | 2469 |
| 2412 int materialized_literal_count_; | 2470 int materialized_literal_count_; |
| 2413 int expected_property_count_; | 2471 int expected_property_count_; |
| 2414 int handler_count_; | 2472 int handler_count_; |
| 2415 int parameter_count_; | 2473 int parameter_count_; |
| 2416 int function_token_position_; | 2474 int function_token_position_; |
| 2417 | 2475 |
| 2418 unsigned bitfield_; | 2476 unsigned bitfield_; |
| 2419 class IsExpression: public BitField<bool, 0, 1> {}; | 2477 class IsExpression: public BitField<bool, 0, 1> {}; |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2874 \ | 2932 \ |
| 2875 Zone* zone_; \ | 2933 Zone* zone_; \ |
| 2876 bool stack_overflow_ | 2934 bool stack_overflow_ |
| 2877 | 2935 |
| 2878 | 2936 |
| 2879 // ---------------------------------------------------------------------------- | 2937 // ---------------------------------------------------------------------------- |
| 2880 // Construction time visitor. | 2938 // Construction time visitor. |
| 2881 | 2939 |
| 2882 class AstConstructionVisitor BASE_EMBEDDED { | 2940 class AstConstructionVisitor BASE_EMBEDDED { |
| 2883 public: | 2941 public: |
| 2884 AstConstructionVisitor() : dont_optimize_reason_(kNoReason) { } | 2942 explicit AstConstructionVisitor(Zone* zone) |
| 2943 : dont_optimize_reason_(kNoReason), | |
| 2944 zone_(zone) { } | |
| 2885 | 2945 |
| 2886 AstProperties* ast_properties() { return &properties_; } | 2946 AstProperties* ast_properties() { return &properties_; } |
| 2887 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } | 2947 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } |
| 2888 | 2948 |
| 2949 DeferredFeedbackSlotProcessor* slot_processor() { return &slot_processor_; } | |
| 2950 int slot_count() { return slot_processor_.slot_count(); } | |
| 2951 void ProcessFeedbackSlots(Isolate* isolate) { | |
| 2952 slot_processor_.ProcessFeedbackSlots(isolate); | |
| 2953 } | |
| 2954 | |
| 2889 private: | 2955 private: |
| 2890 template<class> friend class AstNodeFactory; | 2956 template<class> friend class AstNodeFactory; |
| 2957 template<bool, class> friend class FeedbackSlotUpdater; | |
| 2891 | 2958 |
| 2892 // Node visitors. | 2959 // Node visitors. |
| 2893 #define DEF_VISIT(type) \ | 2960 #define DEF_VISIT(type) \ |
| 2894 void Visit##type(type* node); | 2961 void Visit##type(type* node); |
| 2895 AST_NODE_LIST(DEF_VISIT) | 2962 AST_NODE_LIST(DEF_VISIT) |
| 2896 #undef DEF_VISIT | 2963 #undef DEF_VISIT |
| 2897 | 2964 |
| 2898 void increase_node_count() { properties_.add_node_count(1); } | 2965 void increase_node_count() { properties_.add_node_count(1); } |
| 2899 void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); } | 2966 void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); } |
| 2900 void set_dont_optimize_reason(BailoutReason reason) { | 2967 void set_dont_optimize_reason(BailoutReason reason) { |
| 2901 dont_optimize_reason_ = reason; | 2968 dont_optimize_reason_ = reason; |
| 2902 } | 2969 } |
| 2903 | 2970 |
| 2971 void add_slot_node(FeedbackSlotInterface* slot_node) { | |
| 2972 slot_processor_.add_slot_node(zone_, slot_node); | |
| 2973 } | |
| 2974 | |
| 2904 AstProperties properties_; | 2975 AstProperties properties_; |
| 2976 DeferredFeedbackSlotProcessor slot_processor_; | |
| 2905 BailoutReason dont_optimize_reason_; | 2977 BailoutReason dont_optimize_reason_; |
| 2978 Zone* zone_; | |
| 2906 }; | 2979 }; |
| 2907 | 2980 |
| 2908 | 2981 |
| 2909 class AstNullVisitor BASE_EMBEDDED { | 2982 class AstNullVisitor BASE_EMBEDDED { |
| 2910 public: | 2983 public: |
| 2984 explicit AstNullVisitor(Zone* zone) {} | |
| 2985 | |
| 2911 // Node visitors. | 2986 // Node visitors. |
| 2912 #define DEF_VISIT(type) \ | 2987 #define DEF_VISIT(type) \ |
| 2913 void Visit##type(type* node) {} | 2988 void Visit##type(type* node) {} |
| 2914 AST_NODE_LIST(DEF_VISIT) | 2989 AST_NODE_LIST(DEF_VISIT) |
| 2915 #undef DEF_VISIT | 2990 #undef DEF_VISIT |
| 2916 }; | 2991 }; |
| 2917 | 2992 |
| 2918 | 2993 |
| 2919 | 2994 |
| 2920 // ---------------------------------------------------------------------------- | 2995 // ---------------------------------------------------------------------------- |
| 2921 // AstNode factory | 2996 // AstNode factory |
| 2922 | 2997 |
| 2923 template<class Visitor> | 2998 template<class Visitor> |
| 2924 class AstNodeFactory V8_FINAL BASE_EMBEDDED { | 2999 class AstNodeFactory V8_FINAL BASE_EMBEDDED { |
| 2925 public: | 3000 public: |
| 2926 explicit AstNodeFactory(Zone* zone) : zone_(zone) { } | 3001 explicit AstNodeFactory(Zone* zone) |
| 3002 : zone_(zone), | |
| 3003 visitor_(zone) { } | |
| 2927 | 3004 |
| 2928 Visitor* visitor() { return &visitor_; } | 3005 Visitor* visitor() { return &visitor_; } |
| 2929 | 3006 |
| 2930 #define VISIT_AND_RETURN(NodeType, node) \ | 3007 #define VISIT_AND_RETURN(NodeType, node) \ |
| 2931 visitor_.Visit##NodeType((node)); \ | 3008 visitor_.Visit##NodeType((node)); \ |
| 2932 return node; | 3009 return node; |
| 2933 | 3010 |
| 2934 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, | 3011 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, |
| 2935 VariableMode mode, | 3012 VariableMode mode, |
| 2936 Scope* scope, | 3013 Scope* scope, |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3321 | 3398 |
| 3322 private: | 3399 private: |
| 3323 Zone* zone_; | 3400 Zone* zone_; |
| 3324 Visitor visitor_; | 3401 Visitor visitor_; |
| 3325 }; | 3402 }; |
| 3326 | 3403 |
| 3327 | 3404 |
| 3328 } } // namespace v8::internal | 3405 } } // namespace v8::internal |
| 3329 | 3406 |
| 3330 #endif // V8_AST_H_ | 3407 #endif // V8_AST_H_ |
| OLD | NEW |