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

Side by Side Diff: src/ast.h

Issue 758543002: Make use of post-scoping information to compute feedback vector requirements. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 230
231 virtual TargetCollector* AsTargetCollector() { return NULL; } 231 virtual TargetCollector* AsTargetCollector() { return NULL; }
232 virtual BreakableStatement* AsBreakableStatement() { return NULL; } 232 virtual BreakableStatement* AsBreakableStatement() { return NULL; }
233 virtual IterationStatement* AsIterationStatement() { return NULL; } 233 virtual IterationStatement* AsIterationStatement() { return NULL; }
234 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } 234 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; }
235 235
236 // The interface for feedback slots, with default no-op implementations for 236 // The interface for feedback slots, with default no-op implementations for
237 // node types which don't actually have this. Note that this is conceptually 237 // node types which don't actually have this. Note that this is conceptually
238 // not really nice, but multiple inheritance would introduce yet another 238 // not really nice, but multiple inheritance would introduce yet another
239 // vtable entry per node, something we don't want for space reasons. 239 // vtable entry per node, something we don't want for space reasons.
240 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() { 240 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
241 Isolate* isolate) {
241 return FeedbackVectorRequirements(0, 0); 242 return FeedbackVectorRequirements(0, 0);
242 } 243 }
243 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) { UNREACHABLE(); } 244 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) { UNREACHABLE(); }
244 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) { 245 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) {
245 UNREACHABLE(); 246 UNREACHABLE();
246 } 247 }
247 248
248 private: 249 private:
249 // Hidden to prevent accidental usage. It would have to load the 250 // Hidden to prevent accidental usage. It would have to load the
250 // current zone from the TLS. 251 // current zone from the TLS.
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 917
917 class ForInStatement FINAL : public ForEachStatement { 918 class ForInStatement FINAL : public ForEachStatement {
918 public: 919 public:
919 DECLARE_NODE_TYPE(ForInStatement) 920 DECLARE_NODE_TYPE(ForInStatement)
920 921
921 Expression* enumerable() const { 922 Expression* enumerable() const {
922 return subject(); 923 return subject();
923 } 924 }
924 925
925 // Type feedback information. 926 // Type feedback information.
926 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { 927 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
928 Isolate* isolate) OVERRIDE {
927 return FeedbackVectorRequirements(1, 0); 929 return FeedbackVectorRequirements(1, 0);
928 } 930 }
929 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE { 931 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE {
930 for_in_feedback_slot_ = slot; 932 for_in_feedback_slot_ = slot;
931 } 933 }
932 934
933 FeedbackVectorSlot ForInFeedbackSlot() { 935 FeedbackVectorSlot ForInFeedbackSlot() {
934 DCHECK(!for_in_feedback_slot_.IsInvalid()); 936 DCHECK(!for_in_feedback_slot_.IsInvalid());
935 return for_in_feedback_slot_; 937 return for_in_feedback_slot_;
936 } 938 }
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 bool is_resolved() const { return IsResolvedField::decode(bit_field_); } 1691 bool is_resolved() const { return IsResolvedField::decode(bit_field_); }
1690 void set_is_resolved() { 1692 void set_is_resolved() {
1691 bit_field_ = IsResolvedField::update(bit_field_, true); 1693 bit_field_ = IsResolvedField::update(bit_field_, true);
1692 } 1694 }
1693 1695
1694 Interface* interface() const { return interface_; } 1696 Interface* interface() const { return interface_; }
1695 1697
1696 // Bind this proxy to the variable var. Interfaces must match. 1698 // Bind this proxy to the variable var. Interfaces must match.
1697 void BindTo(Variable* var); 1699 void BindTo(Variable* var);
1698 1700
1699 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { 1701 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
1702 Isolate* isolate) OVERRIDE {
1700 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); 1703 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0);
1701 } 1704 }
1702 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 1705 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
1703 variable_feedback_slot_ = slot; 1706 variable_feedback_slot_ = slot;
1704 } 1707 }
1705 1708
1706 FeedbackVectorICSlot VariableFeedbackSlot() { 1709 FeedbackVectorICSlot VariableFeedbackSlot() {
1707 DCHECK(!FLAG_vector_ics || !variable_feedback_slot_.IsInvalid()); 1710 DCHECK(!FLAG_vector_ics || !variable_feedback_slot_.IsInvalid());
1708 return variable_feedback_slot_; 1711 return variable_feedback_slot_;
1709 } 1712 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1775 } 1778 }
1776 void mark_for_call() { 1779 void mark_for_call() {
1777 bit_field_ = IsForCallField::update(bit_field_, true); 1780 bit_field_ = IsForCallField::update(bit_field_, true);
1778 } 1781 }
1779 bool is_for_call() const { return IsForCallField::decode(bit_field_); } 1782 bool is_for_call() const { return IsForCallField::decode(bit_field_); }
1780 1783
1781 bool IsSuperAccess() { 1784 bool IsSuperAccess() {
1782 return obj()->IsSuperReference(); 1785 return obj()->IsSuperReference();
1783 } 1786 }
1784 1787
1785 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { 1788 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
1789 Isolate* isolate) OVERRIDE {
1786 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); 1790 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0);
1787 } 1791 }
1788 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 1792 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
1789 property_feedback_slot_ = slot; 1793 property_feedback_slot_ = slot;
1790 } 1794 }
1791 1795
1792 FeedbackVectorICSlot PropertyFeedbackSlot() const { 1796 FeedbackVectorICSlot PropertyFeedbackSlot() const {
1793 DCHECK(!FLAG_vector_ics || !property_feedback_slot_.IsInvalid()); 1797 DCHECK(!FLAG_vector_ics || !property_feedback_slot_.IsInvalid());
1794 return property_feedback_slot_; 1798 return property_feedback_slot_;
1795 } 1799 }
(...skipping 24 matching lines...) Expand all
1820 1824
1821 1825
1822 class Call FINAL : public Expression { 1826 class Call FINAL : public Expression {
1823 public: 1827 public:
1824 DECLARE_NODE_TYPE(Call) 1828 DECLARE_NODE_TYPE(Call)
1825 1829
1826 Expression* expression() const { return expression_; } 1830 Expression* expression() const { return expression_; }
1827 ZoneList<Expression*>* arguments() const { return arguments_; } 1831 ZoneList<Expression*>* arguments() const { return arguments_; }
1828 1832
1829 // Type feedback information. 1833 // Type feedback information.
1830 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { 1834 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
1831 return FeedbackVectorRequirements(0, 1); 1835 Isolate* isolate) OVERRIDE;
1832 }
1833 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 1836 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
1834 call_feedback_slot_ = slot; 1837 call_feedback_slot_ = slot;
1835 } 1838 }
1836 1839
1837 bool HasCallFeedbackSlot() const { return !call_feedback_slot_.IsInvalid(); } 1840 bool HasCallFeedbackSlot() const { return !call_feedback_slot_.IsInvalid(); }
1838 FeedbackVectorICSlot CallFeedbackSlot() const { 1841 FeedbackVectorICSlot CallFeedbackSlot() const {
1839 DCHECK(!call_feedback_slot_.IsInvalid()); 1842 DCHECK(!call_feedback_slot_.IsInvalid());
1840 return call_feedback_slot_; 1843 return call_feedback_slot_;
1841 } 1844 }
1842 1845
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 1936
1934 1937
1935 class CallNew FINAL : public Expression { 1938 class CallNew FINAL : public Expression {
1936 public: 1939 public:
1937 DECLARE_NODE_TYPE(CallNew) 1940 DECLARE_NODE_TYPE(CallNew)
1938 1941
1939 Expression* expression() const { return expression_; } 1942 Expression* expression() const { return expression_; }
1940 ZoneList<Expression*>* arguments() const { return arguments_; } 1943 ZoneList<Expression*>* arguments() const { return arguments_; }
1941 1944
1942 // Type feedback information. 1945 // Type feedback information.
1943 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { 1946 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
1947 Isolate* isolate) OVERRIDE {
1944 return FeedbackVectorRequirements(FLAG_pretenuring_call_new ? 2 : 1, 0); 1948 return FeedbackVectorRequirements(FLAG_pretenuring_call_new ? 2 : 1, 0);
1945 } 1949 }
1946 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE { 1950 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE {
1947 callnew_feedback_slot_ = slot; 1951 callnew_feedback_slot_ = slot;
1948 } 1952 }
1949 1953
1950 FeedbackVectorSlot CallNewFeedbackSlot() { 1954 FeedbackVectorSlot CallNewFeedbackSlot() {
1951 DCHECK(!callnew_feedback_slot_.IsInvalid()); 1955 DCHECK(!callnew_feedback_slot_.IsInvalid());
1952 return callnew_feedback_slot_; 1956 return callnew_feedback_slot_;
1953 } 1957 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1998 public: 2002 public:
1999 DECLARE_NODE_TYPE(CallRuntime) 2003 DECLARE_NODE_TYPE(CallRuntime)
2000 2004
2001 Handle<String> name() const { return raw_name_->string(); } 2005 Handle<String> name() const { return raw_name_->string(); }
2002 const AstRawString* raw_name() const { return raw_name_; } 2006 const AstRawString* raw_name() const { return raw_name_; }
2003 const Runtime::Function* function() const { return function_; } 2007 const Runtime::Function* function() const { return function_; }
2004 ZoneList<Expression*>* arguments() const { return arguments_; } 2008 ZoneList<Expression*>* arguments() const { return arguments_; }
2005 bool is_jsruntime() const { return function_ == NULL; } 2009 bool is_jsruntime() const { return function_ == NULL; }
2006 2010
2007 // Type feedback information. 2011 // Type feedback information.
2008 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { 2012 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
2013 Isolate* isolate) OVERRIDE {
2009 return FeedbackVectorRequirements( 2014 return FeedbackVectorRequirements(
2010 0, (FLAG_vector_ics && is_jsruntime()) ? 1 : 0); 2015 0, (FLAG_vector_ics && is_jsruntime()) ? 1 : 0);
2011 } 2016 }
2012 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 2017 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
2013 callruntime_feedback_slot_ = slot; 2018 callruntime_feedback_slot_ = slot;
2014 } 2019 }
2015 2020
2016 FeedbackVectorICSlot CallRuntimeFeedbackSlot() { 2021 FeedbackVectorICSlot CallRuntimeFeedbackSlot() {
2017 DCHECK(!(FLAG_vector_ics && is_jsruntime()) || 2022 DCHECK(!(FLAG_vector_ics && is_jsruntime()) ||
2018 !callruntime_feedback_slot_.IsInvalid()); 2023 !callruntime_feedback_slot_.IsInvalid());
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 int index() const { 2382 int index() const {
2378 DCHECK_EQ(kDelegating, yield_kind()); 2383 DCHECK_EQ(kDelegating, yield_kind());
2379 return index_; 2384 return index_;
2380 } 2385 }
2381 void set_index(int index) { 2386 void set_index(int index) {
2382 DCHECK_EQ(kDelegating, yield_kind()); 2387 DCHECK_EQ(kDelegating, yield_kind());
2383 index_ = index; 2388 index_ = index;
2384 } 2389 }
2385 2390
2386 // Type feedback information. 2391 // Type feedback information.
2387 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { 2392 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
2393 Isolate* isolate) OVERRIDE {
2388 return FeedbackVectorRequirements( 2394 return FeedbackVectorRequirements(
2389 0, (FLAG_vector_ics && yield_kind() == kDelegating) ? 3 : 0); 2395 0, (FLAG_vector_ics && yield_kind() == kDelegating) ? 3 : 0);
2390 } 2396 }
2391 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 2397 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
2392 yield_first_feedback_slot_ = slot; 2398 yield_first_feedback_slot_ = slot;
2393 } 2399 }
2394 2400
2395 FeedbackVectorICSlot KeyedLoadFeedbackSlot() { 2401 FeedbackVectorICSlot KeyedLoadFeedbackSlot() {
2396 DCHECK(!FLAG_vector_ics || !yield_first_feedback_slot_.IsInvalid()); 2402 DCHECK(!FLAG_vector_ics || !yield_first_feedback_slot_.IsInvalid());
2397 return yield_first_feedback_slot_; 2403 return yield_first_feedback_slot_;
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
2714 class SuperReference FINAL : public Expression { 2720 class SuperReference FINAL : public Expression {
2715 public: 2721 public:
2716 DECLARE_NODE_TYPE(SuperReference) 2722 DECLARE_NODE_TYPE(SuperReference)
2717 2723
2718 VariableProxy* this_var() const { return this_var_; } 2724 VariableProxy* this_var() const { return this_var_; }
2719 2725
2720 static int num_ids() { return parent_num_ids() + 1; } 2726 static int num_ids() { return parent_num_ids() + 1; }
2721 TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); } 2727 TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); }
2722 2728
2723 // Type feedback information. 2729 // Type feedback information.
2724 virtual FeedbackVectorRequirements ComputeFeedbackRequirements() OVERRIDE { 2730 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
2731 Isolate* isolate) OVERRIDE {
2725 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); 2732 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0);
2726 } 2733 }
2727 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 2734 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
2728 homeobject_feedback_slot_ = slot; 2735 homeobject_feedback_slot_ = slot;
2729 } 2736 }
2730 2737
2731 FeedbackVectorICSlot HomeObjectFeedbackSlot() { 2738 FeedbackVectorICSlot HomeObjectFeedbackSlot() {
2732 DCHECK(!FLAG_vector_ics || !homeobject_feedback_slot_.IsInvalid()); 2739 DCHECK(!FLAG_vector_ics || !homeobject_feedback_slot_.IsInvalid());
2733 return homeobject_feedback_slot_; 2740 return homeobject_feedback_slot_;
2734 } 2741 }
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
3543 3550
3544 private: 3551 private:
3545 Zone* zone_; 3552 Zone* zone_;
3546 AstValueFactory* ast_value_factory_; 3553 AstValueFactory* ast_value_factory_;
3547 }; 3554 };
3548 3555
3549 3556
3550 } } // namespace v8::internal 3557 } } // namespace v8::internal
3551 3558
3552 #endif // V8_AST_H_ 3559 #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