Closed Bug 1626587 Opened 4 months ago Closed 4 months ago

Replace mozilla::IsPod with <type_traits> alternatives

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox76 --- wontfix
firefox77 --- fixed

People

(Reporter: anba, Assigned: anba)

References

(Blocks 1 open bug)

Details

Attachments

(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
IsRecyclableAtomMapValueWrapper.

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 dluca@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d49eebe62ba3
Part 1: Replace mozilla::IsPod in LifoAlloc. r=jwalden
https://hg.mozilla.org/integration/autoland/rev/1e75beb9d311
Part 2: Replace mozilla::IsPod in VectorPool. r=jwalden
https://hg.mozilla.org/integration/autoland/rev/239b37c87f58
Part 3: Replace mozilla::IsPod in InlineTablePool. r=jwalden
https://hg.mozilla.org/integration/autoland/rev/1e75de42137c
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.