Last Comment Bug 775896 - OrderedHashTable should have a hashShift field like HashTable
: OrderedHashTable should have a hashShift field like HashTable
Status: RESOLVED FIXED
[js:t]
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Other Branch
: All All
: -- normal (vote)
: mozilla17
Assigned To: Jason Orendorff [:jorendorff]
: general
: Jason Orendorff [:jorendorff]
Mentors:
Depends on: 743107
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-20 03:33 PDT by Jason Orendorff [:jorendorff]
Modified: 2012-07-26 05:10 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
v1 (12.41 KB, patch)
2012-07-25 03:03 PDT, Jason Orendorff [:jorendorff]
luke: review+
Details | Diff | Splinter Review

Description Jason Orendorff [:jorendorff] 2012-07-20 03:33:07 PDT
The hashing scheme of js::HashTable uses the most significant bits of a prepared hash code to select a hash bucket.  js::OrderedHashTable uses the least significant bits, which is very bad.
Comment 1 Jason Orendorff [:jorendorff] 2012-07-25 03:03:59 PDT
Created attachment 645687 [details] [diff] [review]
v1
Comment 2 Jason Orendorff [:jorendorff] 2012-07-25 04:39:21 PDT
A quick note on this patch:
>-  if (hashTableMask > initialBuckets() && liveCount < dataLength * minDataFill()) {
>+  if (hashBuckets() > initialBuckets() && liveCount < dataLength * minDataFill()) {

This changes the behavior, because hashTableMask is the number of buckets minus one.

The old behavior was accidental--a bug, but harmless as long as initialBuckets() was more than 1.
Comment 3 Jason Orendorff [:jorendorff] 2012-07-25 11:41:21 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/0610488a81c9
Comment 4 Ed Morley [:emorley] 2012-07-26 05:10:32 PDT
https://hg.mozilla.org/mozilla-central/rev/0610488a81c9

Note You need to log in before you can comment on or make changes to this bug.