mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 07:40:42 +00:00
Bug 1480668 - Remove js::CStringHashPolicy. r=luke
It's identical to mozilla::CStringHasher. Also fix a comment at the top of HashTable.h about CStringHasher. --HG-- extra : rebase_source : 92176c4f6ea8041f309764b4ce0271a494853a7b
This commit is contained in:
parent
7b988956cc
commit
e39fda4c40
@ -123,13 +123,6 @@ struct InefficientNonFlatteningStringHashPolicy
|
||||
static bool match(const JSString* const& k, const Lookup& l);
|
||||
};
|
||||
|
||||
struct CStringHashPolicy
|
||||
{
|
||||
typedef const char* Lookup;
|
||||
static HashNumber hash(const Lookup& l);
|
||||
static bool match(const char* const& k, const Lookup& l);
|
||||
};
|
||||
|
||||
// This file features many classes with numerous size_t fields, and each such
|
||||
// class has one or more methods that need to operate on all of these fields.
|
||||
// Writing these individually is error-prone -- it's easy to add a new field
|
||||
@ -604,7 +597,7 @@ struct RuntimeSizes
|
||||
GCSizes gc;
|
||||
|
||||
typedef js::HashMap<const char*, ScriptSourceInfo,
|
||||
js::CStringHashPolicy,
|
||||
mozilla::CStringHasher,
|
||||
js::SystemAllocPolicy> ScriptSourcesHashMap;
|
||||
|
||||
// |allScriptSources| is only used transiently. During the reporting phase
|
||||
@ -901,7 +894,7 @@ struct RealmStats
|
||||
void* extra; // This field can be used by embedders.
|
||||
|
||||
typedef js::HashMap<const char*, ClassInfo,
|
||||
js::CStringHashPolicy,
|
||||
mozilla::CStringHasher,
|
||||
js::SystemAllocPolicy> ClassesHashMap;
|
||||
|
||||
// These are similar to |allStrings| and |notableStrings| in ZoneStats.
|
||||
|
@ -122,18 +122,6 @@ InefficientNonFlatteningStringHashPolicy::match(const JSString* const& k, const
|
||||
: EqualStringsPure<char16_t, char16_t>(s1, l);
|
||||
}
|
||||
|
||||
/* static */ HashNumber
|
||||
CStringHashPolicy::hash(const Lookup& l)
|
||||
{
|
||||
return mozilla::HashString(l);
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
CStringHashPolicy::match(const char* const& k, const Lookup& l)
|
||||
{
|
||||
return strcmp(k, l) == 0;
|
||||
}
|
||||
|
||||
} // namespace js
|
||||
|
||||
namespace JS {
|
||||
|
@ -18,14 +18,14 @@
|
||||
// conditions are true.
|
||||
//
|
||||
// - The key type stored in the table (|Key| for |HashMap<Key, Value>|, |T|
|
||||
// for |HashSet<T>|) is an integer, pointer, UniquePtr, float, double, or
|
||||
// char*.
|
||||
// for |HashSet<T>|) is an integer, pointer, UniquePtr, float, or double.
|
||||
//
|
||||
// - The type used for lookups (|Lookup|) is the same as the key type. This
|
||||
// is usually the case, but not always.
|
||||
//
|
||||
// Otherwise, you must provide your own hash policy; see the "Hash Policy"
|
||||
// section below.
|
||||
// There is also a |CStringHasher| policy for |char*| keys. If your keys
|
||||
// don't match any of the above cases, you must provide your own hash policy;
|
||||
// see the "Hash Policy" section below.
|
||||
//
|
||||
// - AllocPolicy. This defines how allocations are done by the table.
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user