Add JS_ASSERT(initialized()) where appropriate in HashTable.h

RESOLVED FIXED in mozilla16

Status

()

Core
JavaScript Engine
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: njn, Assigned: njn)

Tracking

unspecified
mozilla16
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
Bug 710922 was caused by calling all() on a hash table that hadn't had init() called on it.  A |JS_ASSERT(initialized())| assertion inside all() would have caught it immediately.  There are probably other places where that assertion would also be helpful.
(Assignee)

Comment 1

5 years ago
Created attachment 629675 [details] [diff] [review]
patch

This patch adds JS_ASSERT(table) to two sets of HashTable methods.  

- The first set definitely need it: findFreeEntry(), add(), two versions of
  remove(), all().

- The second set don't need it, but it seems like a good idea just to
  encourage people to init() their HashTables immediately:  empty(), 
  count(), capacity(), generation, sizeOf{In,Ex}cludingThis().
Attachment #629675 - Flags: review?(luke)

Comment 2

5 years ago
Comment on attachment 629675 [details] [diff] [review]
patch

Looks good
Attachment #629675 - Flags: review?(luke) → review+
(Assignee)

Comment 3

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/03a85aeeed14
Target Milestone: --- → mozilla16
https://hg.mozilla.org/mozilla-central/rev/03a85aeeed14
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.