Bug 1290614, part 6 - Hoist out the common loop over all interfaces in XPCNativeSetKey::Hash(). r=mrbkap
Both cases first hash together all of the existing interfaces.
MozReview-Commit-ID: AnUF5uPSPpN
--- a/js/xpconnect/src/XPCWrappedNativeInfo.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeInfo.cpp
@@ -437,24 +437,22 @@ XPCNativeSetKey::Hash() const
PLDHashNumber h = 0;
if (!mBaseSet) {
MOZ_ASSERT(mAddition, "bad key");
h ^= HashPointer(mAddition);
} else {
XPCNativeInterface** current = mBaseSet->GetInterfaceArray();
uint16_t count = mBaseSet->GetInterfaceCount();
+ for (uint16_t i = 0; i < count; i++) {
+ h ^= HashPointer(*(current++));
+ }
+
if (mAddition) {
- for (uint16_t i = 0; i < count; i++) {
- h ^= HashPointer(*(current++));
- }
h ^= HashPointer(mAddition);
- } else {
- for (uint16_t i = 0; i < count; i++)
- h ^= HashPointer(*(current++));
}
}
return h;
}
/***************************************************************************/
// XPCNativeSet