Bug 1637937 - Remove cyclic rope assertions that didn't catch anything r=sfink
authorJon Coppeard <jcoppeard@mozilla.com>
Thu, 21 May 2020 09:25:57 +0000
changeset 531405 c4fc711cc7babf3ed3141fc38f85bf76c459bf9a
parent 531404 038296d39d10f1681a72a78802c92478bd386578
child 531406 ad673505fddf51183c6960154274820f44c6c9c4
push id37439
push userbtara@mozilla.com
push dateThu, 21 May 2020 21:49:34 +0000
treeherdermozilla-central@92c11f0bf14b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1637937
milestone78.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 1637937 - Remove cyclic rope assertions that didn't catch anything r=sfink If these haven't caught any problems I'd like to remove them as they're fairly complex. Differential Revision: https://phabricator.services.mozilla.com/D76122
js/src/gc/Marking.cpp
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -1276,43 +1276,17 @@ inline void js::GCMarker::eagerlyMarkChi
   // marking stack is at the same depth as it was on entry. This way we avoid
   // using tags when pushing ropes to the stack as ropes never leak to other
   // users of the stack. This also assumes that a rope can only point to
   // other ropes or linear strings, it cannot refer to GC things of other
   // types.
   gc::MarkStack& stack = currentStack();
   size_t savedPos = stack.position();
   JS_DIAGNOSTICS_ASSERT(rope->getTraceKind() == JS::TraceKind::String);
-#ifdef JS_DEBUG
-  static const size_t DEEP_ROPE_THRESHOLD = 100000;
-  static const size_t ROPE_CYCLE_HISTORY = 100;
-  DebugOnly<size_t> ropeDepth = 0;
-  JSRope* history[ROPE_CYCLE_HISTORY];
-#endif
   while (true) {
-#ifdef JS_DEBUG
-    if (++ropeDepth >= DEEP_ROPE_THRESHOLD) {
-      // Bug 1011786 comment 294 - detect cyclic ropes. There are some
-      // legitimate deep ropes, at least in tests. So if we hit a deep
-      // rope, start recording the nodes we visit and check whether we
-      // repeat. But do it on a finite window size W so that we're not
-      // scanning the full history for every node. And only check every
-      // Wth push, to add only constant overhead per node. This will only
-      // catch cycles of size up to W (but it seems most likely that any
-      // cycles will be size 1 or maybe 2.)
-      if ((ropeDepth > DEEP_ROPE_THRESHOLD + ROPE_CYCLE_HISTORY) &&
-          (ropeDepth % ROPE_CYCLE_HISTORY) == 0) {
-        for (size_t i = 0; i < ROPE_CYCLE_HISTORY; i++) {
-          MOZ_ASSERT(history[i] != rope, "cycle detected in rope");
-        }
-      }
-      history[ropeDepth % ROPE_CYCLE_HISTORY] = rope;
-    }
-#endif
-
     JS_DIAGNOSTICS_ASSERT(rope->getTraceKind() == JS::TraceKind::String);
     JS_DIAGNOSTICS_ASSERT(rope->JSString::isRope());
     AssertShouldMarkInZone(rope);
     MOZ_ASSERT(rope->isMarkedAny());
     JSRope* next = nullptr;
 
     JSString* right = rope->rightChild();
     if (!right->isPermanentAtom() && mark(right)) {