mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 1465470
Part 2 - Preserve iteration order for frontend name tables, r=jorendorff.
--HG-- extra : rebase_source : 7738eb3d80815f4caab4beae848541b84befd57b
This commit is contained in:
parent
7cb270f8b8
commit
51d8e11435
@ -142,11 +142,23 @@ struct RecyclableAtomMapValueWrapper
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct NameMapHasher : public DefaultHasher<JSAtom*>
|
||||||
|
{
|
||||||
|
static inline HashNumber hash(const Lookup& l) {
|
||||||
|
// Name maps use the atom's precomputed hash code, which is based on
|
||||||
|
// the atom's contents rather than its pointer value. This is necessary
|
||||||
|
// to preserve iteration order while recording/replaying: iteration can
|
||||||
|
// affect generated script bytecode and the order in which e.g. lookup
|
||||||
|
// property hooks are performed on the associated global.
|
||||||
|
return l->hash();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template <typename MapValue>
|
template <typename MapValue>
|
||||||
using RecyclableNameMap = InlineMap<JSAtom*,
|
using RecyclableNameMap = InlineMap<JSAtom*,
|
||||||
RecyclableAtomMapValueWrapper<MapValue>,
|
RecyclableAtomMapValueWrapper<MapValue>,
|
||||||
24,
|
24,
|
||||||
DefaultHasher<JSAtom*>,
|
NameMapHasher,
|
||||||
SystemAllocPolicy>;
|
SystemAllocPolicy>;
|
||||||
|
|
||||||
using DeclaredNameMap = RecyclableNameMap<DeclaredNameInfo>;
|
using DeclaredNameMap = RecyclableNameMap<DeclaredNameInfo>;
|
||||||
|
Loading…
Reference in New Issue
Block a user