author | Jeff Walden <jwalden@mit.edu> |
Wed, 16 May 2018 20:56:18 -0700 (2018-05-17) | |
changeset 418917 | 6ceb0b9f6c804911e1d769307b429fc72d1beef0 |
parent 418916 | 5c09010d054eeb3e44a1401cc917677db9579cfc |
child 418918 | 1df7d4219611559f5289e869e51c28c0b42a2853 |
push id | 103419 |
push user | jwalden@mit.edu |
push date | Fri, 18 May 2018 19:33:51 +0000 (2018-05-18) |
treeherder | mozilla-inbound@7658d2d1e0d7 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jandem |
bugs | 1461556 |
milestone | 62.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/src/gc/Statistics.cpp +++ b/js/src/gc/Statistics.cpp @@ -10,16 +10,17 @@ #include "mozilla/DebugOnly.h" #include "mozilla/PodOperations.h" #include "mozilla/Sprintf.h" #include "mozilla/TimeStamp.h" #include <ctype.h> #include <stdarg.h> #include <stdio.h> +#include <type_traits> #include "jsutil.h" #include "gc/GC.h" #include "gc/Memory.h" #include "util/Text.h" #include "vm/Debugger.h" #include "vm/HelperThreads.h" @@ -706,17 +707,36 @@ Statistics::Statistics(JSRuntime* rt) sliceCallback(nullptr), nurseryCollectionCallback(nullptr), aborted(false), enableProfiling_(false), sliceCount_(0) { for (auto& count : counts) count = 0; - PodZero(&totalTimes_); + +#ifdef DEBUG + for (const auto& duration : totalTimes_) { +#if defined(XP_WIN) || defined(XP_MACOSX) || (defined(XP_UNIX) && !defined(__clang__)) + // build-linux64-asan/debug and static-analysis-linux64-st-an/debug + // currently use an STL that lacks std::is_trivially_constructible. + // This #ifdef probably isn't as precise as it could be, but given + // |totalTimes_| contains |TimeDuration| defined platform-independently + // it's not worth the trouble to nail down a more exact condition. + using ElementType = typename mozilla::RemoveReference<decltype(duration)>::Type; + static_assert(!std::is_trivially_constructible<ElementType>::value, + "Statistics::Statistics will only initialize " + "totalTimes_'s elements if their default constructor is " + "non-trivial"); +#endif // mess'o'tests + MOZ_ASSERT(duration.IsZero(), + "totalTimes_ default-initialization should have " + "default-initialized every element of totalTimes_ to zero"); + } +#endif MOZ_ALWAYS_TRUE(phaseStack.reserve(MAX_PHASE_NESTING)); MOZ_ALWAYS_TRUE(suspendedPhases.reserve(MAX_SUSPENDED_PHASES)); const char* env = getenv("MOZ_GCTIMER"); if (env) { if (strcmp(env, "none") == 0) { fp = nullptr;