gecko-dev/memory/build
Mike Hommey 5c18ecad6b Bug 1438427 - Fix wrong change from bug 1412722 in RedBlackTree::Remove. r=njn
Before bug 1412722, which removed the sentinels, the code looked like:

  if (rbp_r_c->Right()->Left()->IsBlack()) {

At that point in the code, rbp_r_c is the root node of the tree. If
rbp_r_c->Right() was the sentinel, ->Right()->Left() would be the
sentinel too, and the sentinel is black. Which means the condition would
be true.

The code after was:

  if (rbp_r_c->Right() && (!rbp_r_c->Right()->Left() ||
                           rbp_r_c->Right()->Left()->IsBlack())) {

The second half correctly deals with the case of
rbp_r_c->Right()->Left() being the sentinel. But the first half now
makes things different: ->Right() being null would correspond to the
previous case where it was the sentinel, and the test would not return
true in that case when it would have before. When ->Right() is not null,
things are normal again.

The correct check is to make the branch taken when ->Right() is null.

Now, looking under which conditions we may get in that branch wrongly:
- The root node's right link must be empty, which means a very small tree.
- The comparison between the removed key and the root node must indicate
  the key is greater than the value of the root node.
- There's another case where the comparison result (rbp_r_cmp) can be
  eGreater, when it is reassigned under one of the branches under the
  eEqual test, and that branch is only taken when ->Right() on the root
  node was non-null, which was the non-broken case.

So it would seem we can't reach that code when rbp_r_c->Right() is null
anyways, so it /should/ practically make no difference. Better safe than
sorry, though. It's hard to tell anything from crash stats, because
since the templatization in bug 1403444, all crashes fit in one bucket,
when there used to be 5 functions before :(

While here, add a missing include in rb.h.

--HG--
extra : rebase_source : 2ebcb84345ad52059b0c081b9e2e1af1d0bbb7bc
2018-02-15 14:38:52 +09:00
..
Makefile.in Bug 1413570 - Disable SSE2 when building mozjemalloc on x86 during PGO profile gen phase. r=froydnj 2017-11-02 10:26:49 +09:00
Mutex.h Bug 1423000 - Move mozjemalloc mutexes to a separate header. r=njn 2017-12-03 14:21:19 +09:00
Utils.h Bug 1416170 - Don't use long double constants. r=njn 2017-11-23 11:58:14 +09:00
fallback.cpp Bug 1423114 - Remove moz_xposix_memalign and moz_xvalloc. r=njn 2017-12-05 17:34:19 +09:00
malloc_decls.h Bug 1420353 - Don't define replace_init through malloc_decls.h. r=njn 2017-11-24 16:36:29 +09:00
moz.build Bug 1394734 - Replace CONFIG['MSVC'] by CONFIG['CC_TYPE'] r=glandium 2017-12-08 13:46:13 +01:00
mozjemalloc.cpp Bug 1436541 - Don't clobber the thread-local arenas when we happen to hit a large allocation. r=glandium 2018-02-07 18:17:48 -08:00
mozjemalloc.h Bug 1418104 - Allow to pass parameters when creating arenas. r=njn 2017-11-17 07:27:35 +09:00
mozjemalloc_types.h Bug 1418104 - Allow to pass parameters when creating arenas. r=njn 2017-11-17 07:27:35 +09:00
mozmemory.h Bug 1418104 - Allow to pass parameters when creating arenas. r=njn 2017-11-17 07:27:35 +09:00
mozmemory_wrap.cpp Bug 1413475 - Run clang-format on all files in memory/build/. r=njn 2017-11-01 17:20:54 +09:00
mozmemory_wrap.h Bug 1413475 - Run clang-format on all files in memory/build/. r=njn 2017-11-01 17:20:54 +09:00
rb.h Bug 1438427 - Fix wrong change from bug 1412722 in RedBlackTree::Remove. r=njn 2018-02-15 14:38:52 +09:00
replace_malloc.h Bug 1420355 - Allow to statically link replace-malloc libraries. r=njn 2017-11-23 17:24:19 +09:00
replace_malloc_bridge.h Bug 1413475 - Run clang-format on all files in memory/build/. r=njn 2017-11-01 17:20:54 +09:00
zone.c Bug 1424709 - Force disable the OSX system "nano allocator". r=spohl 2018-01-31 17:18:01 +09:00