| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 int slots() const { return slots_; } | 148 int slots() const { return slots_; } |
| 149 int ic_slots() const { return ic_slots_; } | 149 int ic_slots() const { return ic_slots_; } |
| 150 | 150 |
| 151 private: | 151 private: |
| 152 int slots_; | 152 int slots_; |
| 153 int ic_slots_; | 153 int ic_slots_; |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 | 156 |
| 157 class VariableICSlotPair final { | 157 class ICSlotCache { |
| 158 public: | 158 public: |
| 159 VariableICSlotPair(Variable* variable, FeedbackVectorICSlot slot) | 159 explicit ICSlotCache(Zone* zone) |
| 160 : variable_(variable), slot_(slot) {} | 160 : zone_(zone), |
| 161 VariableICSlotPair() | 161 hash_map_(HashMap::PointersMatch, ZoneHashMap::kDefaultHashMapCapacity, |
| 162 : variable_(NULL), slot_(FeedbackVectorICSlot::Invalid()) {} | 162 ZoneAllocationPolicy(zone)) {} |
| 163 | 163 |
| 164 Variable* variable() const { return variable_; } | 164 void Put(Variable* variable, FeedbackVectorICSlot slot) { |
| 165 FeedbackVectorICSlot slot() const { return slot_; } | 165 ZoneHashMap::Entry* entry = hash_map_.LookupOrInsert( |
| 166 variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_)); |
| 167 entry->value = reinterpret_cast<void*>(slot.ToInt()); |
| 168 } |
| 169 |
| 170 ZoneHashMap::Entry* Get(Variable* variable) const { |
| 171 return hash_map_.Lookup(variable, ComputePointerHash(variable)); |
| 172 } |
| 166 | 173 |
| 167 private: | 174 private: |
| 168 Variable* variable_; | 175 Zone* zone_; |
| 169 FeedbackVectorICSlot slot_; | 176 ZoneHashMap hash_map_; |
| 170 }; | 177 }; |
| 171 | 178 |
| 172 | 179 |
| 173 typedef List<VariableICSlotPair> ICSlotCache; | |
| 174 | |
| 175 | |
| 176 class AstProperties final BASE_EMBEDDED { | 180 class AstProperties final BASE_EMBEDDED { |
| 177 public: | 181 public: |
| 178 class Flags : public EnumSet<AstPropertiesFlag, int> {}; | 182 class Flags : public EnumSet<AstPropertiesFlag, int> {}; |
| 179 | 183 |
| 180 explicit AstProperties(Zone* zone) : node_count_(0), spec_(zone) {} | 184 explicit AstProperties(Zone* zone) : node_count_(0), spec_(zone) {} |
| 181 | 185 |
| 182 Flags* flags() { return &flags_; } | 186 Flags* flags() { return &flags_; } |
| 183 int node_count() { return node_count_; } | 187 int node_count() { return node_count_; } |
| 184 void add_node_count(int count) { node_count_ += count; } | 188 void add_node_count(int count) { node_count_ += count; } |
| 185 | 189 |
| (...skipping 3420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3606 | 3610 |
| 3607 private: | 3611 private: |
| 3608 Zone* zone_; | 3612 Zone* zone_; |
| 3609 AstValueFactory* ast_value_factory_; | 3613 AstValueFactory* ast_value_factory_; |
| 3610 }; | 3614 }; |
| 3611 | 3615 |
| 3612 | 3616 |
| 3613 } } // namespace v8::internal | 3617 } } // namespace v8::internal |
| 3614 | 3618 |
| 3615 #endif // V8_AST_H_ | 3619 #endif // V8_AST_H_ |
| OLD | NEW |