Index: src/ast.h |
diff --git a/src/ast.h b/src/ast.h |
index f9d7af1e0d70d624d2f88372b75facba3e6f27ee..b9e79270da1a895d4fc20dc90acd83c3fd1a1f80 100644 |
--- a/src/ast.h |
+++ b/src/ast.h |
@@ -152,25 +152,29 @@ class FeedbackVectorRequirements { |
}; |
-class VariableICSlotPair final { |
+class ICSlotCache { |
public: |
- VariableICSlotPair(Variable* variable, FeedbackVectorICSlot slot) |
- : variable_(variable), slot_(slot) {} |
- VariableICSlotPair() |
- : variable_(NULL), slot_(FeedbackVectorICSlot::Invalid()) {} |
+ explicit ICSlotCache(Zone* zone) |
+ : zone_(zone), |
+ hash_map_(HashMap::PointersMatch, ZoneHashMap::kDefaultHashMapCapacity, |
+ ZoneAllocationPolicy(zone)) {} |
- Variable* variable() const { return variable_; } |
- FeedbackVectorICSlot slot() const { return slot_; } |
+ void Put(Variable* variable, FeedbackVectorICSlot slot) { |
+ ZoneHashMap::Entry* entry = hash_map_.LookupOrInsert( |
+ variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_)); |
+ entry->value = reinterpret_cast<void*>(slot.ToInt()); |
+ } |
+ |
+ ZoneHashMap::Entry* Get(Variable* variable) const { |
+ return hash_map_.Lookup(variable, ComputePointerHash(variable)); |
+ } |
private: |
- Variable* variable_; |
- FeedbackVectorICSlot slot_; |
+ Zone* zone_; |
+ ZoneHashMap hash_map_; |
}; |
-typedef List<VariableICSlotPair> ICSlotCache; |
- |
- |
class AstProperties final BASE_EMBEDDED { |
public: |
enum Flag { |