| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #include <string.h> | 5 #include <string.h> |
| 6 | 6 |
| 7 #include "src/vm/void_hash_table.h" | 7 #include "src/vm/void_hash_table.h" |
| 8 | 8 |
| 9 namespace fletch { | 9 namespace dartino { |
| 10 | 10 |
| 11 VoidHashTable::hash_t VoidHashTable::HashCode(const void* key) { | 11 VoidHashTable::hash_t VoidHashTable::HashCode(const void* key) { |
| 12 return reinterpret_cast<intptr_t>(key) & INTPTR_MAX; | 12 return reinterpret_cast<intptr_t>(key) & INTPTR_MAX; |
| 13 } | 13 } |
| 14 | 14 |
| 15 VoidHashTable::VoidHashTable(size_t pair_size) | 15 VoidHashTable::VoidHashTable(size_t pair_size) |
| 16 : entry_size_(sizeof(hash_t) + pair_size), | 16 : entry_size_(sizeof(hash_t) + pair_size), |
| 17 mask_(kInitialCapacity - 1) | 17 mask_(kInitialCapacity - 1) |
| 18 #ifdef DEBUG | 18 #ifdef DEBUG |
| 19 , | 19 , |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 if (size_ == 0) return; | 232 if (size_ == 0) return; |
| 233 delete[] backing_; | 233 delete[] backing_; |
| 234 #ifdef DEBUG | 234 #ifdef DEBUG |
| 235 mutations_++; | 235 mutations_++; |
| 236 #endif | 236 #endif |
| 237 mask_ = kInitialCapacity - 1; | 237 mask_ = kInitialCapacity - 1; |
| 238 size_ = 0; | 238 size_ = 0; |
| 239 AllocateBacking(kInitialCapacity); | 239 AllocateBacking(kInitialCapacity); |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace fletch. | 242 } // namespace dartino. |
| OLD | NEW |