| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 uint32_t hash; // the full hash value for key | 68 uint32_t hash; // the full hash value for key |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 // If an entry with matching key is found, Lookup() | 71 // If an entry with matching key is found, Lookup() |
| 72 // returns that entry. If no matching entry is found, | 72 // returns that entry. If no matching entry is found, |
| 73 // but insert is set, a new entry is inserted with | 73 // but insert is set, a new entry is inserted with |
| 74 // corresponding key, key hash, and NULL value. | 74 // corresponding key, key hash, and NULL value. |
| 75 // Otherwise, NULL is returned. | 75 // Otherwise, NULL is returned. |
| 76 Entry* Lookup(void* key, uint32_t hash, bool insert); | 76 Entry* Lookup(void* key, uint32_t hash, bool insert); |
| 77 | 77 |
| 78 // Removes the entry with matching key. |
| 79 void Remove(void* key, uint32_t hash); |
| 80 |
| 78 // Empties the hash map (occupancy() == 0). | 81 // Empties the hash map (occupancy() == 0). |
| 79 void Clear(); | 82 void Clear(); |
| 80 | 83 |
| 81 // The number of (non-empty) entries in the table. | 84 // The number of (non-empty) entries in the table. |
| 82 uint32_t occupancy() const { return occupancy_; } | 85 uint32_t occupancy() const { return occupancy_; } |
| 83 | 86 |
| 84 // The capacity of the table. The implementation | 87 // The capacity of the table. The implementation |
| 85 // makes sure that occupancy is at most 80% of | 88 // makes sure that occupancy is at most 80% of |
| 86 // the table capacity. | 89 // the table capacity. |
| 87 uint32_t capacity() const { return capacity_; } | 90 uint32_t capacity() const { return capacity_; } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 107 Entry* map_end() const { return map_ + capacity_; } | 110 Entry* map_end() const { return map_ + capacity_; } |
| 108 Entry* Probe(void* key, uint32_t hash); | 111 Entry* Probe(void* key, uint32_t hash); |
| 109 void Initialize(uint32_t capacity); | 112 void Initialize(uint32_t capacity); |
| 110 void Resize(); | 113 void Resize(); |
| 111 }; | 114 }; |
| 112 | 115 |
| 113 | 116 |
| 114 } } // namespace v8::internal | 117 } } // namespace v8::internal |
| 115 | 118 |
| 116 #endif // V8_HASHMAP_H_ | 119 #endif // V8_HASHMAP_H_ |
| OLD | NEW |