Bug 1527414: move DIAGNOSTIC_ASSERT back down to DEBUG-only ASSERT r=smaug
authorRandell Jesup <rjesup@wgate.com>
Mon, 25 Feb 2019 23:52:11 -0500
changeset 461137 3098f2ba2d33867e1b6d4a255575b9724f929930
parent 461136 1de4e8186b7fdbbb35a2dbd3f0b934be31166814
child 461138 96a0237880cf5fb1b77ca04c4a285c90b625a3ed
push id35618
push usershindli@mozilla.com
push dateTue, 26 Feb 2019 16:54:44 +0000
treeherdermozilla-central@d326a9d5f77b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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
Bug 1527414: move DIAGNOSTIC_ASSERT back down to DEBUG-only ASSERT r=smaug
--- a/dom/base/Timeout.h
+++ b/dom/base/Timeout.h
@@ -84,17 +84,17 @@ class Timeout final : public LinkedListE
   // Returned as value of setTimeout()
   uint32_t mTimeoutId;
   // Identifies which firing level this Timeout is being processed in
   // when sync loops trigger nested firing.
   uint32_t mFiringId;
+#ifdef DEBUG
   int64_t mFiringIndex;
   // The popup state at timeout creation time if not created from
   // another timeout
   PopupBlocker::PopupControlState mPopupState;
   // Used to allow several reasons for setting a timeout, where each
--- a/dom/base/TimeoutManager.cpp
+++ b/dom/base/TimeoutManager.cpp
@@ -449,17 +449,17 @@ int32_t gDisableOpenClickDelay;
 TimeoutManager::TimeoutManager(nsGlobalWindowInner& aWindow,
                                uint32_t aMaxIdleDeferMS)
     : mWindow(aWindow),
       mExecutor(new TimeoutExecutor(this, false, 0)),
       mIdleExecutor(new TimeoutExecutor(this, true, aMaxIdleDeferMS)),
       mNextFiringId(InvalidFiringId + 1),
+#ifdef DEBUG
@@ -558,17 +558,17 @@ nsresult TimeoutManager::SetTimeout(nsIT
   // code can handle. (Note: we already forced |interval| to be non-negative,
   // so the uint32_t cast (to avoid compiler warnings) is ok.)
   uint32_t maxTimeoutMs = PR_IntervalToMilliseconds(DOM_MAX_TIMEOUT_VALUE);
   if (static_cast<uint32_t>(interval) > maxTimeoutMs) {
     interval = maxTimeoutMs;
   RefPtr<Timeout> timeout = new Timeout();
+#ifdef DEBUG
   timeout->mFiringIndex = -1;
   timeout->mWindow = &mWindow;
   timeout->mIsInterval = aIsInterval;
   timeout->mInterval = TimeDuration::FromMilliseconds(interval);
   timeout->mScriptHandler = aHandler;
   timeout->mReason = aReason;
@@ -862,28 +862,28 @@ void TimeoutManager::RunTimeout(const Ti
         // If the FiringId does not match, but is still valid, then this is
         // a Timeout for another RunTimeout() on the call stack (such as in
         // the case of nested event loops, for alert() or more likely XHR).
         // Just skip it.
         if (IsValidFiringId(timeout->mFiringId)) {
           MOZ_LOG(gTimeoutLog, LogLevel::Debug,
                   ("Skipping Run%s(TimeoutManager=%p, timeout=%p) since "
                    "firingId %d is valid (processing firingId %d)"
+#ifdef DEBUG
                    " - FiringIndex %" PRId64 " (mLastFiringIndex %" PRId64 ")"
                    timeout->mIsInterval ? "Interval" : "Timeout", this,
                    timeout.get(), timeout->mFiringId, firingId
+#ifdef DEBUG
                    timeout->mFiringIndex, mFiringIndex
+#ifdef DEBUG
           // The old FiringIndex assumed no recursion; recursion can cause
           // other timers to get fired "in the middle" of a sequence we've
           // already assigned firingindexes to.  Since we're not going to
           // run this timeout now, remove any FiringIndex that was already
           // set.
           // Since all timers that have FiringIndexes set *must* be ready
           // to run and have valid FiringIds, all of them will be 'skipped'
@@ -917,17 +917,17 @@ void TimeoutManager::RunTimeout(const Ti
       // retain compliance with the spec language
       // (https://html.spec.whatwg.org/#dom-settimeout) specifically items
       // 15 ("If method context is a Window object, wait until the Document
       // associated with method context has been fully active for a further
       // timeout milliseconds (not necessarily consecutively)") and item 16
       // ("Wait until any invocations of this algorithm that had the same
       // method context, that started before this one, and whose timeout is
       // equal to or less than this one's, have completed.").
+#ifdef DEBUG
       if (timeout->mFiringIndex == -1) {
         timeout->mFiringIndex = mFiringIndex++;
       if (mIsLoading && !aProcessIdle) {
         // Any timeouts that would fire during a load will be deferred
         // until the load event occurs, but if there's an idle time,
@@ -957,28 +957,28 @@ void TimeoutManager::RunTimeout(const Ti
         if (!scx) {
           // No context means this window was closed or never properly
           // initialized for this language.  This timer will never fire
           // so just remove it.
+#ifdef DEBUG
         if (timeout->mFiringIndex <= mLastFiringIndex) {
           MOZ_LOG(gTimeoutLog, LogLevel::Debug,
                   ("Incorrect firing index for Run%s(TimeoutManager=%p, "
                    "timeout=%p) with "
                    "firingId %d - FiringIndex %" PRId64
                    " (mLastFiringIndex %" PRId64 ")",
                    timeout->mIsInterval ? "Interval" : "Timeout", this,
                    timeout.get(), timeout->mFiringId, timeout->mFiringIndex,
-        MOZ_DIAGNOSTIC_ASSERT(timeout->mFiringIndex > mLastFiringIndex);
+        MOZ_ASSERT(timeout->mFiringIndex > mLastFiringIndex);
         mLastFiringIndex = timeout->mFiringIndex;
         // This timeout is good to run
         bool timeout_was_cleared = mWindow.RunTimeoutHandler(timeout, scx);
         if (profiler_is_active()) {
           TimeDuration elapsed = now - timeout->SubmitTime();
           TimeDuration target = timeout->When() - timeout->SubmitTime();
@@ -1096,17 +1096,17 @@ bool TimeoutManager::RescheduleTimeout(T
   // Compute time to next timeout for interval timer.
   // Make sure nextInterval is at least CalculateDelay().
   TimeDuration nextInterval = CalculateDelay(aTimeout);
   TimeStamp firingTime = aLastCallbackTime + nextInterval;
   TimeDuration delay = firingTime - aCurrentNow;
+#ifdef DEBUG
   aTimeout->mFiringIndex = -1;
   // And make sure delay is nonnegative; that might happen if the timer
   // thread is firing our timers somewhat early or if they're taking a long
   // time to run the callback.
   if (delay < TimeDuration(0)) {
     delay = TimeDuration(0);
--- a/dom/base/TimeoutManager.h
+++ b/dom/base/TimeoutManager.h
@@ -198,17 +198,17 @@ class TimeoutManager final {
   // it must be a separate ref-counted object.
   RefPtr<TimeoutExecutor> mExecutor;
   // For timeouts run off the idle queue
   RefPtr<TimeoutExecutor> mIdleExecutor;
   // The list of timeouts coming from non-tracking scripts.
   Timeouts mTimeouts;
   uint32_t mTimeoutIdCounter;
   uint32_t mNextFiringId;
+#ifdef DEBUG
   int64_t mFiringIndex;
   int64_t mLastFiringIndex;
   AutoTArray<uint32_t, 2> mFiringIdStack;
   mozilla::dom::Timeout* mRunningTimeout;
   // Timeouts that would have fired but are being deferred until MainThread
   // is idle (because we're loading)