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

Side by Side Diff: src/ast/ast.h

Issue 2673383002: [ic] Encode LoadGlobalIC's typeof mode in slot kind instead of code object's flags. (Closed)
Patch Set: Addressed comments and added check to FCG Created 3 years, 10 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/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_AST_H_ 5 #ifndef V8_AST_AST_H_
6 #define V8_AST_AST_H_ 6 #define V8_AST_AST_H_
7 7
8 #include "src/ast/ast-types.h" 8 #include "src/ast/ast-types.h"
9 #include "src/ast/ast-value-factory.h" 9 #include "src/ast/ast-value-factory.h"
10 #include "src/ast/modules.h" 10 #include "src/ast/modules.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 class Statement; 122 class Statement;
123 class TypeFeedbackOracle; 123 class TypeFeedbackOracle;
124 124
125 #define DEF_FORWARD_DECLARATION(type) class type; 125 #define DEF_FORWARD_DECLARATION(type) class type;
126 AST_NODE_LIST(DEF_FORWARD_DECLARATION) 126 AST_NODE_LIST(DEF_FORWARD_DECLARATION)
127 #undef DEF_FORWARD_DECLARATION 127 #undef DEF_FORWARD_DECLARATION
128 128
129 129
130 class FeedbackVectorSlotCache { 130 class FeedbackVectorSlotCache {
131 public: 131 public:
132 explicit FeedbackVectorSlotCache(Zone* zone) 132 typedef std::pair<TypeofMode, Variable*> Key;
133 : zone_(zone),
134 hash_map_(ZoneHashMap::kDefaultHashMapCapacity,
135 ZoneAllocationPolicy(zone)) {}
136 133
137 void Put(Variable* variable, FeedbackVectorSlot slot) { 134 explicit FeedbackVectorSlotCache(Zone* zone) : map_(zone) {}
138 ZoneHashMap::Entry* entry = hash_map_.LookupOrInsert( 135
139 variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_)); 136 void Put(TypeofMode typeof_mode, Variable* variable,
140 entry->value = reinterpret_cast<void*>(slot.ToInt()); 137 FeedbackVectorSlot slot) {
138 Key key = std::make_pair(typeof_mode, variable);
139 auto entry = std::make_pair(key, slot);
140 map_.insert(entry);
141 } 141 }
142 142
143 ZoneHashMap::Entry* Get(Variable* variable) const { 143 FeedbackVectorSlot Get(TypeofMode typeof_mode, Variable* variable) const {
144 return hash_map_.Lookup(variable, ComputePointerHash(variable)); 144 Key key = std::make_pair(typeof_mode, variable);
145 auto iter = map_.find(key);
146 if (iter != map_.end()) {
147 return iter->second;
148 }
149 return FeedbackVectorSlot();
145 } 150 }
146 151
147 private: 152 private:
148 Zone* zone_; 153 ZoneMap<Key, FeedbackVectorSlot> map_;
149 ZoneHashMap hash_map_;
150 }; 154 };
151 155
152 156
153 class AstProperties final BASE_EMBEDDED { 157 class AstProperties final BASE_EMBEDDED {
154 public: 158 public:
155 enum Flag { 159 enum Flag {
156 kNoFlags = 0, 160 kNoFlags = 0,
157 kDontSelfOptimize = 1 << 0, 161 kDontSelfOptimize = 1 << 0,
158 kMustUseIgnitionTurbo = 1 << 1 162 kMustUseIgnitionTurbo = 1 << 1
159 }; 163 };
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 } 1692 }
1689 1693
1690 // Bind this proxy to the variable var. 1694 // Bind this proxy to the variable var.
1691 void BindTo(Variable* var); 1695 void BindTo(Variable* var);
1692 1696
1693 bool UsesVariableFeedbackSlot() const { 1697 bool UsesVariableFeedbackSlot() const {
1694 return var()->IsUnallocated() || var()->IsLookupSlot(); 1698 return var()->IsUnallocated() || var()->IsLookupSlot();
1695 } 1699 }
1696 1700
1697 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, 1701 void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec,
1698 LanguageMode language_mode, 1702 TypeofMode typeof_mode,
1699 FeedbackVectorSlotCache* cache); 1703 FeedbackVectorSlotCache* cache);
1700 1704
1701 FeedbackVectorSlot VariableFeedbackSlot() { return variable_feedback_slot_; } 1705 FeedbackVectorSlot VariableFeedbackSlot() { return variable_feedback_slot_; }
1702 1706
1703 static int num_ids() { return parent_num_ids() + 1; } 1707 static int num_ids() { return parent_num_ids() + 1; }
1704 BailoutId BeforeId() const { return BailoutId(local_id(0)); } 1708 BailoutId BeforeId() const { return BailoutId(local_id(0)); }
1705 void set_next_unresolved(VariableProxy* next) { next_unresolved_ = next; } 1709 void set_next_unresolved(VariableProxy* next) { next_unresolved_ = next; }
1706 VariableProxy* next_unresolved() { return next_unresolved_; } 1710 VariableProxy* next_unresolved() { return next_unresolved_; }
1707 1711
1708 private: 1712 private:
(...skipping 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after
3655 : NULL; \ 3659 : NULL; \
3656 } 3660 }
3657 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 3661 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
3658 #undef DECLARE_NODE_FUNCTIONS 3662 #undef DECLARE_NODE_FUNCTIONS
3659 3663
3660 3664
3661 } // namespace internal 3665 } // namespace internal
3662 } // namespace v8 3666 } // namespace v8
3663 3667
3664 #endif // V8_AST_AST_H_ 3668 #endif // V8_AST_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698