OLD | NEW |
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 int slots() const { return slots_; } | 146 int slots() const { return slots_; } |
147 int ic_slots() const { return ic_slots_; } | 147 int ic_slots() const { return ic_slots_; } |
148 | 148 |
149 private: | 149 private: |
150 int slots_; | 150 int slots_; |
151 int ic_slots_; | 151 int ic_slots_; |
152 }; | 152 }; |
153 | 153 |
154 | 154 |
155 class VariableICSlotPair final { | 155 class ICSlotCache { |
156 public: | 156 public: |
157 VariableICSlotPair(Variable* variable, FeedbackVectorICSlot slot) | 157 explicit ICSlotCache(Zone* zone) |
158 : variable_(variable), slot_(slot) {} | 158 : zone_(zone), |
159 VariableICSlotPair() | 159 hash_map_(HashMap::PointersMatch, ZoneHashMap::kDefaultHashMapCapacity, |
160 : variable_(NULL), slot_(FeedbackVectorICSlot::Invalid()) {} | 160 ZoneAllocationPolicy(zone)) {} |
161 | 161 |
162 Variable* variable() const { return variable_; } | 162 void Put(Variable* variable, FeedbackVectorICSlot slot) { |
163 FeedbackVectorICSlot slot() const { return slot_; } | 163 ZoneHashMap::Entry* entry = hash_map_.LookupOrInsert( |
| 164 variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_)); |
| 165 entry->value = reinterpret_cast<void*>(slot.ToInt()); |
| 166 } |
| 167 |
| 168 ZoneHashMap::Entry* Get(Variable* variable) const { |
| 169 return hash_map_.Lookup(variable, ComputePointerHash(variable)); |
| 170 } |
164 | 171 |
165 private: | 172 private: |
166 Variable* variable_; | 173 Zone* zone_; |
167 FeedbackVectorICSlot slot_; | 174 ZoneHashMap hash_map_; |
168 }; | 175 }; |
169 | 176 |
170 | 177 |
171 typedef List<VariableICSlotPair> ICSlotCache; | |
172 | |
173 | |
174 class AstProperties final BASE_EMBEDDED { | 178 class AstProperties final BASE_EMBEDDED { |
175 public: | 179 public: |
176 enum Flag { | 180 enum Flag { |
177 kNoFlags = 0, | 181 kNoFlags = 0, |
178 kDontSelfOptimize = 1 << 0, | 182 kDontSelfOptimize = 1 << 0, |
179 kDontCrankshaft = 1 << 1 | 183 kDontCrankshaft = 1 << 1 |
180 }; | 184 }; |
181 | 185 |
182 typedef base::Flags<Flag> Flags; | 186 typedef base::Flags<Flag> Flags; |
183 | 187 |
(...skipping 3441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3625 | 3629 |
3626 private: | 3630 private: |
3627 Zone* zone_; | 3631 Zone* zone_; |
3628 AstValueFactory* ast_value_factory_; | 3632 AstValueFactory* ast_value_factory_; |
3629 }; | 3633 }; |
3630 | 3634 |
3631 | 3635 |
3632 } } // namespace v8::internal | 3636 } } // namespace v8::internal |
3633 | 3637 |
3634 #endif // V8_AST_H_ | 3638 #endif // V8_AST_H_ |
OLD | NEW |