Closed Bug 1592992 Opened 4 months ago Closed 4 months ago

Split up jsutil.h and use std functions where possible

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(19 files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
No description provided.
Priority: -- → P3

AddContainerToHash and ForEach aren't used (anymore).

mozilla::Vector already provides an eraseIf method, so we should prefer to use
the existing method. Except that Vector::eraseIf doesn't return the number of
elements removed, but that's easy to determine manually. More annoyingly is the
use of a modifying predicate function in Zone.cpp, which prevents using
Vector::eraseIf. It looks like for that specific use case a custome EraseIf
function is still necessary.

Depends on D51361

A single header for both memory and byte alignment functions, similar to the
standard <memory> header, which also provides memory and byte alignment related
functionality.

Depends on D51366

The includes are still transitively reachable through the new "#include util/*.h" headers.

Depends on D51369

For the most part another mechanical change, except for two changes:

  • In gc/Nursery.cpp and vm/DateTime.cpp, the initializer_list variants for
    std::min/max are used, because the two parameter forms of min/max take const
    reference parameters. And it's not possible to take the reference of a
    constexpr variable which wasn't previously explicitly defined. This is just
    a C++14 limitation and as soon as we compile with C++17, we can revert this
    change.
  • builtin/String.cpp was calling Max(unsignedVar, 0U) in a few places, which
    led to compiler warnings, because the result is always unsignedVar.

Depends on D51370

And handle the fallout of missing #includes when compiling a non-unified build.

Depends on D51375

Depends on D51376

This file provides the implementation of js/Utility.h, so it should be renamed
to match the header name.

Depends on D51377

Pushed by nbeleuzu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3cd1ccce483f
Part 1: Remove unused jsutil functions. r=jonco
https://hg.mozilla.org/integration/autoland/rev/39d4f511997a
Part 2: Replace js::Find with std::find. r=jonco
https://hg.mozilla.org/integration/autoland/rev/01b3529c554e
Part 3: Replace js::EraseIf with Vector::eraseIf where possible. r=jonco
https://hg.mozilla.org/integration/autoland/rev/aeed2e27a9bd
Part 4: Replace js::EqualContainers with std::equal. r=jonco
https://hg.mozilla.org/integration/autoland/rev/3d592f96e69a
Part 5: Replace js::Reverse with std::reverse. r=jonco
https://hg.mozilla.org/integration/autoland/rev/212c71d3ed1c
Part 6: Split poisoning functions from jsutil.h. r=jonco
https://hg.mozilla.org/integration/autoland/rev/3b7daea3fbf0
Part 7: Split bit-array functions from jsutil.h. r=jonco
https://hg.mozilla.org/integration/autoland/rev/ab4ac2b0cb6e
Part 8: Split memory and byte alignment functions from jsutil.h. r=jonco
https://hg.mozilla.org/integration/autoland/rev/c7eee900c240
Part 9: Move js::IsInitialized() into its sole caller. r=jonco
https://hg.mozilla.org/integration/autoland/rev/e6fb5e9d00f4
Part 10: Split diagnostic assertions from jsutil.h. r=jonco
https://hg.mozilla.org/integration/autoland/rev/2df8363a5d34
Part 11: Remove no longer needed includes from jsutil.h. r=jonco
https://hg.mozilla.org/integration/autoland/rev/879358fd1771
Part 12: Replace js::Min/Max with std::min/max. r=jonco
https://hg.mozilla.org/integration/autoland/rev/6f9ec747d5b6
Part 13: Include util/BitArray.h where necessary. r=jonco
https://hg.mozilla.org/integration/autoland/rev/70f5608fb8f2
Part 14: Include util/Memory.h where necessary. r=jonco
https://hg.mozilla.org/integration/autoland/rev/c29e5c442d0e
Part 15: Include util/Poison.h where necessary. r=jonco
https://hg.mozilla.org/integration/autoland/rev/1f4c3e6e6c7e
Part 16: Include util/DiagnosticAssertions.h where necessary. r=jonco
https://hg.mozilla.org/integration/autoland/rev/e7051eca20f5
Part 17: Remove includes for jsutil.h. r=jonco
https://hg.mozilla.org/integration/autoland/rev/75f180647de3
Part 18: Remove jsutil.h. r=jonco
https://hg.mozilla.org/integration/autoland/rev/b78631b2bccd
Part 19: Move jsutil.cpp to util/Utility.cpp. r=jonco
You need to log in before you can comment on or make changes to this bug.