Bug 1372031 - Use EnsureInserted instead of Contains+PutEntry to avoid unnecessary hashtable lookups. r=froydnj

MozReview-Commit-ID: 2ZG2qX3dyGa
This commit is contained in:
Mats Palmgren 2017-06-17 00:06:04 +02:00
Родитель f4bd97507a
Коммит ea75194536
1 изменённых файлов: 1 добавлений и 2 удалений

Просмотреть файл

@ -4988,7 +4988,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
}
${typeName}::EntryType* entry;
if (idsSeen.Contains(propName)) {
if (!idsSeen.EnsureInserted(propName)) {
// Find the existing entry.
auto idx = recordEntries.IndexOf(propName);
MOZ_ASSERT(idx != recordEntries.NoIndex,
@ -5004,7 +5004,6 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
// Safe to do an infallible append here, because we did a
// SetCapacity above to the right capacity.
entry = recordEntries.AppendElement();
idsSeen.PutEntry(propName);
}
entry->mKey = propName;
${valueType}& slot = entry->mValue;