Bug 1549986 - Make all concrete implementations of JSTracer final to aid devirtualization r=sfink?
authorJon Coppeard <jcoppeard@mozilla.com>
Thu, 09 May 2019 08:39:23 +0000
changeset 535093 7214702e12d20f2848fc186f752904310d6b276b
parent 535092 c7395b64e19e763c7d1612f4d898e53a2a1f9a7c
child 535094 c84376bb87f13282fb87d9a08a45394c685123f2
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1549986
milestone68.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 1549986 - Make all concrete implementations of JSTracer final to aid devirtualization r=sfink? Differential Revision: https://phabricator.services.mozilla.com/D30362
js/src/builtin/TestingFunctions.cpp
js/src/gc/DeletePolicy.h
js/src/gc/GC.cpp
js/src/gc/GCInternals.h
js/src/gc/Marking.cpp
js/src/gc/RootMarking.cpp
js/src/gc/Verifier.cpp
js/src/jsapi-tests/testGCMarking.cpp
js/src/jsapi-tests/testPrivateGCThingValue.cpp
js/src/jsfriendapi.cpp
js/src/vm/UbiNode.cpp
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -1364,17 +1364,17 @@ static bool NondeterministicGetWeakMapKe
                               "nondeterministicGetWeakMapKeys", "WeakMap",
                               args[0].toObject().getClass()->name);
     return false;
   }
   args.rval().setObject(*arr);
   return true;
 }
 
-class HasChildTracer : public JS::CallbackTracer {
+class HasChildTracer final : public JS::CallbackTracer {
   RootedValue child_;
   bool found_;
 
   void onChild(const JS::GCCellPtr& thing) override {
     if (thing.asCell() == child_.toGCThing()) {
       found_ = true;
     }
   }
--- a/js/src/gc/DeletePolicy.h
+++ b/js/src/gc/DeletePolicy.h
@@ -7,17 +7,17 @@
 #ifndef gc_DeletePolicy_h
 #define gc_DeletePolicy_h
 
 #include "js/TracingAPI.h"
 
 namespace js {
 namespace gc {
 
-struct ClearEdgesTracer : public JS::CallbackTracer {
+struct ClearEdgesTracer final : public JS::CallbackTracer {
   ClearEdgesTracer();
 
 #ifdef DEBUG
   TracerKind getTracerKind() const override { return TracerKind::ClearEdges; }
 #endif
 
   template <typename T>
   inline void clearEdge(T** thingp);
--- a/js/src/gc/GC.cpp
+++ b/js/src/gc/GC.cpp
@@ -4061,17 +4061,17 @@ bool GCRuntime::shouldPreserveJITCode(Re
   if (reason == JS::GCReason::DEBUG_GC) {
     return true;
   }
 
   return false;
 }
 
 #ifdef DEBUG
-class CompartmentCheckTracer : public JS::CallbackTracer {
+class CompartmentCheckTracer final : public JS::CallbackTracer {
   void onChild(const JS::GCCellPtr& thing) override;
 
  public:
   explicit CompartmentCheckTracer(JSRuntime* rt)
       : JS::CallbackTracer(rt),
         src(nullptr),
         zone(nullptr),
         compartment(nullptr) {}
--- a/js/src/gc/GCInternals.h
+++ b/js/src/gc/GCInternals.h
@@ -144,17 +144,17 @@ struct MOZ_RAII AutoStopVerifyingBarrier
 };
 #endif /* JS_GC_ZEAL */
 
 #ifdef JSGC_HASH_TABLE_CHECKS
 void CheckHashTablesAfterMovingGC(JSRuntime* rt);
 void CheckHeapAfterGC(JSRuntime* rt);
 #endif
 
-struct MovingTracer : JS::CallbackTracer {
+struct MovingTracer final : public JS::CallbackTracer {
   explicit MovingTracer(JSRuntime* rt)
       : CallbackTracer(rt, TraceWeakMapKeysValues) {}
 
   void onObjectEdge(JSObject** objp) override;
   void onShapeEdge(Shape** shapep) override;
   void onStringEdge(JSString** stringp) override;
   void onScriptEdge(JSScript** scriptp) override;
   void onLazyScriptEdge(LazyScript** lazyp) override;
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -3366,25 +3366,25 @@ FOR_EACH_PUBLIC_TAGGED_GC_POINTER_TYPE(I
  *   implicit edges to fix any black-gray edges that have been created. This
  *   is implemented in nsXPConnect::FixWeakMappingGrayBits.
  * - To prevent any incorrectly gray objects from escaping to live JS outside
  *   of the containers, we must add unmark-graying read barriers to these
  *   containers.
  */
 
 #ifdef DEBUG
-struct AssertNonGrayTracer : public JS::CallbackTracer {
+struct AssertNonGrayTracer final : public JS::CallbackTracer {
   explicit AssertNonGrayTracer(JSRuntime* rt) : JS::CallbackTracer(rt) {}
   void onChild(const JS::GCCellPtr& thing) override {
     MOZ_ASSERT(!thing.asCell()->isMarkedGray());
   }
 };
 #endif
 
-class UnmarkGrayTracer : public JS::CallbackTracer {
+class UnmarkGrayTracer final : public JS::CallbackTracer {
  public:
   // We set weakMapAction to DoNotTraceWeakMaps because the cycle collector
   // will fix up any color mismatches involving weakmaps when it runs.
   explicit UnmarkGrayTracer(JSRuntime* rt)
       : JS::CallbackTracer(rt, DoNotTraceWeakMaps),
         unmarkedAny(false),
         oom(false),
         stack(rt->gc.unmarkGrayStack) {}
--- a/js/src/gc/RootMarking.cpp
+++ b/js/src/gc/RootMarking.cpp
@@ -410,17 +410,17 @@ void js::gc::GCRuntime::traceRuntimeComm
       if (traceOrMark == TraceRuntime) {
         (*op)(trc, grayRootTracer.data);
       }
     }
   }
 }
 
 #ifdef DEBUG
-class AssertNoRootsTracer : public JS::CallbackTracer {
+class AssertNoRootsTracer final : public JS::CallbackTracer {
   void onChild(const JS::GCCellPtr& thing) override {
     MOZ_CRASH("There should not be any roots after finishRoots");
   }
 
  public:
   AssertNoRootsTracer(JSRuntime* rt, WeakMapTraceKind weakTraceKind)
       : JS::CallbackTracer(rt, weakTraceKind) {}
 };
--- a/js/src/gc/Verifier.cpp
+++ b/js/src/gc/Verifier.cpp
@@ -261,17 +261,17 @@ oom:
   js_delete(trc);
   verifyPreData = nullptr;
 }
 
 static bool IsMarkedOrAllocated(TenuredCell* cell) {
   return cell->isMarkedAny();
 }
 
-struct CheckEdgeTracer : public JS::CallbackTracer {
+struct CheckEdgeTracer final : public JS::CallbackTracer {
   VerifyNode* node;
   explicit CheckEdgeTracer(JSRuntime* rt)
       : JS::CallbackTracer(rt), node(nullptr) {}
   void onChild(const JS::GCCellPtr& thing) override;
 };
 
 static const uint32_t MAX_VERIFIER_EDGES = 1000;
 
--- a/js/src/jsapi-tests/testGCMarking.cpp
+++ b/js/src/jsapi-tests/testGCMarking.cpp
@@ -66,17 +66,17 @@ static bool ConstructCCW(JSContext* cx, 
   if (wrapper->compartment() != global1->compartment()) {
     fprintf(stderr, "wrapper in wrong compartment");
     return false;
   }
 
   return true;
 }
 
-class CCWTestTracer : public JS::CallbackTracer {
+class CCWTestTracer final : public JS::CallbackTracer {
   void onChild(const JS::GCCellPtr& thing) override {
     numberOfThingsTraced++;
 
     printf("*thingp         = %p\n", thing.asCell());
     printf("*expectedThingp = %p\n", *expectedThingp);
 
     printf("kind         = %d\n", static_cast<int>(thing.kind()));
     printf("expectedKind = %d\n", static_cast<int>(expectedKind));
--- a/js/src/jsapi-tests/testPrivateGCThingValue.cpp
+++ b/js/src/jsapi-tests/testPrivateGCThingValue.cpp
@@ -10,17 +10,17 @@
 
 #include "jsapi.h"
 
 #include "js/CompilationAndEvaluation.h"  // JS::CompileDontInflate
 #include "js/HeapAPI.h"
 #include "js/SourceText.h"  // JS::Source{Ownership,Text}
 #include "jsapi-tests/tests.h"
 
-class TestTracer : public JS::CallbackTracer {
+class TestTracer final : public JS::CallbackTracer {
   void onChild(const JS::GCCellPtr& thing) override {
     if (thing.asCell() == expectedCell && thing.kind() == expectedKind) {
       found = true;
     }
   }
 
  public:
   js::gc::Cell* expectedCell;
--- a/js/src/jsfriendapi.cpp
+++ b/js/src/jsfriendapi.cpp
@@ -1001,17 +1001,17 @@ extern JS_FRIEND_API bool JS::ForceLexic
 extern JS_FRIEND_API int JS::IsGCPoisoning() {
 #ifdef JS_GC_POISONING
   return !js::gDisablePoisoning;
 #else
   return false;
 #endif
 }
 
-struct DumpHeapTracer : public JS::CallbackTracer, public WeakMapTracer {
+struct DumpHeapTracer final : public JS::CallbackTracer, public WeakMapTracer {
   const char* prefix;
   FILE* output;
   mozilla::MallocSizeOf mallocSizeOf;
 
   DumpHeapTracer(FILE* fp, JSContext* cx, mozilla::MallocSizeOf mallocSizeOf)
       : JS::CallbackTracer(cx, DoNotTraceWeakMaps),
         js::WeakMapTracer(cx->runtime()),
         prefix(""),
--- a/js/src/vm/UbiNode.cpp
+++ b/js/src/vm/UbiNode.cpp
@@ -186,17 +186,17 @@ Value Node::exposeToJS() const {
 
   ExposeValueToActiveJS(v);
 
   return v;
 }
 
 // A JS::CallbackTracer subclass that adds a Edge to a Vector for each
 // edge on which it is invoked.
-class EdgeVectorTracer : public JS::CallbackTracer {
+class EdgeVectorTracer final : public JS::CallbackTracer {
   // The vector to which we add Edges.
   EdgeVector* vec;
 
   // True if we should populate the edge's names.
   bool wantNames;
 
   void onChild(const JS::GCCellPtr& thing) override {
     if (!okay) {