Closed
Bug 885175
Opened 11 years ago
Closed 11 years ago
Fix hashing of doubles
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla24
People
(Reporter: sunfish, Unassigned)
References
Details
Attachments
(1 file, 1 obsolete file)
1.37 KB,
patch
|
luke
:
review+
|
Details | Diff | Splinter Review |
DefaultHasher<double>'s hash method uses a union which causes it to return values which depend on the endianness, and its match method uses floating-point equality, so it doesn't handle negative zeros or NaNs properly.
Reporter | ||
Comment 1•11 years ago
|
||
This is partly based on part of the patch in bug 876064.
Attachment #765162 -
Flags: review?(luke)
Comment 2•11 years ago
|
||
Could you use BitwiseCast<uint64_t> instead (see use in ion/MIR.cpp)?
Comment 3•11 years ago
|
||
Does the existing DefaultHasher stuff use mfbt/HashFunctions.h at all? Would probably be good to add some double overloads and functions there, and use that. (The existing code there looks like it'd hash the double as if it were a uint32_t, which is wrong in all sorts of ways.)
Reporter | ||
Comment 4•11 years ago
|
||
Luke: Updated patch using BitwiseCast<uint64_t>. It's nicer :-). Jeff: As far as I can tell, nothing in js/public/HashTable.h uses mfbt/HashFunctions.h currently. Switching it over looks like a bigger project than I'm interested in tackling at this time.
Attachment #765162 -
Attachment is obsolete: true
Attachment #765162 -
Flags: review?(luke)
Attachment #765482 -
Flags: review?(luke)
Comment 5•11 years ago
|
||
Comment on attachment 765482 [details] [diff] [review] an updated patch, following review feedback Great! Feel free to take over bug 876064, btw.
Attachment #765482 -
Flags: review?(luke) → review+
Reporter | ||
Comment 6•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/806a358aa8b2 Also, yes, I do plan to take over bug 876064 soon :).
Comment 7•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/806a358aa8b2
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in
before you can comment on or make changes to this bug.
Description
•