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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 int slots() const { return slots_; } | 152 int slots() const { return slots_; } |
153 int ic_slots() const { return ic_slots_; } | 153 int ic_slots() const { return ic_slots_; } |
154 | 154 |
155 private: | 155 private: |
156 int slots_; | 156 int slots_; |
157 int ic_slots_; | 157 int ic_slots_; |
158 }; | 158 }; |
159 | 159 |
160 | 160 |
161 class VariableICSlotPair final { | 161 class ICSlotCache { |
162 public: | 162 public: |
163 VariableICSlotPair(Variable* variable, FeedbackVectorICSlot slot) | 163 explicit ICSlotCache(Zone* zone) |
164 : variable_(variable), slot_(slot) {} | 164 : zone_(zone), |
165 VariableICSlotPair() | 165 hash_map_(HashMap::PointersMatch, |
166 : variable_(NULL), slot_(FeedbackVectorICSlot::Invalid()) {} | 166 FLAG_vector_ics ? ZoneHashMap::kDefaultHashMapCapacity : 0, |
| 167 ZoneAllocationPolicy(zone)) {} |
167 | 168 |
168 Variable* variable() const { return variable_; } | 169 void Put(Variable* variable, FeedbackVectorICSlot slot) { |
169 FeedbackVectorICSlot slot() const { return slot_; } | 170 ZoneHashMap::Entry* entry = hash_map_.LookupOrInsert( |
| 171 variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_)); |
| 172 entry->value = reinterpret_cast<void*>(slot.ToInt()); |
| 173 } |
| 174 |
| 175 ZoneHashMap::Entry* Get(Variable* variable) const { |
| 176 return hash_map_.Lookup(variable, ComputePointerHash(variable)); |
| 177 } |
170 | 178 |
171 private: | 179 private: |
172 Variable* variable_; | 180 Zone* zone_; |
173 FeedbackVectorICSlot slot_; | 181 ZoneHashMap hash_map_; |
174 }; | 182 }; |
175 | 183 |
176 | 184 |
177 typedef List<VariableICSlotPair> ICSlotCache; | |
178 | |
179 | |
180 class AstProperties final BASE_EMBEDDED { | 185 class AstProperties final BASE_EMBEDDED { |
181 public: | 186 public: |
182 class Flags : public EnumSet<AstPropertiesFlag, int> {}; | 187 class Flags : public EnumSet<AstPropertiesFlag, int> {}; |
183 | 188 |
184 explicit AstProperties(Zone* zone) : node_count_(0), spec_(zone) {} | 189 explicit AstProperties(Zone* zone) : node_count_(0), spec_(zone) {} |
185 | 190 |
186 Flags* flags() { return &flags_; } | 191 Flags* flags() { return &flags_; } |
187 int node_count() { return node_count_; } | 192 int node_count() { return node_count_; } |
188 void add_node_count(int count) { node_count_ += count; } | 193 void add_node_count(int count) { node_count_ += count; } |
189 | 194 |
(...skipping 3307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3497 | 3502 |
3498 private: | 3503 private: |
3499 Zone* zone_; | 3504 Zone* zone_; |
3500 AstValueFactory* ast_value_factory_; | 3505 AstValueFactory* ast_value_factory_; |
3501 }; | 3506 }; |
3502 | 3507 |
3503 | 3508 |
3504 } } // namespace v8::internal | 3509 } } // namespace v8::internal |
3505 | 3510 |
3506 #endif // V8_AST_H_ | 3511 #endif // V8_AST_H_ |
OLD | NEW |