Skip to content

Commit 4c1606c

Browse files
committed
Bug 1591132 - Make hashtable checker use MOZ_RELEASE_ASSERT. r=froydnj
I want to maybe enable some of these checks in DIAGNOSTIC_ASSERT builds. The whole type is compiled out in release builds at the moment. Differential Revision: https://phabricator.services.mozilla.com/D50491 --HG-- extra : moz-landing-system : lando
1 parent 6b1e674 commit 4c1606c

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

xpcom/ds/PLDHashTable.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -122,57 +122,57 @@ class Checker {
122122

123123
void StartReadOp() {
124124
uint32_t oldState = mState++; // this is an atomic increment
125-
MOZ_ASSERT(IsIdle(oldState) || IsRead(oldState));
126-
MOZ_ASSERT(oldState < kReadMax); // check for overflow
125+
MOZ_RELEASE_ASSERT(IsIdle(oldState) || IsRead(oldState));
126+
MOZ_RELEASE_ASSERT(oldState < kReadMax); // check for overflow
127127
}
128128

129129
void EndReadOp() {
130130
uint32_t oldState = mState--; // this is an atomic decrement
131-
MOZ_ASSERT(IsRead(oldState));
131+
MOZ_RELEASE_ASSERT(IsRead(oldState));
132132
}
133133

134134
void StartWriteOp() {
135-
MOZ_ASSERT(IsWritable());
135+
MOZ_RELEASE_ASSERT(IsWritable());
136136
uint32_t oldState = mState.exchange(kWrite);
137-
MOZ_ASSERT(IsIdle(oldState));
137+
MOZ_RELEASE_ASSERT(IsIdle(oldState));
138138
}
139139

140140
void EndWriteOp() {
141141
// Check again that the table is writable, in case it was marked as
142142
// non-writable just after the IsWritable() assertion in StartWriteOp()
143143
// occurred.
144-
MOZ_ASSERT(IsWritable());
144+
MOZ_RELEASE_ASSERT(IsWritable());
145145
uint32_t oldState = mState.exchange(kIdle);
146-
MOZ_ASSERT(IsWrite(oldState));
146+
MOZ_RELEASE_ASSERT(IsWrite(oldState));
147147
}
148148

149149
void StartIteratorRemovalOp() {
150150
// When doing removals at the end of iteration, we go from Read1 state to
151151
// Write and then back.
152-
MOZ_ASSERT(IsWritable());
152+
MOZ_RELEASE_ASSERT(IsWritable());
153153
uint32_t oldState = mState.exchange(kWrite);
154-
MOZ_ASSERT(IsRead1(oldState));
154+
MOZ_RELEASE_ASSERT(IsRead1(oldState));
155155
}
156156

157157
void EndIteratorRemovalOp() {
158158
// Check again that the table is writable, in case it was marked as
159159
// non-writable just after the IsWritable() assertion in
160160
// StartIteratorRemovalOp() occurred.
161-
MOZ_ASSERT(IsWritable());
161+
MOZ_RELEASE_ASSERT(IsWritable());
162162
uint32_t oldState = mState.exchange(kRead1);
163-
MOZ_ASSERT(IsWrite(oldState));
163+
MOZ_RELEASE_ASSERT(IsWrite(oldState));
164164
}
165165

166166
void StartDestructorOp() {
167167
// A destructor op is like a write, but the table doesn't need to be
168168
// writable.
169169
uint32_t oldState = mState.exchange(kWrite);
170-
MOZ_ASSERT(IsIdle(oldState));
170+
MOZ_RELEASE_ASSERT(IsIdle(oldState));
171171
}
172172

173173
void EndDestructorOp() {
174174
uint32_t oldState = mState.exchange(kIdle);
175-
MOZ_ASSERT(IsWrite(oldState));
175+
MOZ_RELEASE_ASSERT(IsWrite(oldState));
176176
}
177177

178178
private:

0 commit comments

Comments
 (0)