зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1121202 - Remove unused PL_DHashTableOperate function. r=njn
This commit is contained in:
Родитель
f0e5ba672c
Коммит
a58d13d7ba
|
@ -1774,8 +1774,7 @@ NPObjWrapper_ObjectMoved(JSObject *obj, const JSObject *old)
|
|||
return;
|
||||
}
|
||||
|
||||
// The hazard analysis thinks that PL_DHashTableOperate() can GC but this is
|
||||
// not possible if we pass PL_DHASH_LOOKUP.
|
||||
// Calling PL_DHashTableLookup() will not result in GC.
|
||||
JS::AutoSuppressGCAnalysis nogc;
|
||||
|
||||
NPObjWrapperHashEntry *entry = static_cast<NPObjWrapperHashEntry *>
|
||||
|
|
|
@ -635,12 +635,6 @@ PLDHashTable::Operate(const void* aKey, PLDHashOperator aOp)
|
|||
return entry;
|
||||
}
|
||||
|
||||
PLDHashEntryHdr* PL_DHASH_FASTCALL
|
||||
PL_DHashTableOperate(PLDHashTable* aTable, const void* aKey, PLDHashOperator aOp)
|
||||
{
|
||||
return aTable->Operate(aKey, aOp);
|
||||
}
|
||||
|
||||
PLDHashEntryHdr* PL_DHASH_FASTCALL
|
||||
PL_DHashTableLookup(PLDHashTable* aTable, const void* aKey)
|
||||
{
|
||||
|
|
|
@ -74,13 +74,13 @@ struct PLDHashTableOps;
|
|||
* of multiplying the hash code returned from the hashKey callback (see below)
|
||||
* by PL_DHASH_GOLDEN_RATIO, then constraining the result to avoid the magic 0
|
||||
* and 1 values. The stored keyHash value is table size invariant, and it is
|
||||
* maintained automatically by PL_DHashTableOperate -- users should never set
|
||||
* it, and its only uses should be via the entry macros below.
|
||||
* maintained automatically -- users should never set it, and its only uses
|
||||
* should be via the entry macros below.
|
||||
*
|
||||
* However, use PL_DHASH_ENTRY_IS_BUSY for faster liveness testing of entries
|
||||
* returned by PL_DHashTableOperate, as PL_DHashTableOperate never returns a
|
||||
* non-live, busy (i.e., removed) entry pointer to its caller. See below for
|
||||
* more details on PL_DHashTableOperate's calling rules.
|
||||
* returned by PL_DHashTableLookup and PL_DHashTableAdd, as these functions
|
||||
* never return a non-live, busy (i.e., removed) entry pointer to its caller.
|
||||
* See below for more details on these functions.
|
||||
*/
|
||||
struct PLDHashEntryHdr
|
||||
{
|
||||
|
@ -133,8 +133,8 @@ typedef enum PLDHashOperator
|
|||
* that were enumerated so far. Return the total number of live entries when
|
||||
* enumeration completes normally.
|
||||
*
|
||||
* If etor calls PL_DHashTableOperate on table with op != PL_DHASH_LOOKUP, it
|
||||
* must return PL_DHASH_STOP; otherwise undefined behavior results.
|
||||
* If etor calls PL_DHashTableAdd or PL_DHashTableRemove on table, it must
|
||||
* return PL_DHASH_STOP; otherwise undefined behavior results.
|
||||
*
|
||||
* If any enumerator returns PL_DHASH_REMOVE, aTable->mEntryStore may be shrunk
|
||||
* or compressed after enumeration, but before PL_DHashTableEnumerate returns.
|
||||
|
@ -143,8 +143,8 @@ typedef enum PLDHashOperator
|
|||
* aside, e.g., to avoid copying live entries into an array of the entry type.
|
||||
* Copying entry pointers is cheaper, and safe so long as the caller of such a
|
||||
* "stable" Enumerate doesn't use the set-aside pointers after any call either
|
||||
* to PL_DHashTableOperate, or to an "unstable" form of Enumerate, which might
|
||||
* grow or shrink mEntryStore.
|
||||
* to PL_DHashTableAdd or PL_DHashTableRemove, or to an "unstable" form of
|
||||
* Enumerate, which might grow or shrink mEntryStore.
|
||||
*
|
||||
* If your enumerator wants to remove certain entries, but set aside pointers
|
||||
* to other entries that it retains, it can use PL_DHashTableRawRemove on the
|
||||
|
@ -334,10 +334,9 @@ typedef void (*PLDHashClearEntry)(PLDHashTable* aTable,
|
|||
|
||||
/*
|
||||
* Initialize a new entry, apart from keyHash. This function is called when
|
||||
* PL_DHashTableOperate's PL_DHASH_ADD case finds no existing entry for the
|
||||
* given key, and must add a new one. At that point, aEntry->keyHash is not
|
||||
* set yet, to avoid claiming the last free entry in a severely overloaded
|
||||
* table.
|
||||
* PL_DHashTableAdd finds no existing entry for the given key, and must add a
|
||||
* new one. At that point, aEntry->keyHash is not set yet, to avoid claiming
|
||||
* the last free entry in a severely overloaded table.
|
||||
*/
|
||||
typedef bool (*PLDHashInitEntry)(PLDHashTable* aTable, PLDHashEntryHdr* aEntry,
|
||||
const void* aKey);
|
||||
|
@ -355,13 +354,13 @@ typedef bool (*PLDHashInitEntry)(PLDHashTable* aTable, PLDHashEntryHdr* aEntry,
|
|||
* clearEntry Run dtor on entry.
|
||||
*
|
||||
* Note the reason why initEntry is optional: the default hooks (stubs) clear
|
||||
* entry storage: On successful PL_DHashTableOperate(tbl, key, PL_DHASH_ADD),
|
||||
* the returned entry pointer addresses an entry struct whose keyHash member
|
||||
* has been set non-zero, but all other entry members are still clear (null).
|
||||
* PL_DHASH_ADD callers can test such members to see whether the entry was
|
||||
* newly created by the PL_DHASH_ADD call that just succeeded. If placement
|
||||
* new or similar initialization is required, define an initEntry hook. Of
|
||||
* course, the clearEntry hook must zero or null appropriately.
|
||||
* entry storage: On successful PL_DHashTableAdd(tbl, key), the returned entry
|
||||
* pointer addresses an entry struct whose keyHash member has been set
|
||||
* non-zero, but all other entry members are still clear (null).
|
||||
* PL_DHashTableAdd callers can test such members to see whether the entry was
|
||||
* newly created by the PL_DHashTableAdd call that just succeeded. If
|
||||
* placement new or similar initialization is required, define an initEntry
|
||||
* hook. Of course, the clearEntry hook must zero or null appropriately.
|
||||
*
|
||||
* XXX assumes 0 is null for pointer types.
|
||||
*/
|
||||
|
@ -462,14 +461,18 @@ void PL_DHashTableFinish(PLDHashTable* aTable);
|
|||
/*
|
||||
* To lookup a key in table, call:
|
||||
*
|
||||
* entry = PL_DHashTableOperate(table, key, PL_DHASH_LOOKUP);
|
||||
* entry = PL_DHashTableLookup(table, key);
|
||||
*
|
||||
* If PL_DHASH_ENTRY_IS_BUSY(entry) is true, key was found and it identifies
|
||||
* entry. If PL_DHASH_ENTRY_IS_FREE(entry) is true, key was not found.
|
||||
*
|
||||
*/
|
||||
PLDHashEntryHdr* PL_DHASH_FASTCALL
|
||||
PL_DHashTableLookup(PLDHashTable* aTable, const void* aKey);
|
||||
|
||||
/*
|
||||
* To add an entry identified by key to table, call:
|
||||
*
|
||||
* entry = PL_DHashTableOperate(table, key, PL_DHASH_ADD);
|
||||
* entry = PL_DHashTableAdd(table, key);
|
||||
*
|
||||
* If entry is null upon return, then either the table is severely overloaded,
|
||||
* and memory can't be allocated for entry storage. Or if
|
||||
|
@ -480,28 +483,19 @@ void PL_DHashTableFinish(PLDHashTable* aTable);
|
|||
* is true, and it is up to the caller to initialize the key and value parts
|
||||
* of the entry sub-type, if they have not been set already (i.e. if entry was
|
||||
* not already in the table, and if the optional initEntry hook was not used).
|
||||
*
|
||||
*/
|
||||
PLDHashEntryHdr* PL_DHASH_FASTCALL
|
||||
PL_DHashTableAdd(PLDHashTable* aTable, const void* aKey);
|
||||
|
||||
/*
|
||||
* To remove an entry identified by key from table, call:
|
||||
*
|
||||
* (void) PL_DHashTableOperate(table, key, PL_DHASH_REMOVE);
|
||||
* PL_DHashTableRemove(table, key);
|
||||
*
|
||||
* If key's entry is found, it is cleared (via table->ops->clearEntry) and
|
||||
* the entry is marked so that PL_DHASH_ENTRY_IS_FREE(entry). This operation
|
||||
* returns null unconditionally; you should ignore its return value.
|
||||
*/
|
||||
PLDHashEntryHdr* PL_DHASH_FASTCALL
|
||||
PL_DHashTableOperate(PLDHashTable* aTable, const void* aKey,
|
||||
PLDHashOperator aOp);
|
||||
|
||||
/* Look up a key in table. */
|
||||
PLDHashEntryHdr* PL_DHASH_FASTCALL
|
||||
PL_DHashTableLookup(PLDHashTable* aTable, const void* aKey);
|
||||
|
||||
/* Add an entry identified by key to table. */
|
||||
PLDHashEntryHdr* PL_DHASH_FASTCALL
|
||||
PL_DHashTableAdd(PLDHashTable* aTable, const void* aKey);
|
||||
|
||||
/* Remove an entry identified by key from table. */
|
||||
void PL_DHASH_FASTCALL
|
||||
PL_DHashTableRemove(PLDHashTable* aTable, const void* aKey);
|
||||
|
||||
|
@ -509,7 +503,7 @@ PL_DHashTableRemove(PLDHashTable* aTable, const void* aKey);
|
|||
* Remove an entry already accessed via LOOKUP or ADD.
|
||||
*
|
||||
* NB: this is a "raw" or low-level routine, intended to be used only where
|
||||
* the inefficiency of a full PL_DHashTableOperate (which rehashes in order
|
||||
* the inefficiency of a full PL_DHashTableRemove (which rehashes in order
|
||||
* to find the entry given its key) is not tolerable. This function does not
|
||||
* shrink the table if it is underloaded. It does not update mStats #ifdef
|
||||
* PL_DHASHMETER, either.
|
||||
|
|
Загрузка…
Ссылка в новой задаче