@@ -41,15 +41,15 @@ template <class Derived> class MemMapBase {
41
41
// want to remap them with different accessibility.
42
42
bool remap (uptr Addr, uptr Size, const char *Name, uptr Flags = 0 ) {
43
43
DCHECK (isAllocated ());
44
- DCHECK ((Addr >= getBase ()) || (Addr + Size <= getBase () + getCapacity ()));
44
+ DCHECK ((Addr >= getBase ()) && (Addr + Size <= getBase () + getCapacity ()));
45
45
return invokeImpl (&Derived::remapImpl, Addr, Size, Name, Flags);
46
46
}
47
47
48
48
// This is used to update the pages' access permission. For example, mark
49
49
// pages as no read/write permission.
50
50
void setMemoryPermission (uptr Addr, uptr Size, uptr Flags) {
51
51
DCHECK (isAllocated ());
52
- DCHECK ((Addr >= getBase ()) || (Addr + Size <= getBase () + getCapacity ()));
52
+ DCHECK ((Addr >= getBase ()) && (Addr + Size <= getBase () + getCapacity ()));
53
53
return static_cast <Derived *>(this )->setMemoryPermissionImpl (Addr, Size,
54
54
Flags);
55
55
}
@@ -59,14 +59,14 @@ template <class Derived> class MemMapBase {
59
59
// virtual pages may lead to undefined behavior.
60
60
void releasePagesToOS (uptr From, uptr Size) {
61
61
DCHECK (isAllocated ());
62
- DCHECK ((From >= getBase ()) || (From + Size <= getBase () + getCapacity ()));
62
+ DCHECK ((From >= getBase ()) && (From + Size <= getBase () + getCapacity ()));
63
63
invokeImpl (&Derived::releasePagesToOSImpl, From, Size);
64
64
}
65
65
// This is similar to the above one except that any subsequent access to the
66
66
// released pages will return with zero-filled pages.
67
67
void releaseAndZeroPagesToOS (uptr From, uptr Size) {
68
68
DCHECK (isAllocated ());
69
- DCHECK ((From >= getBase ()) || (From + Size <= getBase () + getCapacity ()));
69
+ DCHECK ((From >= getBase ()) && (From + Size <= getBase () + getCapacity ()));
70
70
invokeImpl (&Derived::releaseAndZeroPagesToOSImpl, From, Size);
71
71
}
72
72
@@ -109,7 +109,7 @@ template <class Derived, typename MemMapTy> class ReservedMemory {
109
109
// the reserved pages is managed by each implementation.
110
110
MemMapT dispatch (uptr Addr, uptr Size) {
111
111
DCHECK (isCreated ());
112
- DCHECK ((Addr >= getBase ()) || (Addr + Size <= getBase () + getCapacity ()));
112
+ DCHECK ((Addr >= getBase ()) && (Addr + Size <= getBase () + getCapacity ()));
113
113
return invokeImpl (&Derived::dispatchImpl, Addr, Size);
114
114
}
115
115
0 commit comments