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

Side by Side Diff: src/ast.h

Issue 1152063003: Remove unnecessary TypeFeedbackIds, saves memory and simplifies TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase. Created 5 years, 7 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/compiler/ast-graph-builder.h » ('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 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 1656
1657 class Property final : public Expression { 1657 class Property final : public Expression {
1658 public: 1658 public:
1659 DECLARE_NODE_TYPE(Property) 1659 DECLARE_NODE_TYPE(Property)
1660 1660
1661 bool IsValidReferenceExpression() const override { return true; } 1661 bool IsValidReferenceExpression() const override { return true; }
1662 1662
1663 Expression* obj() const { return obj_; } 1663 Expression* obj() const { return obj_; }
1664 Expression* key() const { return key_; } 1664 Expression* key() const { return key_; }
1665 1665
1666 static int num_ids() { return parent_num_ids() + 2; } 1666 static int num_ids() { return parent_num_ids() + 1; }
1667 BailoutId LoadId() const { return BailoutId(local_id(0)); } 1667 BailoutId LoadId() const { return BailoutId(local_id(0)); }
1668 TypeFeedbackId PropertyFeedbackId() { return TypeFeedbackId(local_id(1)); }
1669 1668
1670 bool IsStringAccess() const { 1669 bool IsStringAccess() const {
1671 return IsStringAccessField::decode(bit_field_); 1670 return IsStringAccessField::decode(bit_field_);
1672 } 1671 }
1673 1672
1674 // Type feedback information. 1673 // Type feedback information.
1675 bool IsMonomorphic() override { return receiver_types_.length() == 1; } 1674 bool IsMonomorphic() override { return receiver_types_.length() == 1; }
1676 SmallMapList* GetReceiverTypes() override { return &receiver_types_; } 1675 SmallMapList* GetReceiverTypes() override { return &receiver_types_; }
1677 KeyedAccessStoreMode GetStoreMode() const override { return STANDARD_STORE; } 1676 KeyedAccessStoreMode GetStoreMode() const override { return STANDARD_STORE; }
1678 IcCheckType GetKeyType() const override { 1677 IcCheckType GetKeyType() const override {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1965 callruntime_feedback_slot_ = slot; 1964 callruntime_feedback_slot_ = slot;
1966 } 1965 }
1967 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; } 1966 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; }
1968 1967
1969 FeedbackVectorICSlot CallRuntimeFeedbackSlot() { 1968 FeedbackVectorICSlot CallRuntimeFeedbackSlot() {
1970 DCHECK(!HasCallRuntimeFeedbackSlot() || 1969 DCHECK(!HasCallRuntimeFeedbackSlot() ||
1971 !callruntime_feedback_slot_.IsInvalid()); 1970 !callruntime_feedback_slot_.IsInvalid());
1972 return callruntime_feedback_slot_; 1971 return callruntime_feedback_slot_;
1973 } 1972 }
1974 1973
1975 static int num_ids() { return parent_num_ids() + 1; } 1974 static int num_ids() { return parent_num_ids(); }
1976 TypeFeedbackId CallRuntimeFeedbackId() const {
1977 return TypeFeedbackId(local_id(0));
1978 }
1979 1975
1980 protected: 1976 protected:
1981 CallRuntime(Zone* zone, const AstRawString* name, 1977 CallRuntime(Zone* zone, const AstRawString* name,
1982 const Runtime::Function* function, 1978 const Runtime::Function* function,
1983 ZoneList<Expression*>* arguments, int pos) 1979 ZoneList<Expression*>* arguments, int pos)
1984 : Expression(zone, pos), 1980 : Expression(zone, pos),
1985 raw_name_(name), 1981 raw_name_(name),
1986 function_(function), 1982 function_(function),
1987 arguments_(arguments), 1983 arguments_(arguments),
1988 callruntime_feedback_slot_(FeedbackVectorICSlot::Invalid()) {} 1984 callruntime_feedback_slot_(FeedbackVectorICSlot::Invalid()) {}
1989 static int parent_num_ids() { return Expression::num_ids(); } 1985 static int parent_num_ids() { return Expression::num_ids(); }
1990 1986
1991 private: 1987 private:
1992 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
1993
1994 const AstRawString* raw_name_; 1988 const AstRawString* raw_name_;
1995 const Runtime::Function* function_; 1989 const Runtime::Function* function_;
1996 ZoneList<Expression*>* arguments_; 1990 ZoneList<Expression*>* arguments_;
1997 FeedbackVectorICSlot callruntime_feedback_slot_; 1991 FeedbackVectorICSlot callruntime_feedback_slot_;
1998 }; 1992 };
1999 1993
2000 1994
2001 class UnaryOperation final : public Expression { 1995 class UnaryOperation final : public Expression {
2002 public: 1996 public:
2003 DECLARE_NODE_TYPE(UnaryOperation) 1997 DECLARE_NODE_TYPE(UnaryOperation)
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
2690 ThisFunction(Zone* zone, int pos) : Expression(zone, pos) {} 2684 ThisFunction(Zone* zone, int pos) : Expression(zone, pos) {}
2691 }; 2685 };
2692 2686
2693 2687
2694 class SuperReference final : public Expression { 2688 class SuperReference final : public Expression {
2695 public: 2689 public:
2696 DECLARE_NODE_TYPE(SuperReference) 2690 DECLARE_NODE_TYPE(SuperReference)
2697 2691
2698 VariableProxy* this_var() const { return this_var_; } 2692 VariableProxy* this_var() const { return this_var_; }
2699 2693
2700 static int num_ids() { return parent_num_ids() + 1; } 2694 static int num_ids() { return parent_num_ids(); }
2701 TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); }
2702 2695
2703 // Type feedback information. 2696 // Type feedback information.
2704 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 2697 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
2705 Isolate* isolate, const ICSlotCache* cache) override { 2698 Isolate* isolate, const ICSlotCache* cache) override {
2706 return FeedbackVectorRequirements(0, 1); 2699 return FeedbackVectorRequirements(0, 1);
2707 } 2700 }
2708 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, 2701 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
2709 ICSlotCache* cache) override { 2702 ICSlotCache* cache) override {
2710 homeobject_feedback_slot_ = slot; 2703 homeobject_feedback_slot_ = slot;
2711 } 2704 }
2712 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; } 2705 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; }
2713 2706
2714 FeedbackVectorICSlot HomeObjectFeedbackSlot() { 2707 FeedbackVectorICSlot HomeObjectFeedbackSlot() {
2715 DCHECK(!homeobject_feedback_slot_.IsInvalid()); 2708 DCHECK(!homeobject_feedback_slot_.IsInvalid());
2716 return homeobject_feedback_slot_; 2709 return homeobject_feedback_slot_;
2717 } 2710 }
2718 2711
2719 protected: 2712 protected:
2720 SuperReference(Zone* zone, VariableProxy* this_var, int pos) 2713 SuperReference(Zone* zone, VariableProxy* this_var, int pos)
2721 : Expression(zone, pos), 2714 : Expression(zone, pos),
2722 this_var_(this_var), 2715 this_var_(this_var),
2723 homeobject_feedback_slot_(FeedbackVectorICSlot::Invalid()) { 2716 homeobject_feedback_slot_(FeedbackVectorICSlot::Invalid()) {
2724 DCHECK(this_var->is_this()); 2717 DCHECK(this_var->is_this());
2725 } 2718 }
2726 static int parent_num_ids() { return Expression::num_ids(); } 2719 static int parent_num_ids() { return Expression::num_ids(); }
2727 2720
2728 private: 2721 private:
2729 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2730
2731 VariableProxy* this_var_; 2722 VariableProxy* this_var_;
2732 FeedbackVectorICSlot homeobject_feedback_slot_; 2723 FeedbackVectorICSlot homeobject_feedback_slot_;
2733 }; 2724 };
2734 2725
2735 2726
2736 #undef DECLARE_NODE_TYPE 2727 #undef DECLARE_NODE_TYPE
2737 2728
2738 2729
2739 // ---------------------------------------------------------------------------- 2730 // ----------------------------------------------------------------------------
2740 // Regular expressions 2731 // Regular expressions
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
3506 3497
3507 private: 3498 private:
3508 Zone* zone_; 3499 Zone* zone_;
3509 AstValueFactory* ast_value_factory_; 3500 AstValueFactory* ast_value_factory_;
3510 }; 3501 };
3511 3502
3512 3503
3513 } } // namespace v8::internal 3504 } } // namespace v8::internal
3514 3505
3515 #endif // V8_AST_H_ 3506 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler/ast-graph-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698