[NFC][sanitizer] DCHECKs in hot code

This commit is contained in:
Vitaly Buka 2021-10-24 17:05:50 -07:00
parent 5bf24f0581
commit 384ec7dc8c
1 changed files with 5 additions and 7 deletions

View File

@ -43,14 +43,12 @@ class FlatMap {
}
T &operator[](uptr idx) {
CHECK_LT(idx, kSize);
// FIXME: CHECK may be too expensive here.
DCHECK_LT(idx, kSize);
return map_[idx];
}
const T &operator[](uptr idx) const {
CHECK_LT(idx, kSize);
// FIXME: CHECK may be too expensive here.
DCHECK_LT(idx, kSize);
return map_[idx];
}
@ -106,13 +104,13 @@ class TwoLevelMap {
}
const T &operator[](uptr idx) const {
CHECK_LT(idx, kSize1 * kSize2);
DCHECK_LT(idx, kSize1 * kSize2);
T *map2 = GetOrCreate(idx / kSize2);
return *AddressSpaceView::Load(&map2[idx % kSize2]);
}
T &operator[](uptr idx) {
CHECK_LT(idx, kSize1 * kSize2);
DCHECK_LT(idx, kSize1 * kSize2);
T *map2 = GetOrCreate(idx / kSize2);
return *AddressSpaceView::LoadWritable(&map2[idx % kSize2]);
}
@ -123,7 +121,7 @@ class TwoLevelMap {
}
T *Get(uptr idx) const {
CHECK_LT(idx, kSize1);
DCHECK_LT(idx, kSize1);
return reinterpret_cast<T *>(
atomic_load(&map1_[idx], memory_order_acquire));
}