File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -26,12 +26,13 @@ namespace Js
26
26
27
27
uint32 ReduceKeyToIndex (PropertyId key)
28
28
{
29
- // we use 4-bit bucket index
30
- // sometimes we have keys that differ in higher bits, so smudge the bits down a little
31
- // to reduce the possibility of collisions
32
- key ^= (uint)key >> 15 ;
33
- key ^= (uint)key >> 7 ;
34
- return key & (PowerOf2_BUCKETS - 1 );
29
+ // we use 4-bit bucket index, but we often have keys that are larger.
30
+ // use Fibonacci hash to reduce the possibility of collisions
31
+ #if TARGET_64
32
+ return (key * 11400714819323198485llu) >> 60 ;
33
+ #else
34
+ return (key * 2654435769ul ) >> 28 ;
35
+ #endif
35
36
}
36
37
37
38
void Add (PropertyId key, byte value)
@@ -50,7 +51,7 @@ namespace Js
50
51
else
51
52
{
52
53
buckets[bucketIndex] = value;
53
- next[value & 127 ] = i;
54
+ next[value] = i;
54
55
}
55
56
}
56
57
You can’t perform that action at this time.
0 commit comments