Bug 1507322 - mark implicit edges via mark stack instead of eagerly, r=jonco
authorSteve Fink <sfink@mozilla.com>
Fri, 11 Jan 2019 15:43:56 -0800
changeset 513835 5ecfcb615bd62bb2a7760799c19299fd93921aa7
parent 513834 bff0f583c673817e12c12a561deab99a56548af6
child 513836 e49161da578400faf8e938324caff120b95f4863
child 513837 62f90a1062e5d87c38c5431c17af6fbdd8c7b059
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1507322
milestone66.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 1507322 - mark implicit edges via mark stack instead of eagerly, r=jonco
js/src/gc/GCMarker.h
js/src/gc/Marking.cpp
js/src/vm/JSScript.cpp
--- a/js/src/gc/GCMarker.h
+++ b/js/src/gc/GCMarker.h
@@ -312,16 +312,19 @@ class GCMarker : public JSTracer {
   size_t getMarkCount() const { return markCount; }
   void clearMarkCount() { markCount = 0; }
 
   static GCMarker* fromTracer(JSTracer* trc) {
     MOZ_ASSERT(trc->isMarkingTracer());
     return static_cast<GCMarker*>(trc);
   }
 
+  template <typename T>
+  void markImplicitEdges(T* oldThing);
+
  private:
 #ifdef DEBUG
   void checkZone(void* p);
 #else
   void checkZone(void* p) {}
 #endif
 
   // Push an object onto the stack for later tracing and assert that it has
@@ -331,18 +334,16 @@ class GCMarker : public JSTracer {
   template <typename T>
   void markAndTraceChildren(T* thing);
   template <typename T>
   void markAndPush(T* thing);
   template <typename T>
   void markAndScan(T* thing);
   template <typename T>
   void markImplicitEdgesHelper(T oldThing);
-  template <typename T>
-  void markImplicitEdges(T* oldThing);
   void eagerlyMarkChildren(JSLinearString* str);
   void eagerlyMarkChildren(JSRope* rope);
   void eagerlyMarkChildren(JSString* str);
   void eagerlyMarkChildren(LazyScript* thing);
   void eagerlyMarkChildren(Shape* shape);
   void eagerlyMarkChildren(Scope* scope);
   void lazilyMarkChildren(ObjectGroup* group);
 
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -672,16 +672,20 @@ void GCMarker::markImplicitEdgesHelper(T
 template <>
 void GCMarker::markImplicitEdgesHelper(HasNoImplicitEdgesType) {}
 
 template <typename T>
 void GCMarker::markImplicitEdges(T* thing) {
   markImplicitEdgesHelper<typename ImplicitEdgeHolderType<T*>::Type>(thing);
 }
 
+template void GCMarker::markImplicitEdges(JSObject*);
+template void GCMarker::markImplicitEdges(JSScript*);
+template void GCMarker::markImplicitEdges(LazyScript*);
+
 }  // namespace js
 
 template <typename T>
 static inline bool ShouldMark(GCMarker* gcmarker, T thing) {
   // Don't trace things that are owned by another runtime.
   if (IsOwnedByOtherRuntime(gcmarker->runtime(), thing)) {
     return false;
   }
@@ -861,17 +865,16 @@ void GCMarker::traverse(js::Scope* thing
 // included for historical reasons. JSScript normally cannot recurse, but may
 // be used as a weakmap key and thereby recurse into weakmapped values.
 template <typename T>
 void js::GCMarker::markAndPush(T* thing) {
   if (!mark(thing)) {
     return;
   }
   pushTaggedPtr(thing);
-  markImplicitEdges(thing);
 }
 namespace js {
 template <>
 void GCMarker::traverse(JSObject* thing) {
   markAndPush(thing);
 }
 template <>
 void GCMarker::traverse(ObjectGroup* thing) {
@@ -1022,16 +1025,20 @@ void LazyScript::traceChildren(JSTracer*
                                  "closedOverBinding");
     }
   }
 
   GCPtrFunction* innerFunctions = this->innerFunctions();
   for (auto i : IntegerRange(numInnerFunctions())) {
     TraceEdge(trc, &innerFunctions[i], "lazyScriptInnerFunction");
   }
+
+  if (trc->isMarkingTracer()) {
+    return GCMarker::fromTracer(trc)->markImplicitEdges(this);
+  }
 }
 inline void js::GCMarker::eagerlyMarkChildren(LazyScript* thing) {
   if (thing->script_) {
     noteWeakEdge(thing->script_.unsafeUnbarrieredForTracing());
   }
 
   if (thing->function_) {
     traverseEdge(thing, static_cast<JSObject*>(thing->function_));
--- a/js/src/vm/JSScript.cpp
+++ b/js/src/vm/JSScript.cpp
@@ -4380,16 +4380,20 @@ void JSScript::traceChildren(JSTracer* t
     TraceManuallyBarrieredEdge(trc, &lazyScript, "lazyScript");
   }
 
   if (trc->isMarkingTracer()) {
     realm()->mark();
   }
 
   jit::TraceJitScripts(trc, this);
+
+  if (trc->isMarkingTracer()) {
+    return GCMarker::fromTracer(trc)->markImplicitEdges(this);
+  }
 }
 
 void LazyScript::finalize(FreeOp* fop) { fop->free_(table_); }
 
 size_t JSScript::calculateLiveFixed(jsbytecode* pc) {
   size_t nlivefixed = numAlwaysLiveFixedSlots();
 
   if (nfixed() != nlivefixed) {