Bug 1158313 - Move Symbol marking out-of-line; r=jonco
authorTerrence Cole <terrence@mozilla.com>
Fri, 24 Apr 2015 14:52:55 -0700
changeset 241429 45a4435099868e2a7be2c46761304660a4859556
parent 241428 1c0edbdb193606912ee9fd03429ada9fd0e20140
child 241430 ccd154afb3c1dee16566ae8ddb09a9a1971074e3
push id59114
push usertcole@mozilla.com
push dateTue, 28 Apr 2015 16:13:01 +0000
treeherdermozilla-inbound@45a443509986 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1158313
milestone40.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 1158313 - Move Symbol marking out-of-line; r=jonco
js/src/gc/Marking.cpp
js/src/gc/Tracer.h
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -598,41 +598,42 @@ DoMarking<jsid>(GCMarker* gcmarker, jsid
 // to visit the child edges. In the absence of other traversal mechanisms, this
 // function will rapidly grow the stack past its bounds and crash the process.
 // Thus, this generic tracing should only be used in cases where subsequent
 // tracing will not recurse.
 template <typename T>
 void
 js::GCMarker::markAndTraceChildren(T* thing)
 {
-    MOZ_ASSERT(!ThingIsPermanentAtomOrWellKnownSymbol(thing));
+    if (ThingIsPermanentAtomOrWellKnownSymbol(thing))
+        return;
     if (mark(thing))
         thing->traceChildren(this);
 }
 namespace js {
+template <> void GCMarker::traverse(BaseShape* thing) { markAndTraceChildren(thing); }
+template <> void GCMarker::traverse(JS::Symbol* thing) { markAndTraceChildren(thing); }
 template <> void GCMarker::traverse(JSScript* thing) { markAndTraceChildren(thing); }
-template <> void GCMarker::traverse(BaseShape* thing) { markAndTraceChildren(thing); }
 } // namespace js
 
 // Shape, BaseShape, String, and Symbol are extremely common, but have simple
 // patterns of recursion. We traverse trees of these edges immediately, with
 // aggressive, manual inlining, implemented by eagerlyTraceChildren.
 template <typename T>
 void
 js::GCMarker::markAndScan(T* thing)
 {
     if (ThingIsPermanentAtomOrWellKnownSymbol(thing))
         return;
     if (mark(thing))
         eagerlyMarkChildren(thing);
 }
 namespace js {
+template <> void GCMarker::traverse(JSString* thing) { markAndScan(thing); }
 template <> void GCMarker::traverse(LazyScript* thing) { markAndScan(thing); }
-template <> void GCMarker::traverse(JS::Symbol* thing) { markAndScan(thing); }
-template <> void GCMarker::traverse(JSString* thing) { markAndScan(thing); }
 template <> void GCMarker::traverse(Shape* thing) { markAndScan(thing); }
 } // namespace js
 
 // Object and ObjectGroup are extremely common and can contain arbitrarily
 // nested graphs, so are not trivially inlined. In this case we use a mark
 // stack to control recursion. JitCode shares none of these properties, but is
 // included for historical reasons.
 template <typename T>
@@ -1152,23 +1153,16 @@ inline void
 GCMarker::eagerlyMarkChildren(JSString* str)
 {
     if (str->isLinear())
         ScanLinearString(this, &str->asLinear());
     else
         ScanRope(this, &str->asRope());
 }
 
-inline void
-GCMarker::eagerlyMarkChildren(JS::Symbol* sym)
-{
-    if (JSString* desc = sym->description())
-        traverse(desc);
-}
-
 /*
  * This function is used by the cycle collector to trace through a
  * shape. The cycle collector does not care about shapes or base
  * shapes, so those are not marked. Instead, any shapes or base shapes
  * that are encountered have their children marked. Stack space is
  * bounded.
  */
 void
--- a/js/src/gc/Tracer.h
+++ b/js/src/gc/Tracer.h
@@ -242,17 +242,16 @@ class GCMarker : public JSTracer
         pushTaggedPtr(ObjectTag, obj);
     }
 
     template <typename T> void markAndTraceChildren(T* thing);
     template <typename T> void markAndPush(StackTag tag, T* thing);
     template <typename T> void markAndScan(T* thing);
     void eagerlyMarkChildren(Shape* shape);
     void eagerlyMarkChildren(JSString* str);
-    void eagerlyMarkChildren(JS::Symbol* sym);
     void eagerlyMarkChildren(LazyScript *thing);
 
     // We may not have concrete types yet, so this has to be out of the header.
     template <typename T>
     void dispatchToTraceChildren(T* thing);
 
     // Mark the given GC thing, but do not trace its children. Return true
     // if the thing became marked.