Bug 1471589 - Ensure that ranges do not overlap in diagnostic builds. r=tcampbell
authorNicolas B. Pierron <nicolas.b.pierron@gmail.com>
Wed, 27 Jun 2018 12:29:17 +0000
changeset 479025 77d45de8498329a355ecb2ad1810277cfc1e24e4
parent 479024 c73f394a4bef01cccd76d635bce9d67e4a48f721
child 479026 17e2d3a11b7c4b8b7a48da79fed278e1e58eb3c7
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1471589
milestone63.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
Bug 1471589 - Ensure that ranges do not overlap in diagnostic builds. r=tcampbell
js/src/ds/MemoryProtectionExceptionHandler.cpp
js/src/ds/SplayTree.h
--- a/js/src/ds/MemoryProtectionExceptionHandler.cpp
+++ b/js/src/ds/MemoryProtectionExceptionHandler.cpp
@@ -44,16 +44,20 @@ class ProtectedRegionTree
     struct Region
     {
         uintptr_t first;
         uintptr_t last;
 
         Region(uintptr_t addr, size_t size) : first(addr),
                                               last(addr + (size - 1)) {}
 
+        // This function compares 2 memory regions. If they overlap they are
+        // considered as identical. This is used for querying if an address is
+        // included in a range, or if an address is already registered as a
+        // protected region.
         static int compare(const Region& A, const Region& B) {
             if (A.last < B.first)
                 return -1;
             if (A.first > B.last)
                 return 1;
             return 0;
         }
     };
--- a/js/src/ds/SplayTree.h
+++ b/js/src/ds/SplayTree.h
@@ -99,17 +99,17 @@ class SplayTree
         if (!root) {
             root = element;
             return true;
         }
         Node* last = lookup(v);
         int cmp = C::compare(v, last->item);
 
         // Don't tolerate duplicate elements.
-        MOZ_ASSERT(cmp);
+        MOZ_DIAGNOSTIC_ASSERT(cmp);
 
         Node*& parentPointer = (cmp < 0) ? last->left : last->right;
         MOZ_ASSERT(!parentPointer);
         parentPointer = element;
         element->parent = last;
 
         splay(element);
         checkCoherency();