Exemple #1
0
/* static */ bool
InefficientNonFlatteningStringHashPolicy::match(const JSString *const &k, const Lookup &l)
{
    // We can't use js::EqualStrings, because that flattens our strings.
    JSString *s1 = const_cast<JSString *>(k);
    if (k->hasLatin1Chars()) {
        return l->hasLatin1Chars()
               ? EqualStringsPure<Latin1Char, Latin1Char>(s1, l)
               : EqualStringsPure<Latin1Char, jschar>(s1, l);
    }

    return l->hasLatin1Chars()
           ? EqualStringsPure<jschar, Latin1Char>(s1, l)
           : EqualStringsPure<jschar, jschar>(s1, l);
}
Exemple #2
0
/* static */ HashNumber
InefficientNonFlatteningStringHashPolicy::hash(const Lookup &l)
{
    return l->hasLatin1Chars()
           ? HashStringChars<Latin1Char>(l)
           : HashStringChars<jschar>(l);
}