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

Side by Side Diff: src/ast.h

Issue 670953003: Move feedback slot allocation to post-pass (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased patch Created 6 years, 1 month 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 | « 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 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 void BindTo(Variable* var); 1698 void BindTo(Variable* var);
1699 1699
1700 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { 1700 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE {
1701 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); 1701 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0);
1702 } 1702 }
1703 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 1703 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
1704 variable_feedback_slot_ = slot; 1704 variable_feedback_slot_ = slot;
1705 } 1705 }
1706 1706
1707 FeedbackVectorICSlot VariableFeedbackSlot() { 1707 FeedbackVectorICSlot VariableFeedbackSlot() {
1708 DCHECK(!FLAG_vector_ics || !variable_feedback_slot_.IsInvalid());
1708 return variable_feedback_slot_; 1709 return variable_feedback_slot_;
1709 } 1710 }
1710 1711
1711 protected: 1712 protected:
1712 VariableProxy(Zone* zone, Variable* var, int position); 1713 VariableProxy(Zone* zone, Variable* var, int position);
1713 1714
1714 VariableProxy(Zone* zone, const AstRawString* name, bool is_this, 1715 VariableProxy(Zone* zone, const AstRawString* name, bool is_this,
1715 Interface* interface, int position); 1716 Interface* interface, int position);
1716 1717
1717 class IsThisField : public BitField8<bool, 0, 1> {}; 1718 class IsThisField : public BitField8<bool, 0, 1> {};
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 } 1784 }
1784 1785
1785 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { 1786 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE {
1786 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); 1787 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0);
1787 } 1788 }
1788 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 1789 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
1789 property_feedback_slot_ = slot; 1790 property_feedback_slot_ = slot;
1790 } 1791 }
1791 1792
1792 FeedbackVectorICSlot PropertyFeedbackSlot() const { 1793 FeedbackVectorICSlot PropertyFeedbackSlot() const {
1794 DCHECK(!FLAG_vector_ics || !property_feedback_slot_.IsInvalid());
1793 return property_feedback_slot_; 1795 return property_feedback_slot_;
1794 } 1796 }
1795 1797
1796 protected: 1798 protected:
1797 Property(Zone* zone, Expression* obj, Expression* key, int pos) 1799 Property(Zone* zone, Expression* obj, Expression* key, int pos)
1798 : Expression(zone, pos), 1800 : Expression(zone, pos),
1799 bit_field_(IsForCallField::encode(false) | 1801 bit_field_(IsForCallField::encode(false) |
1800 IsUninitializedField::encode(false) | 1802 IsUninitializedField::encode(false) |
1801 IsStringAccessField::encode(false)), 1803 IsStringAccessField::encode(false)),
1802 property_feedback_slot_(FeedbackVectorICSlot::Invalid()), 1804 property_feedback_slot_(FeedbackVectorICSlot::Invalid()),
(...skipping 24 matching lines...) Expand all
1827 1829
1828 // Type feedback information. 1830 // Type feedback information.
1829 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { 1831 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE {
1830 return FeedbackVectorRequirements(0, 1); 1832 return FeedbackVectorRequirements(0, 1);
1831 } 1833 }
1832 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 1834 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
1833 call_feedback_slot_ = slot; 1835 call_feedback_slot_ = slot;
1834 } 1836 }
1835 1837
1836 bool HasCallFeedbackSlot() const { return !call_feedback_slot_.IsInvalid(); } 1838 bool HasCallFeedbackSlot() const { return !call_feedback_slot_.IsInvalid(); }
1837 FeedbackVectorICSlot CallFeedbackSlot() const { return call_feedback_slot_; } 1839 FeedbackVectorICSlot CallFeedbackSlot() const {
1840 DCHECK(!call_feedback_slot_.IsInvalid());
1841 return call_feedback_slot_;
1842 }
1838 1843
1839 virtual SmallMapList* GetReceiverTypes() OVERRIDE { 1844 virtual SmallMapList* GetReceiverTypes() OVERRIDE {
1840 if (expression()->IsProperty()) { 1845 if (expression()->IsProperty()) {
1841 return expression()->AsProperty()->GetReceiverTypes(); 1846 return expression()->AsProperty()->GetReceiverTypes();
1842 } 1847 }
1843 return NULL; 1848 return NULL;
1844 } 1849 }
1845 1850
1846 virtual bool IsMonomorphic() OVERRIDE { 1851 virtual bool IsMonomorphic() OVERRIDE {
1847 if (expression()->IsProperty()) { 1852 if (expression()->IsProperty()) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1926 ZoneList<Expression*>* arguments() const { return arguments_; } 1931 ZoneList<Expression*>* arguments() const { return arguments_; }
1927 1932
1928 // Type feedback information. 1933 // Type feedback information.
1929 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { 1934 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE {
1930 return FeedbackVectorRequirements(FLAG_pretenuring_call_new ? 2 : 1, 0); 1935 return FeedbackVectorRequirements(FLAG_pretenuring_call_new ? 2 : 1, 0);
1931 } 1936 }
1932 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE { 1937 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE {
1933 callnew_feedback_slot_ = slot; 1938 callnew_feedback_slot_ = slot;
1934 } 1939 }
1935 1940
1936 FeedbackVectorSlot CallNewFeedbackSlot() { return callnew_feedback_slot_; } 1941 FeedbackVectorSlot CallNewFeedbackSlot() {
1942 DCHECK(!callnew_feedback_slot_.IsInvalid());
1943 return callnew_feedback_slot_;
1944 }
1937 FeedbackVectorSlot AllocationSiteFeedbackSlot() { 1945 FeedbackVectorSlot AllocationSiteFeedbackSlot() {
1938 DCHECK(FLAG_pretenuring_call_new); 1946 DCHECK(FLAG_pretenuring_call_new);
1939 return CallNewFeedbackSlot().next(); 1947 return CallNewFeedbackSlot().next();
1940 } 1948 }
1941 1949
1942 void RecordTypeFeedback(TypeFeedbackOracle* oracle); 1950 void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1943 virtual bool IsMonomorphic() OVERRIDE { return is_monomorphic_; } 1951 virtual bool IsMonomorphic() OVERRIDE { return is_monomorphic_; }
1944 Handle<JSFunction> target() const { return target_; } 1952 Handle<JSFunction> target() const { return target_; }
1945 Handle<AllocationSite> allocation_site() const { 1953 Handle<AllocationSite> allocation_site() const {
1946 return allocation_site_; 1954 return allocation_site_;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 // Type feedback information. 1998 // Type feedback information.
1991 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { 1999 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE {
1992 return FeedbackVectorRequirements( 2000 return FeedbackVectorRequirements(
1993 0, (FLAG_vector_ics && is_jsruntime()) ? 1 : 0); 2001 0, (FLAG_vector_ics && is_jsruntime()) ? 1 : 0);
1994 } 2002 }
1995 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 2003 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
1996 callruntime_feedback_slot_ = slot; 2004 callruntime_feedback_slot_ = slot;
1997 } 2005 }
1998 2006
1999 FeedbackVectorICSlot CallRuntimeFeedbackSlot() { 2007 FeedbackVectorICSlot CallRuntimeFeedbackSlot() {
2008 DCHECK(!(FLAG_vector_ics && is_jsruntime()) ||
2009 !callruntime_feedback_slot_.IsInvalid());
2000 return callruntime_feedback_slot_; 2010 return callruntime_feedback_slot_;
2001 } 2011 }
2002 2012
2003 static int num_ids() { return parent_num_ids() + 1; } 2013 static int num_ids() { return parent_num_ids() + 1; }
2004 TypeFeedbackId CallRuntimeFeedbackId() const { 2014 TypeFeedbackId CallRuntimeFeedbackId() const {
2005 return TypeFeedbackId(local_id(0)); 2015 return TypeFeedbackId(local_id(0));
2006 } 2016 }
2007 2017
2008 protected: 2018 protected:
2009 CallRuntime(Zone* zone, const AstRawString* name, 2019 CallRuntime(Zone* zone, const AstRawString* name,
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
2376 // Type feedback information. 2386 // Type feedback information.
2377 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { 2387 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE {
2378 return FeedbackVectorRequirements( 2388 return FeedbackVectorRequirements(
2379 0, (FLAG_vector_ics && yield_kind() == kDelegating) ? 3 : 0); 2389 0, (FLAG_vector_ics && yield_kind() == kDelegating) ? 3 : 0);
2380 } 2390 }
2381 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 2391 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
2382 yield_first_feedback_slot_ = slot; 2392 yield_first_feedback_slot_ = slot;
2383 } 2393 }
2384 2394
2385 FeedbackVectorICSlot KeyedLoadFeedbackSlot() { 2395 FeedbackVectorICSlot KeyedLoadFeedbackSlot() {
2396 DCHECK(!FLAG_vector_ics || !yield_first_feedback_slot_.IsInvalid());
2386 return yield_first_feedback_slot_; 2397 return yield_first_feedback_slot_;
2387 } 2398 }
2388 2399
2389 FeedbackVectorICSlot DoneFeedbackSlot() { 2400 FeedbackVectorICSlot DoneFeedbackSlot() {
2390 return KeyedLoadFeedbackSlot().next(); 2401 return KeyedLoadFeedbackSlot().next();
2391 } 2402 }
2392 2403
2393 FeedbackVectorICSlot ValueFeedbackSlot() { return DoneFeedbackSlot().next(); } 2404 FeedbackVectorICSlot ValueFeedbackSlot() { return DoneFeedbackSlot().next(); }
2394 2405
2395 protected: 2406 protected:
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 bool stack_overflow_ 3166 bool stack_overflow_
3156 3167
3157 3168
3158 // ---------------------------------------------------------------------------- 3169 // ----------------------------------------------------------------------------
3159 // Construction time visitor. 3170 // Construction time visitor.
3160 3171
3161 class AstConstructionVisitor BASE_EMBEDDED { 3172 class AstConstructionVisitor BASE_EMBEDDED {
3162 public: 3173 public:
3163 AstConstructionVisitor() {} 3174 AstConstructionVisitor() {}
3164 3175
3165 AstProperties* ast_properties() { return &properties_; }
3166
3167 private: 3176 private:
3168 template<class> friend class AstNodeFactory; 3177 template<class> friend class AstNodeFactory;
3169 3178
3170 // Node visitors. 3179 // Node visitors.
3171 #define DEF_VISIT(type) \ 3180 #define DEF_VISIT(type) \
3172 void Visit##type(type* node); 3181 void Visit##type(type* node);
3173 AST_NODE_LIST(DEF_VISIT) 3182 AST_NODE_LIST(DEF_VISIT)
3174 #undef DEF_VISIT 3183 #undef DEF_VISIT
3175
3176 void add_slot_node(AstNode* slot_node) {
3177 FeedbackVectorRequirements reqs = slot_node->ComputeFeedbackRequirements();
3178 if (reqs.slots() > 0) {
3179 slot_node->SetFirstFeedbackSlot(
3180 FeedbackVectorSlot(properties_.feedback_slots()));
3181 properties_.increase_feedback_slots(reqs.slots());
3182 }
3183 if (reqs.ic_slots() > 0) {
3184 slot_node->SetFirstFeedbackICSlot(
3185 FeedbackVectorICSlot(properties_.ic_feedback_slots()));
3186 properties_.increase_ic_feedback_slots(reqs.ic_slots());
3187 }
3188 }
3189
3190 AstProperties properties_;
3191 }; 3184 };
3192 3185
3193 3186
3194 class AstNullVisitor BASE_EMBEDDED { 3187 class AstNullVisitor BASE_EMBEDDED {
3195 public: 3188 public:
3196 // Node visitors. 3189 // Node visitors.
3197 #define DEF_VISIT(type) \ 3190 #define DEF_VISIT(type) \
3198 void Visit##type(type* node) {} 3191 void Visit##type(type* node) {}
3199 AST_NODE_LIST(DEF_VISIT) 3192 AST_NODE_LIST(DEF_VISIT)
3200 #undef DEF_VISIT 3193 #undef DEF_VISIT
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
3660 private: 3653 private:
3661 Zone* zone_; 3654 Zone* zone_;
3662 Visitor visitor_; 3655 Visitor visitor_;
3663 AstValueFactory* ast_value_factory_; 3656 AstValueFactory* ast_value_factory_;
3664 }; 3657 };
3665 3658
3666 3659
3667 } } // namespace v8::internal 3660 } } // namespace v8::internal
3668 3661
3669 #endif // V8_AST_H_ 3662 #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