Bug 1424116 - Change the definition of mozilla::fallible again. r=njn

In bug 1423803, mozilla::fallible was made an "alias" of std::nothrow.
Except C++ doesn't allow compilers to be too smart, and in many cases,
they would actually create data fields to hold a copy of std::nothrow,
even creating a static initializer on non-optimized builds to do so.

By turning it into a reference, we allow compilers to just use
std::nothrow directly, as if it were passed directly, but they can still
create unused data fields. Turning it into a static allows compilers to
skip the data fields altogether.

On a local linux64 build, this saves 242 bytes of .bss.

Note this does change a `lea` (address calculation) into a `mov` (read),
but it shouldn't matter too much.

--HG--
extra : rebase_source : 9c08e8263aef267b8ad5962b0248c7effcb67796
This commit is contained in:
Mike Hommey 2017-12-08 11:51:59 +09:00
parent cd4d96f039
commit 154fd9c9ad

View File

@ -55,7 +55,7 @@ namespace mozilla {
using fallible_t = std::nothrow_t;
const fallible_t fallible = std::nothrow;
static const fallible_t& fallible = std::nothrow;
} // namespace mozilla