Closed Bug 775896 Opened 12 years ago Closed 12 years ago

OrderedHashTable should have a hashShift field like HashTable

Categories

(Core :: JavaScript Engine, defect)

Other Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla17

People

(Reporter: jorendorff, Assigned: jorendorff)

References

Details

(Whiteboard: [js:t])

Attachments

(1 file)

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.
Whiteboard: [js:t]
Attached patch v1Splinter Review
Assignee: general → jorendorff
Attachment #645687 - Flags: review?(luke)
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.
Attachment #645687 - Flags: review?(luke) → review+
https://hg.mozilla.org/mozilla-central/rev/0610488a81c9
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: