mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1058075 - IonMonkey: GVN: Fix MConstant's hash function to reduce collisions r=mjrosenb
This commit is contained in:
parent
a933f2da69
commit
1c3d6b8f1e
@ -542,10 +542,14 @@ MConstant::MConstant(JSObject *obj)
|
||||
HashNumber
|
||||
MConstant::valueHash() const
|
||||
{
|
||||
// This disregards some state, since values are 64 bits. But for a hash,
|
||||
// it's completely acceptable.
|
||||
return (HashNumber)JSVAL_TO_IMPL(value_).asBits;
|
||||
// Fold all 64 bits into the 32-bit result. It's tempting to just discard
|
||||
// half of the bits, as this is just a hash, however there are many common
|
||||
// patterns of values where only the low or the high bits vary, so
|
||||
// discarding either side would lead to excessive hash collisions.
|
||||
uint64_t bits = JSVAL_TO_IMPL(value_).asBits;
|
||||
return (HashNumber)bits ^ (HashNumber)(bits >> 32);
|
||||
}
|
||||
|
||||
bool
|
||||
MConstant::congruentTo(const MDefinition *ins) const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user