Chromium Code Reviews| Index: src/heap.cc |
| =================================================================== |
| --- src/heap.cc (revision 3513) |
| +++ src/heap.cc (working copy) |
| @@ -1612,17 +1612,18 @@ |
| static inline int double_get_hash(double d) { |
|
Kasper Lund
2009/12/22 11:25:58
This should really be DoubleGetHash (the same goes
|
| DoubleRepresentation rep(d); |
| - return ((static_cast<int>(rep.bits) ^ static_cast<int>(rep.bits >> 32)) & |
| - (Heap::kNumberStringCacheSize - 1)); |
| + int value = (static_cast<int>(rep.bits) ^ static_cast<int>(rep.bits >> 32)); |
| + return (((value >> 16) ^ value)) |
|
Kasper Lund
2009/12/22 11:25:58
How about adding another helper function so you ca
|
| + & (Heap::kNumberStringCacheSize - 1); |
| } |
| static inline int smi_get_hash(Smi* smi) { |
| - return (smi->value() & (Heap::kNumberStringCacheSize - 1)); |
| + return ((smi->value() >> 16) ^ smi->value()) |
| + & (Heap::kNumberStringCacheSize - 1); |
| } |
| - |
| Object* Heap::GetNumberStringCache(Object* number) { |
| int hash; |
| if (number->IsSmi()) { |