Closed Bug 1626587 Opened 4 months ago Closed 4 months ago

Replace mozilla::IsPod with <type_traits> alternatives


(Core :: JavaScript Engine, task, P2)




Tracking Status
firefox76 --- wontfix
firefox77 --- fixed


(Reporter: anba, Assigned: anba)


(Blocks 1 open bug)



(4 files)

Unless needed for the mozilla::Vector POD optimisation, we should replace mozilla::IsPod with appropriate <type_traits> alternatives.

Replace mozilla::IsPod with std::is_trivial and std::is_trivially_destructible,
which should cover the requirements for LifoAlloc. (std::is_trivial implies
is_trivially_default_constructible and is_trivially_copyable.)

IsPod<OffsetAndDefIndex> can then be removed.

Similar to part 1, use both std::is_trivial and std::is_trivially_destructible
instead of mozilla::IsPod to ensure the vector elements are POD values, so we
can skip constructor/destructor calls.

There's no mozilla::IsPod specialisation to remove for this part.

Depends on D69198

We can't use std::is_trivial for the table entry type, because the entry value
isn't trivially default constructible. (Neither mozilla::HashMapEntry nor
RecyclableAtomMapValueWrapper are trivially default constructible.)

So instead of using std::is_trivial<EntryType> directly, we have to check
std::is_trivial<KeyType> and std::is_trivial<ValueType> separately, where
we potentially need to unwrap ValueType in case it's

This allows to remove the mozilla::IsPod specialisations for NameLocation,
DeclaredNameInfo, MaybeCheckTDZ, and RecyclableAtomMapValueWrapper.

Depends on D69199

The mozilla::IsPod<HashMapEntry specialisation was only needed for the static
assertions in "js/src/frontend/NameCollections.h". Part 3 removed those, so we
can now also remove mozilla::IsPod<HashMapEntry.

Drive-by change:

  • Remove no longer needed "mozilla/PodOperations.h" include in mfbt/HashTable.h.
  • And then fix up previously transitively included files for RootingAPI.h,
    jsfriendapi.h, and Bench.cpp.

Depends on D69200

Priority: -- → P2
Pushed by
Part 1: Replace mozilla::IsPod in LifoAlloc. r=jwalden
Part 2: Replace mozilla::IsPod in VectorPool. r=jwalden
Part 3: Replace mozilla::IsPod in InlineTablePool. r=jwalden
Part 4: Remove mozilla::IsPod for HashMapEntry. r=jwalden
You need to log in before you can comment on or make changes to this bug.