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

Side by Side Diff: src/ast.h

Issue 1001533002: Vector-ICs: Implement slot sharing for global loads. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@vector-christmas
Patch Set: REBASE. Created 5 years, 9 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
« no previous file with comments | « no previous file | 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 158
159 int slots() const { return slots_; } 159 int slots() const { return slots_; }
160 int ic_slots() const { return ic_slots_; } 160 int ic_slots() const { return ic_slots_; }
161 161
162 private: 162 private:
163 int slots_; 163 int slots_;
164 int ic_slots_; 164 int ic_slots_;
165 }; 165 };
166 166
167 167
168 class VariableICSlotPair FINAL {
169 public:
170 VariableICSlotPair(Variable* variable, FeedbackVectorICSlot slot)
171 : variable_(variable), slot_(slot) {}
172 VariableICSlotPair()
173 : variable_(NULL), slot_(FeedbackVectorICSlot::Invalid()) {}
174
175 Variable* variable() const { return variable_; }
176 FeedbackVectorICSlot slot() const { return slot_; }
177
178 private:
179 Variable* variable_;
180 FeedbackVectorICSlot slot_;
181 };
182
183
184 typedef List<VariableICSlotPair> ICSlotCache;
185
186
168 class AstProperties FINAL BASE_EMBEDDED { 187 class AstProperties FINAL BASE_EMBEDDED {
169 public: 188 public:
170 class Flags : public EnumSet<AstPropertiesFlag, int> {}; 189 class Flags : public EnumSet<AstPropertiesFlag, int> {};
171 190
172 AstProperties() : node_count_(0) {} 191 AstProperties() : node_count_(0) {}
173 192
174 Flags* flags() { return &flags_; } 193 Flags* flags() { return &flags_; }
175 int node_count() { return node_count_; } 194 int node_count() { return node_count_; }
176 void add_node_count(int count) { node_count_ += count; } 195 void add_node_count(int count) { node_count_ += count; }
177 196
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 241
223 virtual BreakableStatement* AsBreakableStatement() { return NULL; } 242 virtual BreakableStatement* AsBreakableStatement() { return NULL; }
224 virtual IterationStatement* AsIterationStatement() { return NULL; } 243 virtual IterationStatement* AsIterationStatement() { return NULL; }
225 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } 244 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; }
226 245
227 // The interface for feedback slots, with default no-op implementations for 246 // The interface for feedback slots, with default no-op implementations for
228 // node types which don't actually have this. Note that this is conceptually 247 // node types which don't actually have this. Note that this is conceptually
229 // not really nice, but multiple inheritance would introduce yet another 248 // not really nice, but multiple inheritance would introduce yet another
230 // vtable entry per node, something we don't want for space reasons. 249 // vtable entry per node, something we don't want for space reasons.
231 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 250 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
232 Isolate* isolate) { 251 Isolate* isolate, const ICSlotCache* cache) {
233 return FeedbackVectorRequirements(0, 0); 252 return FeedbackVectorRequirements(0, 0);
234 } 253 }
235 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) { UNREACHABLE(); } 254 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) { UNREACHABLE(); }
236 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) { 255 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
256 ICSlotCache* cache) {
237 UNREACHABLE(); 257 UNREACHABLE();
238 } 258 }
239 // Each ICSlot stores a kind of IC which the participating node should know. 259 // Each ICSlot stores a kind of IC which the participating node should know.
240 virtual Code::Kind FeedbackICSlotKind(int index) { 260 virtual Code::Kind FeedbackICSlotKind(int index) {
241 UNREACHABLE(); 261 UNREACHABLE();
242 return Code::NUMBER_OF_KINDS; 262 return Code::NUMBER_OF_KINDS;
243 } 263 }
244 264
245 private: 265 private:
246 // Hidden to prevent accidental usage. It would have to load the 266 // Hidden to prevent accidental usage. It would have to load the
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 class ForInStatement FINAL : public ForEachStatement { 897 class ForInStatement FINAL : public ForEachStatement {
878 public: 898 public:
879 DECLARE_NODE_TYPE(ForInStatement) 899 DECLARE_NODE_TYPE(ForInStatement)
880 900
881 Expression* enumerable() const { 901 Expression* enumerable() const {
882 return subject(); 902 return subject();
883 } 903 }
884 904
885 // Type feedback information. 905 // Type feedback information.
886 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 906 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
887 Isolate* isolate) OVERRIDE { 907 Isolate* isolate, const ICSlotCache* cache) OVERRIDE {
888 return FeedbackVectorRequirements(1, 0); 908 return FeedbackVectorRequirements(1, 0);
889 } 909 }
890 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE { 910 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE {
891 for_in_feedback_slot_ = slot; 911 for_in_feedback_slot_ = slot;
892 } 912 }
893 913
894 FeedbackVectorSlot ForInFeedbackSlot() { 914 FeedbackVectorSlot ForInFeedbackSlot() {
895 DCHECK(!for_in_feedback_slot_.IsInvalid()); 915 DCHECK(!for_in_feedback_slot_.IsInvalid());
896 return for_in_feedback_slot_; 916 return for_in_feedback_slot_;
897 } 917 }
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 int end_position() const { return end_position_; } 1659 int end_position() const { return end_position_; }
1640 1660
1641 // Bind this proxy to the variable var. 1661 // Bind this proxy to the variable var.
1642 void BindTo(Variable* var); 1662 void BindTo(Variable* var);
1643 1663
1644 bool UsesVariableFeedbackSlot() const { 1664 bool UsesVariableFeedbackSlot() const {
1645 return FLAG_vector_ics && (var()->IsUnallocated() || var()->IsLookupSlot()); 1665 return FLAG_vector_ics && (var()->IsUnallocated() || var()->IsLookupSlot());
1646 } 1666 }
1647 1667
1648 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 1668 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
1649 Isolate* isolate) OVERRIDE { 1669 Isolate* isolate, const ICSlotCache* cache) OVERRIDE;
1650 return FeedbackVectorRequirements(0, UsesVariableFeedbackSlot() ? 1 : 0);
1651 }
1652 1670
1653 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 1671 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
1654 variable_feedback_slot_ = slot; 1672 ICSlotCache* cache) OVERRIDE;
1655 }
1656 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; } 1673 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; }
1657 FeedbackVectorICSlot VariableFeedbackSlot() { 1674 FeedbackVectorICSlot VariableFeedbackSlot() {
1658 DCHECK(!UsesVariableFeedbackSlot() || !variable_feedback_slot_.IsInvalid()); 1675 DCHECK(!UsesVariableFeedbackSlot() || !variable_feedback_slot_.IsInvalid());
1659 return variable_feedback_slot_; 1676 return variable_feedback_slot_;
1660 } 1677 }
1661 1678
1662 protected: 1679 protected:
1663 VariableProxy(Zone* zone, Variable* var, int start_position, 1680 VariableProxy(Zone* zone, Variable* var, int start_position,
1664 int end_position); 1681 int end_position);
1665 1682
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 void mark_for_call() { 1744 void mark_for_call() {
1728 bit_field_ = IsForCallField::update(bit_field_, true); 1745 bit_field_ = IsForCallField::update(bit_field_, true);
1729 } 1746 }
1730 bool is_for_call() const { return IsForCallField::decode(bit_field_); } 1747 bool is_for_call() const { return IsForCallField::decode(bit_field_); }
1731 1748
1732 bool IsSuperAccess() { 1749 bool IsSuperAccess() {
1733 return obj()->IsSuperReference(); 1750 return obj()->IsSuperReference();
1734 } 1751 }
1735 1752
1736 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 1753 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
1737 Isolate* isolate) OVERRIDE { 1754 Isolate* isolate, const ICSlotCache* cache) OVERRIDE {
1738 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); 1755 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0);
1739 } 1756 }
1740 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 1757 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
1758 ICSlotCache* cache) OVERRIDE {
1741 property_feedback_slot_ = slot; 1759 property_feedback_slot_ = slot;
1742 } 1760 }
1743 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { 1761 Code::Kind FeedbackICSlotKind(int index) OVERRIDE {
1744 return key()->IsPropertyName() ? Code::LOAD_IC : Code::KEYED_LOAD_IC; 1762 return key()->IsPropertyName() ? Code::LOAD_IC : Code::KEYED_LOAD_IC;
1745 } 1763 }
1746 1764
1747 FeedbackVectorICSlot PropertyFeedbackSlot() const { 1765 FeedbackVectorICSlot PropertyFeedbackSlot() const {
1748 DCHECK(!FLAG_vector_ics || !property_feedback_slot_.IsInvalid()); 1766 DCHECK(!FLAG_vector_ics || !property_feedback_slot_.IsInvalid());
1749 return property_feedback_slot_; 1767 return property_feedback_slot_;
1750 } 1768 }
(...skipping 26 matching lines...) Expand all
1777 1795
1778 class Call FINAL : public Expression { 1796 class Call FINAL : public Expression {
1779 public: 1797 public:
1780 DECLARE_NODE_TYPE(Call) 1798 DECLARE_NODE_TYPE(Call)
1781 1799
1782 Expression* expression() const { return expression_; } 1800 Expression* expression() const { return expression_; }
1783 ZoneList<Expression*>* arguments() const { return arguments_; } 1801 ZoneList<Expression*>* arguments() const { return arguments_; }
1784 1802
1785 // Type feedback information. 1803 // Type feedback information.
1786 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 1804 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
1787 Isolate* isolate) OVERRIDE; 1805 Isolate* isolate, const ICSlotCache* cache) OVERRIDE;
1788 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 1806 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
1807 ICSlotCache* cache) OVERRIDE {
1789 ic_slot_or_slot_ = slot.ToInt(); 1808 ic_slot_or_slot_ = slot.ToInt();
1790 } 1809 }
1791 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE { 1810 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE {
1792 ic_slot_or_slot_ = slot.ToInt(); 1811 ic_slot_or_slot_ = slot.ToInt();
1793 } 1812 }
1794 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::CALL_IC; } 1813 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::CALL_IC; }
1795 1814
1796 FeedbackVectorSlot CallFeedbackSlot() const { 1815 FeedbackVectorSlot CallFeedbackSlot() const {
1797 DCHECK(ic_slot_or_slot_ != FeedbackVectorSlot::Invalid().ToInt()); 1816 DCHECK(ic_slot_or_slot_ != FeedbackVectorSlot::Invalid().ToInt());
1798 return FeedbackVectorSlot(ic_slot_or_slot_); 1817 return FeedbackVectorSlot(ic_slot_or_slot_);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1900 1919
1901 class CallNew FINAL : public Expression { 1920 class CallNew FINAL : public Expression {
1902 public: 1921 public:
1903 DECLARE_NODE_TYPE(CallNew) 1922 DECLARE_NODE_TYPE(CallNew)
1904 1923
1905 Expression* expression() const { return expression_; } 1924 Expression* expression() const { return expression_; }
1906 ZoneList<Expression*>* arguments() const { return arguments_; } 1925 ZoneList<Expression*>* arguments() const { return arguments_; }
1907 1926
1908 // Type feedback information. 1927 // Type feedback information.
1909 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 1928 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
1910 Isolate* isolate) OVERRIDE { 1929 Isolate* isolate, const ICSlotCache* cache) OVERRIDE {
1911 return FeedbackVectorRequirements(FLAG_pretenuring_call_new ? 2 : 1, 0); 1930 return FeedbackVectorRequirements(FLAG_pretenuring_call_new ? 2 : 1, 0);
1912 } 1931 }
1913 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE { 1932 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE {
1914 callnew_feedback_slot_ = slot; 1933 callnew_feedback_slot_ = slot;
1915 } 1934 }
1916 1935
1917 FeedbackVectorSlot CallNewFeedbackSlot() { 1936 FeedbackVectorSlot CallNewFeedbackSlot() {
1918 DCHECK(!callnew_feedback_slot_.IsInvalid()); 1937 DCHECK(!callnew_feedback_slot_.IsInvalid());
1919 return callnew_feedback_slot_; 1938 return callnew_feedback_slot_;
1920 } 1939 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 const AstRawString* raw_name() const { return raw_name_; } 1993 const AstRawString* raw_name() const { return raw_name_; }
1975 const Runtime::Function* function() const { return function_; } 1994 const Runtime::Function* function() const { return function_; }
1976 ZoneList<Expression*>* arguments() const { return arguments_; } 1995 ZoneList<Expression*>* arguments() const { return arguments_; }
1977 bool is_jsruntime() const { return function_ == NULL; } 1996 bool is_jsruntime() const { return function_ == NULL; }
1978 1997
1979 // Type feedback information. 1998 // Type feedback information.
1980 bool HasCallRuntimeFeedbackSlot() const { 1999 bool HasCallRuntimeFeedbackSlot() const {
1981 return FLAG_vector_ics && is_jsruntime(); 2000 return FLAG_vector_ics && is_jsruntime();
1982 } 2001 }
1983 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 2002 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
1984 Isolate* isolate) OVERRIDE { 2003 Isolate* isolate, const ICSlotCache* cache) OVERRIDE {
1985 return FeedbackVectorRequirements(0, HasCallRuntimeFeedbackSlot() ? 1 : 0); 2004 return FeedbackVectorRequirements(0, HasCallRuntimeFeedbackSlot() ? 1 : 0);
1986 } 2005 }
1987 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 2006 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
2007 ICSlotCache* cache) OVERRIDE {
1988 callruntime_feedback_slot_ = slot; 2008 callruntime_feedback_slot_ = slot;
1989 } 2009 }
1990 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; } 2010 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; }
1991 2011
1992 FeedbackVectorICSlot CallRuntimeFeedbackSlot() { 2012 FeedbackVectorICSlot CallRuntimeFeedbackSlot() {
1993 DCHECK(!HasCallRuntimeFeedbackSlot() || 2013 DCHECK(!HasCallRuntimeFeedbackSlot() ||
1994 !callruntime_feedback_slot_.IsInvalid()); 2014 !callruntime_feedback_slot_.IsInvalid());
1995 return callruntime_feedback_slot_; 2015 return callruntime_feedback_slot_;
1996 } 2016 }
1997 2017
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
2347 void set_index(int index) { 2367 void set_index(int index) {
2348 DCHECK_EQ(kDelegating, yield_kind()); 2368 DCHECK_EQ(kDelegating, yield_kind());
2349 index_ = index; 2369 index_ = index;
2350 } 2370 }
2351 2371
2352 // Type feedback information. 2372 // Type feedback information.
2353 bool HasFeedbackSlots() const { 2373 bool HasFeedbackSlots() const {
2354 return FLAG_vector_ics && (yield_kind() == kDelegating); 2374 return FLAG_vector_ics && (yield_kind() == kDelegating);
2355 } 2375 }
2356 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 2376 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
2357 Isolate* isolate) OVERRIDE { 2377 Isolate* isolate, const ICSlotCache* cache) OVERRIDE {
2358 return FeedbackVectorRequirements(0, HasFeedbackSlots() ? 3 : 0); 2378 return FeedbackVectorRequirements(0, HasFeedbackSlots() ? 3 : 0);
2359 } 2379 }
2360 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 2380 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
2381 ICSlotCache* cache) OVERRIDE {
2361 yield_first_feedback_slot_ = slot; 2382 yield_first_feedback_slot_ = slot;
2362 } 2383 }
2363 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { 2384 Code::Kind FeedbackICSlotKind(int index) OVERRIDE {
2364 return index == 0 ? Code::KEYED_LOAD_IC : Code::LOAD_IC; 2385 return index == 0 ? Code::KEYED_LOAD_IC : Code::LOAD_IC;
2365 } 2386 }
2366 2387
2367 FeedbackVectorICSlot KeyedLoadFeedbackSlot() { 2388 FeedbackVectorICSlot KeyedLoadFeedbackSlot() {
2368 DCHECK(!HasFeedbackSlots() || !yield_first_feedback_slot_.IsInvalid()); 2389 DCHECK(!HasFeedbackSlots() || !yield_first_feedback_slot_.IsInvalid());
2369 return yield_first_feedback_slot_; 2390 return yield_first_feedback_slot_;
2370 } 2391 }
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
2688 public: 2709 public:
2689 DECLARE_NODE_TYPE(SuperReference) 2710 DECLARE_NODE_TYPE(SuperReference)
2690 2711
2691 VariableProxy* this_var() const { return this_var_; } 2712 VariableProxy* this_var() const { return this_var_; }
2692 2713
2693 static int num_ids() { return parent_num_ids() + 1; } 2714 static int num_ids() { return parent_num_ids() + 1; }
2694 TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); } 2715 TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); }
2695 2716
2696 // Type feedback information. 2717 // Type feedback information.
2697 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 2718 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
2698 Isolate* isolate) OVERRIDE { 2719 Isolate* isolate, const ICSlotCache* cache) OVERRIDE {
2699 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); 2720 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0);
2700 } 2721 }
2701 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 2722 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
2723 ICSlotCache* cache) OVERRIDE {
2702 homeobject_feedback_slot_ = slot; 2724 homeobject_feedback_slot_ = slot;
2703 } 2725 }
2704 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; } 2726 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; }
2705 2727
2706 FeedbackVectorICSlot HomeObjectFeedbackSlot() { 2728 FeedbackVectorICSlot HomeObjectFeedbackSlot() {
2707 DCHECK(!FLAG_vector_ics || !homeobject_feedback_slot_.IsInvalid()); 2729 DCHECK(!FLAG_vector_ics || !homeobject_feedback_slot_.IsInvalid());
2708 return homeobject_feedback_slot_; 2730 return homeobject_feedback_slot_;
2709 } 2731 }
2710 2732
2711 protected: 2733 protected:
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
3509 3531
3510 private: 3532 private:
3511 Zone* zone_; 3533 Zone* zone_;
3512 AstValueFactory* ast_value_factory_; 3534 AstValueFactory* ast_value_factory_;
3513 }; 3535 };
3514 3536
3515 3537
3516 } } // namespace v8::internal 3538 } } // namespace v8::internal
3517 3539
3518 #endif // V8_AST_H_ 3540 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698