Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: src/ast.h

Issue 641373002: Introduce FeedbackVectorSlot type - better than int. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ports. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 virtual TargetCollector* AsTargetCollector() { return NULL; } 232 virtual TargetCollector* AsTargetCollector() { return NULL; }
233 virtual BreakableStatement* AsBreakableStatement() { return NULL; } 233 virtual BreakableStatement* AsBreakableStatement() { return NULL; }
234 virtual IterationStatement* AsIterationStatement() { return NULL; } 234 virtual IterationStatement* AsIterationStatement() { return NULL; }
235 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } 235 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; }
236 236
237 // The interface for feedback slots, with default no-op implementations for 237 // The interface for feedback slots, with default no-op implementations for
238 // node types which don't actually have this. Note that this is conceptually 238 // node types which don't actually have this. Note that this is conceptually
239 // not really nice, but multiple inheritance would introduce yet another 239 // not really nice, but multiple inheritance would introduce yet another
240 // vtable entry per node, something we don't want for space reasons. 240 // vtable entry per node, something we don't want for space reasons.
241 static const int kInvalidFeedbackSlot = -1;
242 virtual int ComputeFeedbackSlotCount() { 241 virtual int ComputeFeedbackSlotCount() {
243 UNREACHABLE(); 242 UNREACHABLE();
244 return 0; 243 return 0;
245 } 244 }
246 virtual void SetFirstFeedbackSlot(int slot) { UNREACHABLE(); } 245 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) { UNREACHABLE(); }
247 246
248 protected: 247 protected:
249 // Some nodes re-use bailout IDs for type feedback. 248 // Some nodes re-use bailout IDs for type feedback.
250 static TypeFeedbackId reuse(BailoutId id) { 249 static TypeFeedbackId reuse(BailoutId id) {
251 return TypeFeedbackId(id.ToInt()); 250 return TypeFeedbackId(id.ToInt());
252 } 251 }
253 252
254 253
255 private: 254 private:
256 // Hidden to prevent accidental usage. It would have to load the 255 // Hidden to prevent accidental usage. It would have to load the
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 class ForInStatement FINAL : public ForEachStatement { 933 class ForInStatement FINAL : public ForEachStatement {
935 public: 934 public:
936 DECLARE_NODE_TYPE(ForInStatement) 935 DECLARE_NODE_TYPE(ForInStatement)
937 936
938 Expression* enumerable() const { 937 Expression* enumerable() const {
939 return subject(); 938 return subject();
940 } 939 }
941 940
942 // Type feedback information. 941 // Type feedback information.
943 virtual int ComputeFeedbackSlotCount() { return 1; } 942 virtual int ComputeFeedbackSlotCount() { return 1; }
944 virtual void SetFirstFeedbackSlot(int slot) { for_in_feedback_slot_ = slot; } 943 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) {
944 for_in_feedback_slot_ = slot;
945 }
945 946
946 int ForInFeedbackSlot() { 947 FeedbackVectorSlot ForInFeedbackSlot() {
947 DCHECK(for_in_feedback_slot_ != kInvalidFeedbackSlot); 948 DCHECK(!for_in_feedback_slot_.IsInvalid());
948 return for_in_feedback_slot_; 949 return for_in_feedback_slot_;
949 } 950 }
950 951
951 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; 952 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN };
952 ForInType for_in_type() const { return for_in_type_; } 953 ForInType for_in_type() const { return for_in_type_; }
953 void set_for_in_type(ForInType type) { for_in_type_ = type; } 954 void set_for_in_type(ForInType type) { for_in_type_ = type; }
954 955
955 BailoutId BodyId() const { return body_id_; } 956 BailoutId BodyId() const { return body_id_; }
956 BailoutId PrepareId() const { return prepare_id_; } 957 BailoutId PrepareId() const { return prepare_id_; }
957 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); } 958 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); }
958 virtual BailoutId StackCheckId() const OVERRIDE { return body_id_; } 959 virtual BailoutId StackCheckId() const OVERRIDE { return body_id_; }
959 960
960 protected: 961 protected:
961 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, 962 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos,
962 IdGen* id_gen) 963 IdGen* id_gen)
963 : ForEachStatement(zone, labels, pos, id_gen), 964 : ForEachStatement(zone, labels, pos, id_gen),
964 for_in_type_(SLOW_FOR_IN), 965 for_in_type_(SLOW_FOR_IN),
965 for_in_feedback_slot_(kInvalidFeedbackSlot), 966 for_in_feedback_slot_(FeedbackVectorSlot::Invalid()),
966 body_id_(id_gen->GetNextId()), 967 body_id_(id_gen->GetNextId()),
967 prepare_id_(id_gen->GetNextId()) {} 968 prepare_id_(id_gen->GetNextId()) {}
968 969
969 ForInType for_in_type_; 970 ForInType for_in_type_;
970 int for_in_feedback_slot_; 971 FeedbackVectorSlot for_in_feedback_slot_;
971 const BailoutId body_id_; 972 const BailoutId body_id_;
972 const BailoutId prepare_id_; 973 const BailoutId prepare_id_;
973 }; 974 };
974 975
975 976
976 class ForOfStatement FINAL : public ForEachStatement { 977 class ForOfStatement FINAL : public ForEachStatement {
977 public: 978 public:
978 DECLARE_NODE_TYPE(ForOfStatement) 979 DECLARE_NODE_TYPE(ForOfStatement)
979 980
980 void Initialize(Expression* each, 981 void Initialize(Expression* each,
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 1666
1666 bool is_resolved() const { return is_resolved_; } 1667 bool is_resolved() const { return is_resolved_; }
1667 void set_is_resolved() { is_resolved_ = true; } 1668 void set_is_resolved() { is_resolved_ = true; }
1668 1669
1669 Interface* interface() const { return interface_; } 1670 Interface* interface() const { return interface_; }
1670 1671
1671 // Bind this proxy to the variable var. Interfaces must match. 1672 // Bind this proxy to the variable var. Interfaces must match.
1672 void BindTo(Variable* var); 1673 void BindTo(Variable* var);
1673 1674
1674 virtual int ComputeFeedbackSlotCount() { return FLAG_vector_ics ? 1 : 0; } 1675 virtual int ComputeFeedbackSlotCount() { return FLAG_vector_ics ? 1 : 0; }
1675 virtual void SetFirstFeedbackSlot(int slot) { 1676 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) {
1676 variable_feedback_slot_ = slot; 1677 variable_feedback_slot_ = slot;
1677 } 1678 }
1678 1679
1679 int VariableFeedbackSlot() { return variable_feedback_slot_; } 1680 FeedbackVectorSlot VariableFeedbackSlot() { return variable_feedback_slot_; }
1680 1681
1681 protected: 1682 protected:
1682 VariableProxy(Zone* zone, Variable* var, int position, IdGen* id_gen); 1683 VariableProxy(Zone* zone, Variable* var, int position, IdGen* id_gen);
1683 1684
1684 VariableProxy(Zone* zone, const AstRawString* name, bool is_this, 1685 VariableProxy(Zone* zone, const AstRawString* name, bool is_this,
1685 Interface* interface, int position, IdGen* id_gen); 1686 Interface* interface, int position, IdGen* id_gen);
1686 1687
1687 union { 1688 union {
1688 const AstRawString* raw_name_; // if !is_resolved_ 1689 const AstRawString* raw_name_; // if !is_resolved_
1689 Variable* var_; // if is_resolved_ 1690 Variable* var_; // if is_resolved_
1690 }; 1691 };
1691 Interface* interface_; 1692 Interface* interface_;
1692 int variable_feedback_slot_; 1693 FeedbackVectorSlot variable_feedback_slot_;
1693 bool is_this_ : 1; 1694 bool is_this_ : 1;
1694 bool is_assigned_ : 1; 1695 bool is_assigned_ : 1;
1695 bool is_resolved_ : 1; 1696 bool is_resolved_ : 1;
1696 }; 1697 };
1697 1698
1698 1699
1699 class Property FINAL : public Expression { 1700 class Property FINAL : public Expression {
1700 public: 1701 public:
1701 DECLARE_NODE_TYPE(Property) 1702 DECLARE_NODE_TYPE(Property)
1702 1703
(...skipping 25 matching lines...) Expand all
1728 void mark_for_call() { is_for_call_ = true; } 1729 void mark_for_call() { is_for_call_ = true; }
1729 bool IsForCall() { return is_for_call_; } 1730 bool IsForCall() { return is_for_call_; }
1730 1731
1731 bool IsSuperAccess() { 1732 bool IsSuperAccess() {
1732 return obj()->IsSuperReference(); 1733 return obj()->IsSuperReference();
1733 } 1734 }
1734 1735
1735 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } 1736 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); }
1736 1737
1737 virtual int ComputeFeedbackSlotCount() { return FLAG_vector_ics ? 1 : 0; } 1738 virtual int ComputeFeedbackSlotCount() { return FLAG_vector_ics ? 1 : 0; }
1738 virtual void SetFirstFeedbackSlot(int slot) { 1739 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) {
1739 property_feedback_slot_ = slot; 1740 property_feedback_slot_ = slot;
1740 } 1741 }
1741 1742
1742 int PropertyFeedbackSlot() const { return property_feedback_slot_; } 1743 FeedbackVectorSlot PropertyFeedbackSlot() const {
1744 return property_feedback_slot_;
1745 }
1743 1746
1744 protected: 1747 protected:
1745 Property(Zone* zone, Expression* obj, Expression* key, int pos, IdGen* id_gen) 1748 Property(Zone* zone, Expression* obj, Expression* key, int pos, IdGen* id_gen)
1746 : Expression(zone, pos, id_gen), 1749 : Expression(zone, pos, id_gen),
1747 obj_(obj), 1750 obj_(obj),
1748 key_(key), 1751 key_(key),
1749 load_id_(id_gen->GetNextId()), 1752 load_id_(id_gen->GetNextId()),
1750 property_feedback_slot_(kInvalidFeedbackSlot), 1753 property_feedback_slot_(FeedbackVectorSlot::Invalid()),
1751 is_for_call_(false), 1754 is_for_call_(false),
1752 is_uninitialized_(false), 1755 is_uninitialized_(false),
1753 is_string_access_(false) {} 1756 is_string_access_(false) {}
1754 1757
1755 private: 1758 private:
1756 Expression* obj_; 1759 Expression* obj_;
1757 Expression* key_; 1760 Expression* key_;
1758 const BailoutId load_id_; 1761 const BailoutId load_id_;
1759 int property_feedback_slot_; 1762 FeedbackVectorSlot property_feedback_slot_;
1760 1763
1761 SmallMapList receiver_types_; 1764 SmallMapList receiver_types_;
1762 bool is_for_call_ : 1; 1765 bool is_for_call_ : 1;
1763 bool is_uninitialized_ : 1; 1766 bool is_uninitialized_ : 1;
1764 bool is_string_access_ : 1; 1767 bool is_string_access_ : 1;
1765 }; 1768 };
1766 1769
1767 1770
1768 class Call FINAL : public Expression { 1771 class Call FINAL : public Expression {
1769 public: 1772 public:
1770 DECLARE_NODE_TYPE(Call) 1773 DECLARE_NODE_TYPE(Call)
1771 1774
1772 Expression* expression() const { return expression_; } 1775 Expression* expression() const { return expression_; }
1773 ZoneList<Expression*>* arguments() const { return arguments_; } 1776 ZoneList<Expression*>* arguments() const { return arguments_; }
1774 1777
1775 // Type feedback information. 1778 // Type feedback information.
1776 virtual int ComputeFeedbackSlotCount() { return 1; } 1779 virtual int ComputeFeedbackSlotCount() { return 1; }
1777 virtual void SetFirstFeedbackSlot(int slot) { 1780 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) {
1778 call_feedback_slot_ = slot; 1781 call_feedback_slot_ = slot;
1779 } 1782 }
1780 1783
1781 bool HasCallFeedbackSlot() const { 1784 bool HasCallFeedbackSlot() const { return !call_feedback_slot_.IsInvalid(); }
1782 return call_feedback_slot_ != kInvalidFeedbackSlot; 1785 FeedbackVectorSlot CallFeedbackSlot() const { return call_feedback_slot_; }
1783 }
1784 int CallFeedbackSlot() const { return call_feedback_slot_; }
1785 1786
1786 virtual SmallMapList* GetReceiverTypes() OVERRIDE { 1787 virtual SmallMapList* GetReceiverTypes() OVERRIDE {
1787 if (expression()->IsProperty()) { 1788 if (expression()->IsProperty()) {
1788 return expression()->AsProperty()->GetReceiverTypes(); 1789 return expression()->AsProperty()->GetReceiverTypes();
1789 } 1790 }
1790 return NULL; 1791 return NULL;
1791 } 1792 }
1792 1793
1793 virtual bool IsMonomorphic() OVERRIDE { 1794 virtual bool IsMonomorphic() OVERRIDE {
1794 if (expression()->IsProperty()) { 1795 if (expression()->IsProperty()) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 // Used to assert that the FullCodeGenerator records the return site. 1838 // Used to assert that the FullCodeGenerator records the return site.
1838 bool return_is_recorded_; 1839 bool return_is_recorded_;
1839 #endif 1840 #endif
1840 1841
1841 protected: 1842 protected:
1842 Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, 1843 Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments,
1843 int pos, IdGen* id_gen) 1844 int pos, IdGen* id_gen)
1844 : Expression(zone, pos, id_gen), 1845 : Expression(zone, pos, id_gen),
1845 expression_(expression), 1846 expression_(expression),
1846 arguments_(arguments), 1847 arguments_(arguments),
1847 call_feedback_slot_(kInvalidFeedbackSlot), 1848 call_feedback_slot_(FeedbackVectorSlot::Invalid()),
1848 return_id_(id_gen->GetNextId()), 1849 return_id_(id_gen->GetNextId()),
1849 eval_or_lookup_id_(id_gen->GetNextId()) { 1850 eval_or_lookup_id_(id_gen->GetNextId()) {
1850 if (expression->IsProperty()) { 1851 if (expression->IsProperty()) {
1851 expression->AsProperty()->mark_for_call(); 1852 expression->AsProperty()->mark_for_call();
1852 } 1853 }
1853 } 1854 }
1854 1855
1855 private: 1856 private:
1856 Expression* expression_; 1857 Expression* expression_;
1857 ZoneList<Expression*>* arguments_; 1858 ZoneList<Expression*>* arguments_;
1858 1859
1859 Handle<JSFunction> target_; 1860 Handle<JSFunction> target_;
1860 Handle<Cell> cell_; 1861 Handle<Cell> cell_;
1861 Handle<AllocationSite> allocation_site_; 1862 Handle<AllocationSite> allocation_site_;
1862 int call_feedback_slot_; 1863 FeedbackVectorSlot call_feedback_slot_;
1863 1864
1864 const BailoutId return_id_; 1865 const BailoutId return_id_;
1865 // TODO(jarin) Only allocate the bailout id for the POSSIBLY_EVAL_CALL and 1866 // TODO(jarin) Only allocate the bailout id for the POSSIBLY_EVAL_CALL and
1866 // LOOKUP_SLOT_CALL types. 1867 // LOOKUP_SLOT_CALL types.
1867 const BailoutId eval_or_lookup_id_; 1868 const BailoutId eval_or_lookup_id_;
1868 }; 1869 };
1869 1870
1870 1871
1871 class CallNew FINAL : public Expression { 1872 class CallNew FINAL : public Expression {
1872 public: 1873 public:
1873 DECLARE_NODE_TYPE(CallNew) 1874 DECLARE_NODE_TYPE(CallNew)
1874 1875
1875 Expression* expression() const { return expression_; } 1876 Expression* expression() const { return expression_; }
1876 ZoneList<Expression*>* arguments() const { return arguments_; } 1877 ZoneList<Expression*>* arguments() const { return arguments_; }
1877 1878
1878 // Type feedback information. 1879 // Type feedback information.
1879 virtual int ComputeFeedbackSlotCount() { 1880 virtual int ComputeFeedbackSlotCount() {
1880 return FLAG_pretenuring_call_new ? 2 : 1; 1881 return FLAG_pretenuring_call_new ? 2 : 1;
1881 } 1882 }
1882 virtual void SetFirstFeedbackSlot(int slot) { 1883 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) {
1883 callnew_feedback_slot_ = slot; 1884 callnew_feedback_slot_ = slot;
1884 } 1885 }
1885 1886
1886 int CallNewFeedbackSlot() { 1887 FeedbackVectorSlot CallNewFeedbackSlot() { return callnew_feedback_slot_; }
1887 DCHECK(callnew_feedback_slot_ != kInvalidFeedbackSlot); 1888 FeedbackVectorSlot AllocationSiteFeedbackSlot() {
1888 return callnew_feedback_slot_;
1889 }
1890 int AllocationSiteFeedbackSlot() {
1891 DCHECK(callnew_feedback_slot_ != kInvalidFeedbackSlot);
1892 DCHECK(FLAG_pretenuring_call_new); 1889 DCHECK(FLAG_pretenuring_call_new);
1893 return callnew_feedback_slot_ + 1; 1890 return CallNewFeedbackSlot().next();
1894 } 1891 }
1895 1892
1896 void RecordTypeFeedback(TypeFeedbackOracle* oracle); 1893 void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1897 virtual bool IsMonomorphic() OVERRIDE { return is_monomorphic_; } 1894 virtual bool IsMonomorphic() OVERRIDE { return is_monomorphic_; }
1898 Handle<JSFunction> target() const { return target_; } 1895 Handle<JSFunction> target() const { return target_; }
1899 Handle<AllocationSite> allocation_site() const { 1896 Handle<AllocationSite> allocation_site() const {
1900 return allocation_site_; 1897 return allocation_site_;
1901 } 1898 }
1902 1899
1903 static int feedback_slots() { return 1; } 1900 static int feedback_slots() { return 1; }
1904 1901
1905 BailoutId ReturnId() const { return return_id_; } 1902 BailoutId ReturnId() const { return return_id_; }
1906 1903
1907 protected: 1904 protected:
1908 CallNew(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, 1905 CallNew(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments,
1909 int pos, IdGen* id_gen) 1906 int pos, IdGen* id_gen)
1910 : Expression(zone, pos, id_gen), 1907 : Expression(zone, pos, id_gen),
1911 expression_(expression), 1908 expression_(expression),
1912 arguments_(arguments), 1909 arguments_(arguments),
1913 is_monomorphic_(false), 1910 is_monomorphic_(false),
1914 callnew_feedback_slot_(kInvalidFeedbackSlot), 1911 callnew_feedback_slot_(FeedbackVectorSlot::Invalid()),
1915 return_id_(id_gen->GetNextId()) {} 1912 return_id_(id_gen->GetNextId()) {}
1916 1913
1917 private: 1914 private:
1918 Expression* expression_; 1915 Expression* expression_;
1919 ZoneList<Expression*>* arguments_; 1916 ZoneList<Expression*>* arguments_;
1920 1917
1921 bool is_monomorphic_; 1918 bool is_monomorphic_;
1922 Handle<JSFunction> target_; 1919 Handle<JSFunction> target_;
1923 Handle<AllocationSite> allocation_site_; 1920 Handle<AllocationSite> allocation_site_;
1924 int callnew_feedback_slot_; 1921 FeedbackVectorSlot callnew_feedback_slot_;
1925 1922
1926 const BailoutId return_id_; 1923 const BailoutId return_id_;
1927 }; 1924 };
1928 1925
1929 1926
1930 // The CallRuntime class does not represent any official JavaScript 1927 // The CallRuntime class does not represent any official JavaScript
1931 // language construct. Instead it is used to call a C or JS function 1928 // language construct. Instead it is used to call a C or JS function
1932 // with a set of arguments. This is used from the builtins that are 1929 // with a set of arguments. This is used from the builtins that are
1933 // implemented in JavaScript (see "v8natives.js"). 1930 // implemented in JavaScript (see "v8natives.js").
1934 class CallRuntime FINAL : public Expression { 1931 class CallRuntime FINAL : public Expression {
1935 public: 1932 public:
1936 DECLARE_NODE_TYPE(CallRuntime) 1933 DECLARE_NODE_TYPE(CallRuntime)
1937 1934
1938 Handle<String> name() const { return raw_name_->string(); } 1935 Handle<String> name() const { return raw_name_->string(); }
1939 const AstRawString* raw_name() const { return raw_name_; } 1936 const AstRawString* raw_name() const { return raw_name_; }
1940 const Runtime::Function* function() const { return function_; } 1937 const Runtime::Function* function() const { return function_; }
1941 ZoneList<Expression*>* arguments() const { return arguments_; } 1938 ZoneList<Expression*>* arguments() const { return arguments_; }
1942 bool is_jsruntime() const { return function_ == NULL; } 1939 bool is_jsruntime() const { return function_ == NULL; }
1943 1940
1944 // Type feedback information. 1941 // Type feedback information.
1945 virtual int ComputeFeedbackSlotCount() { 1942 virtual int ComputeFeedbackSlotCount() {
1946 return (FLAG_vector_ics && is_jsruntime()) ? 1 : 0; 1943 return (FLAG_vector_ics && is_jsruntime()) ? 1 : 0;
1947 } 1944 }
1948 virtual void SetFirstFeedbackSlot(int slot) { 1945 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) {
1949 callruntime_feedback_slot_ = slot; 1946 callruntime_feedback_slot_ = slot;
1950 } 1947 }
1951 1948
1952 int CallRuntimeFeedbackSlot() { 1949 FeedbackVectorSlot CallRuntimeFeedbackSlot() {
1953 DCHECK(!is_jsruntime() ||
1954 callruntime_feedback_slot_ != kInvalidFeedbackSlot);
1955 return callruntime_feedback_slot_; 1950 return callruntime_feedback_slot_;
1956 } 1951 }
1957 1952
1958 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } 1953 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); }
1959 1954
1960 protected: 1955 protected:
1961 CallRuntime(Zone* zone, const AstRawString* name, 1956 CallRuntime(Zone* zone, const AstRawString* name,
1962 const Runtime::Function* function, 1957 const Runtime::Function* function,
1963 ZoneList<Expression*>* arguments, int pos, IdGen* id_gen) 1958 ZoneList<Expression*>* arguments, int pos, IdGen* id_gen)
1964 : Expression(zone, pos, id_gen), 1959 : Expression(zone, pos, id_gen),
1965 raw_name_(name), 1960 raw_name_(name),
1966 function_(function), 1961 function_(function),
1967 arguments_(arguments) {} 1962 arguments_(arguments),
1963 callruntime_feedback_slot_(FeedbackVectorSlot::Invalid()) {}
1968 1964
1969 private: 1965 private:
1970 const AstRawString* raw_name_; 1966 const AstRawString* raw_name_;
1971 const Runtime::Function* function_; 1967 const Runtime::Function* function_;
1972 ZoneList<Expression*>* arguments_; 1968 ZoneList<Expression*>* arguments_;
1973 int callruntime_feedback_slot_; 1969 FeedbackVectorSlot callruntime_feedback_slot_;
1974 }; 1970 };
1975 1971
1976 1972
1977 class UnaryOperation FINAL : public Expression { 1973 class UnaryOperation FINAL : public Expression {
1978 public: 1974 public:
1979 DECLARE_NODE_TYPE(UnaryOperation) 1975 DECLARE_NODE_TYPE(UnaryOperation)
1980 1976
1981 Token::Value op() const { return op_; } 1977 Token::Value op() const { return op_; }
1982 Expression* expression() const { return expression_; } 1978 Expression* expression() const { return expression_; }
1983 1979
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
2271 } 2267 }
2272 void set_index(int index) { 2268 void set_index(int index) {
2273 DCHECK_EQ(kDelegating, yield_kind()); 2269 DCHECK_EQ(kDelegating, yield_kind());
2274 index_ = index; 2270 index_ = index;
2275 } 2271 }
2276 2272
2277 // Type feedback information. 2273 // Type feedback information.
2278 virtual int ComputeFeedbackSlotCount() { 2274 virtual int ComputeFeedbackSlotCount() {
2279 return (FLAG_vector_ics && yield_kind() == kDelegating) ? 3 : 0; 2275 return (FLAG_vector_ics && yield_kind() == kDelegating) ? 3 : 0;
2280 } 2276 }
2281 virtual void SetFirstFeedbackSlot(int slot) { 2277 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) {
2282 yield_first_feedback_slot_ = slot; 2278 yield_first_feedback_slot_ = slot;
2283 } 2279 }
2284 2280
2285 int KeyedLoadFeedbackSlot() { 2281 FeedbackVectorSlot KeyedLoadFeedbackSlot() {
2286 DCHECK(yield_first_feedback_slot_ != kInvalidFeedbackSlot);
2287 return yield_first_feedback_slot_; 2282 return yield_first_feedback_slot_;
2288 } 2283 }
2289 2284
2290 int DoneFeedbackSlot() { 2285 FeedbackVectorSlot DoneFeedbackSlot() {
2291 DCHECK(yield_first_feedback_slot_ != kInvalidFeedbackSlot); 2286 return KeyedLoadFeedbackSlot().next();
2292 return yield_first_feedback_slot_ + 1;
2293 } 2287 }
2294 2288
2295 int ValueFeedbackSlot() { 2289 FeedbackVectorSlot ValueFeedbackSlot() { return DoneFeedbackSlot().next(); }
2296 DCHECK(yield_first_feedback_slot_ != kInvalidFeedbackSlot);
2297 return yield_first_feedback_slot_ + 2;
2298 }
2299 2290
2300 protected: 2291 protected:
2301 Yield(Zone* zone, Expression* generator_object, Expression* expression, 2292 Yield(Zone* zone, Expression* generator_object, Expression* expression,
2302 Kind yield_kind, int pos, IdGen* id_gen) 2293 Kind yield_kind, int pos, IdGen* id_gen)
2303 : Expression(zone, pos, id_gen), 2294 : Expression(zone, pos, id_gen),
2304 generator_object_(generator_object), 2295 generator_object_(generator_object),
2305 expression_(expression), 2296 expression_(expression),
2306 yield_kind_(yield_kind), 2297 yield_kind_(yield_kind),
2307 index_(-1), 2298 index_(-1),
2308 yield_first_feedback_slot_(kInvalidFeedbackSlot) {} 2299 yield_first_feedback_slot_(FeedbackVectorSlot::Invalid()) {}
2309 2300
2310 private: 2301 private:
2311 Expression* generator_object_; 2302 Expression* generator_object_;
2312 Expression* expression_; 2303 Expression* expression_;
2313 Kind yield_kind_; 2304 Kind yield_kind_;
2314 int index_; 2305 int index_;
2315 int yield_first_feedback_slot_; 2306 FeedbackVectorSlot yield_first_feedback_slot_;
2316 }; 2307 };
2317 2308
2318 2309
2319 class Throw FINAL : public Expression { 2310 class Throw FINAL : public Expression {
2320 public: 2311 public:
2321 DECLARE_NODE_TYPE(Throw) 2312 DECLARE_NODE_TYPE(Throw)
2322 2313
2323 Expression* exception() const { return exception_; } 2314 Expression* exception() const { return exception_; }
2324 2315
2325 protected: 2316 protected:
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
2592 class SuperReference FINAL : public Expression { 2583 class SuperReference FINAL : public Expression {
2593 public: 2584 public:
2594 DECLARE_NODE_TYPE(SuperReference) 2585 DECLARE_NODE_TYPE(SuperReference)
2595 2586
2596 VariableProxy* this_var() const { return this_var_; } 2587 VariableProxy* this_var() const { return this_var_; }
2597 2588
2598 TypeFeedbackId HomeObjectFeedbackId() { return reuse(id()); } 2589 TypeFeedbackId HomeObjectFeedbackId() { return reuse(id()); }
2599 2590
2600 // Type feedback information. 2591 // Type feedback information.
2601 virtual int ComputeFeedbackSlotCount() { return FLAG_vector_ics ? 1 : 0; } 2592 virtual int ComputeFeedbackSlotCount() { return FLAG_vector_ics ? 1 : 0; }
2602 virtual void SetFirstFeedbackSlot(int slot) { 2593 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) {
2603 homeobject_feedback_slot_ = slot; 2594 homeobject_feedback_slot_ = slot;
2604 } 2595 }
2605 2596
2606 int HomeObjectFeedbackSlot() { 2597 FeedbackVectorSlot HomeObjectFeedbackSlot() {
2607 DCHECK(!FLAG_vector_ics || 2598 DCHECK(!FLAG_vector_ics || !homeobject_feedback_slot_.IsInvalid());
2608 homeobject_feedback_slot_ != kInvalidFeedbackSlot);
2609 return homeobject_feedback_slot_; 2599 return homeobject_feedback_slot_;
2610 } 2600 }
2611 2601
2612 protected: 2602 protected:
2613 SuperReference(Zone* zone, VariableProxy* this_var, int pos, IdGen* id_gen) 2603 SuperReference(Zone* zone, VariableProxy* this_var, int pos, IdGen* id_gen)
2614 : Expression(zone, pos, id_gen), 2604 : Expression(zone, pos, id_gen),
2615 this_var_(this_var), 2605 this_var_(this_var),
2616 homeobject_feedback_slot_(kInvalidFeedbackSlot) { 2606 homeobject_feedback_slot_(FeedbackVectorSlot::Invalid()) {
2617 DCHECK(this_var->is_this()); 2607 DCHECK(this_var->is_this());
2618 } 2608 }
2619 2609
2620 VariableProxy* this_var_; 2610 VariableProxy* this_var_;
2621 int homeobject_feedback_slot_; 2611 FeedbackVectorSlot homeobject_feedback_slot_;
2622 }; 2612 };
2623 2613
2624 2614
2625 #undef DECLARE_NODE_TYPE 2615 #undef DECLARE_NODE_TYPE
2626 2616
2627 2617
2628 // ---------------------------------------------------------------------------- 2618 // ----------------------------------------------------------------------------
2629 // Regular expressions 2619 // Regular expressions
2630 2620
2631 2621
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
3077 void set_dont_crankshaft_reason(BailoutReason reason) { 3067 void set_dont_crankshaft_reason(BailoutReason reason) {
3078 dont_crankshaft_reason_ = reason; 3068 dont_crankshaft_reason_ = reason;
3079 } 3069 }
3080 void set_dont_turbofan_reason(BailoutReason reason) { 3070 void set_dont_turbofan_reason(BailoutReason reason) {
3081 dont_turbofan_reason_ = reason; 3071 dont_turbofan_reason_ = reason;
3082 } 3072 }
3083 3073
3084 void add_slot_node(AstNode* slot_node) { 3074 void add_slot_node(AstNode* slot_node) {
3085 int count = slot_node->ComputeFeedbackSlotCount(); 3075 int count = slot_node->ComputeFeedbackSlotCount();
3086 if (count > 0) { 3076 if (count > 0) {
3087 slot_node->SetFirstFeedbackSlot(properties_.feedback_slots()); 3077 slot_node->SetFirstFeedbackSlot(
3078 FeedbackVectorSlot(properties_.feedback_slots()));
3088 properties_.increase_feedback_slots(count); 3079 properties_.increase_feedback_slots(count);
3089 } 3080 }
3090 } 3081 }
3091 3082
3092 AstProperties properties_; 3083 AstProperties properties_;
3093 BailoutReason dont_crankshaft_reason_; 3084 BailoutReason dont_crankshaft_reason_;
3094 BailoutReason dont_turbofan_reason_; 3085 BailoutReason dont_turbofan_reason_;
3095 }; 3086 };
3096 3087
3097 3088
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
3588 Zone* zone_; 3579 Zone* zone_;
3589 Visitor visitor_; 3580 Visitor visitor_;
3590 AstValueFactory* ast_value_factory_; 3581 AstValueFactory* ast_value_factory_;
3591 AstNode::IdGen* id_gen_; 3582 AstNode::IdGen* id_gen_;
3592 }; 3583 };
3593 3584
3594 3585
3595 } } // namespace v8::internal 3586 } } // namespace v8::internal
3596 3587
3597 #endif // V8_AST_H_ 3588 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698