| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 | 44 |
| 45 class HashMap { | 45 class HashMap { |
| 46 public: | 46 public: |
| 47 static Allocator DefaultAllocator; | 47 static Allocator DefaultAllocator; |
| 48 | 48 |
| 49 typedef bool (*MatchFun) (void* key1, void* key2); | 49 typedef bool (*MatchFun) (void* key1, void* key2); |
| 50 | 50 |
| 51 // Dummy constructor. This constructor doesn't set up the hash | 51 // Dummy constructor. This constructor doesn't set up the hash |
| 52 // map properly so don't use it unless you have good reason. | 52 // map properly so don't use it unless you have good reason (e.g., |
| 53 // you know that the HashMap will never be used). |
| 53 HashMap(); | 54 HashMap(); |
| 54 | 55 |
| 55 // initial_capacity is the size of the initial hash map; | 56 // initial_capacity is the size of the initial hash map; |
| 56 // it must be a power of 2 (and thus must not be 0). | 57 // it must be a power of 2 (and thus must not be 0). |
| 57 HashMap(MatchFun match, | 58 HashMap(MatchFun match, |
| 58 Allocator* allocator = &DefaultAllocator, | 59 Allocator* allocator = &DefaultAllocator, |
| 59 uint32_t initial_capacity = 8); | 60 uint32_t initial_capacity = 8); |
| 60 | 61 |
| 61 ~HashMap(); | 62 ~HashMap(); |
| 62 | 63 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 Entry* map_end() const { return map_ + capacity_; } | 112 Entry* map_end() const { return map_ + capacity_; } |
| 112 Entry* Probe(void* key, uint32_t hash); | 113 Entry* Probe(void* key, uint32_t hash); |
| 113 void Initialize(uint32_t capacity); | 114 void Initialize(uint32_t capacity); |
| 114 void Resize(); | 115 void Resize(); |
| 115 }; | 116 }; |
| 116 | 117 |
| 117 | 118 |
| 118 } } // namespace v8::internal | 119 } } // namespace v8::internal |
| 119 | 120 |
| 120 #endif // V8_HASHMAP_H_ | 121 #endif // V8_HASHMAP_H_ |
| OLD | NEW |