Bug 1376899 - Remove unused isZoneGC parameter from GC finalize callback r=sfink r=mccr8
authorJon Coppeard <jcoppeard@mozilla.com>
Tue, 29 Aug 2017 11:58:26 +0100
changeset 377510 dfdb1806e6c70749c9545599cb391541a6357bea
parent 377509 a5f36a07313911f1b700960115a944ac68108a3c
child 377511 05066c02aca871b5f49fe4bbe1d669181dad8b7b
push id32408
push userarchaeopteryx@coole-files.de
push dateTue, 29 Aug 2017 18:31:12 +0000
treeherdermozilla-central@6c3510bac832 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink, mccr8
bugs1376899
milestone57.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 1376899 - Remove unused isZoneGC parameter from GC finalize callback r=sfink r=mccr8
js/src/jsapi-tests/testGCFinalizeCallback.cpp
js/src/jsapi-tests/testIntern.cpp
js/src/jsapi.h
js/src/jsgc.cpp
js/xpconnect/src/XPCJSRuntime.cpp
js/xpconnect/src/xpcprivate.h
--- a/js/src/jsapi-tests/testGCFinalizeCallback.cpp
+++ b/js/src/jsapi-tests/testGCFinalizeCallback.cpp
@@ -2,43 +2,40 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "jsapi-tests/tests.h"
 
 static const unsigned BufferSize = 20;
 static unsigned FinalizeCalls = 0;
 static JSFinalizeStatus StatusBuffer[BufferSize];
-static bool IsZoneGCBuffer[BufferSize];
 
 BEGIN_TEST(testGCFinalizeCallback)
 {
     JS_SetGCParameter(cx, JSGC_MODE, JSGC_MODE_INCREMENTAL);
 
     /* Full GC, non-incremental. */
     FinalizeCalls = 0;
     JS_GC(cx);
     CHECK(cx->runtime()->gc.isFullGc());
     CHECK(checkSingleGroup());
     CHECK(checkFinalizeStatus());
-    CHECK(checkFinalizeIsZoneGC(false));
 
     /* Full GC, incremental. */
     FinalizeCalls = 0;
     JS::PrepareForFullGC(cx);
     JS::StartIncrementalGC(cx, GC_NORMAL, JS::gcreason::API, 1000000);
     while (cx->runtime()->gc.isIncrementalGCInProgress()) {
         JS::PrepareForFullGC(cx);
         JS::IncrementalGCSlice(cx, JS::gcreason::API, 1000000);
     }
     CHECK(!cx->runtime()->gc.isIncrementalGCInProgress());
     CHECK(cx->runtime()->gc.isFullGc());
     CHECK(checkMultipleGroups());
     CHECK(checkFinalizeStatus());
-    CHECK(checkFinalizeIsZoneGC(false));
 
 #ifdef JS_GC_ZEAL
     // Bug 1377593 - the below tests want to control how many zones are GC'ing,
     // and some zeal modes will convert them into all-zones GCs.
     JS_SetGCZeal(cx, 0, 0);
 #endif
 
     JS::RootedObject global1(cx, createTestGlobal());
@@ -50,42 +47,39 @@ BEGIN_TEST(testGCFinalizeCallback)
 
     /* Zone GC, non-incremental, single zone. */
     FinalizeCalls = 0;
     JS::PrepareZoneForGC(global1->zone());
     JS::GCForReason(cx, GC_NORMAL, JS::gcreason::API);
     CHECK(!cx->runtime()->gc.isFullGc());
     CHECK(checkSingleGroup());
     CHECK(checkFinalizeStatus());
-    CHECK(checkFinalizeIsZoneGC(true));
 
     /* Zone GC, non-incremental, multiple zones. */
     FinalizeCalls = 0;
     JS::PrepareZoneForGC(global1->zone());
     JS::PrepareZoneForGC(global2->zone());
     JS::PrepareZoneForGC(global3->zone());
     JS::GCForReason(cx, GC_NORMAL, JS::gcreason::API);
     CHECK(!cx->runtime()->gc.isFullGc());
     CHECK(checkSingleGroup());
     CHECK(checkFinalizeStatus());
-    CHECK(checkFinalizeIsZoneGC(true));
 
     /* Zone GC, incremental, single zone. */
     FinalizeCalls = 0;
     JS::PrepareZoneForGC(global1->zone());
     JS::StartIncrementalGC(cx, GC_NORMAL, JS::gcreason::API, 1000000);
     while (cx->runtime()->gc.isIncrementalGCInProgress()) {
         JS::PrepareZoneForGC(global1->zone());
         JS::IncrementalGCSlice(cx, JS::gcreason::API, 1000000);
     }
     CHECK(!cx->runtime()->gc.isIncrementalGCInProgress());
     CHECK(!cx->runtime()->gc.isFullGc());
     CHECK(checkSingleGroup());
     CHECK(checkFinalizeStatus());
-    CHECK(checkFinalizeIsZoneGC(true));
 
     /* Zone GC, incremental, multiple zones. */
     FinalizeCalls = 0;
     JS::PrepareZoneForGC(global1->zone());
     JS::PrepareZoneForGC(global2->zone());
     JS::PrepareZoneForGC(global3->zone());
     JS::StartIncrementalGC(cx, GC_NORMAL, JS::gcreason::API, 1000000);
     while (cx->runtime()->gc.isIncrementalGCInProgress()) {
@@ -93,17 +87,16 @@ BEGIN_TEST(testGCFinalizeCallback)
         JS::PrepareZoneForGC(global2->zone());
         JS::PrepareZoneForGC(global3->zone());
         JS::IncrementalGCSlice(cx, JS::gcreason::API, 1000000);
     }
     CHECK(!cx->runtime()->gc.isIncrementalGCInProgress());
     CHECK(!cx->runtime()->gc.isFullGc());
     CHECK(checkMultipleGroups());
     CHECK(checkFinalizeStatus());
-    CHECK(checkFinalizeIsZoneGC(true));
 
 #ifdef JS_GC_ZEAL
 
     /* Full GC with reset due to new zone, becoming zone GC. */
 
     FinalizeCalls = 0;
     JS_SetGCZeal(cx, 9, 1000000);
     JS::PrepareForFullGC(cx);
@@ -117,20 +110,16 @@ BEGIN_TEST(testGCFinalizeCallback)
     cx->runtime()->gc.debugGCSlice(budget);
     while (cx->runtime()->gc.isIncrementalGCInProgress())
         cx->runtime()->gc.debugGCSlice(budget);
     CHECK(!cx->runtime()->gc.isIncrementalGCInProgress());
     CHECK(!cx->runtime()->gc.isFullGc());
     CHECK(checkMultipleGroups());
     CHECK(checkFinalizeStatus());
 
-    for (unsigned i = 0; i < FinalizeCalls - 1; ++i)
-        CHECK(!IsZoneGCBuffer[i]);
-    CHECK(IsZoneGCBuffer[FinalizeCalls - 1]);
-
     JS_SetGCZeal(cx, 0, 0);
 
 #endif
 
     /*
      * Make some use of the globals here to ensure the compiler doesn't optimize
      * them away in release builds, causing the zones to be collected and
      * the test to fail.
@@ -192,26 +181,16 @@ bool checkFinalizeStatus()
         CHECK(StatusBuffer[i + 2] == JSFINALIZE_GROUP_END);
     }
 
     CHECK(StatusBuffer[FinalizeCalls - 1] == JSFINALIZE_COLLECTION_END);
 
     return true;
 }
 
-bool checkFinalizeIsZoneGC(bool isZoneGC)
+static void
+FinalizeCallback(JSFreeOp* fop, JSFinalizeStatus status, void* data)
 {
-    for (unsigned i = 0; i < FinalizeCalls; ++i)
-        CHECK(IsZoneGCBuffer[i] == isZoneGC);
-
-    return true;
-}
-
-static void
-FinalizeCallback(JSFreeOp* fop, JSFinalizeStatus status, bool isZoneGC, void* data)
-{
-    if (FinalizeCalls < BufferSize) {
+    if (FinalizeCalls < BufferSize)
         StatusBuffer[FinalizeCalls] = status;
-        IsZoneGCBuffer[FinalizeCalls] = isZoneGC;
-    }
     ++FinalizeCalls;
 }
 END_TEST(testGCFinalizeCallback)
--- a/js/src/jsapi-tests/testIntern.cpp
+++ b/js/src/jsapi-tests/testIntern.cpp
@@ -35,14 +35,14 @@ BEGIN_TEST(testPinAcrossGC)
     CHECK(sw.str);
     JS_AddFinalizeCallback(cx, FinalizeCallback, nullptr);
     JS_GC(cx);
     CHECK(sw.strOk);
     return true;
 }
 
 static void
-FinalizeCallback(JSFreeOp* fop, JSFinalizeStatus status, bool isZoneGC, void* data)
+FinalizeCallback(JSFreeOp* fop, JSFinalizeStatus status, void* data)
 {
     if (status == JSFINALIZE_GROUP_START)
         sw.strOk = js::gc::IsMarkedUnbarriered(fop->runtime(), &sw.str);
 }
 END_TEST(testPinAcrossGC)
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -583,17 +583,17 @@ typedef enum JSFinalizeStatus {
 
     /**
      * Called at the end of collection when everything has been swept.
      */
     JSFINALIZE_COLLECTION_END
 } JSFinalizeStatus;
 
 typedef void
-(* JSFinalizeCallback)(JSFreeOp* fop, JSFinalizeStatus status, bool isZoneGC, void* data);
+(* JSFinalizeCallback)(JSFreeOp* fop, JSFinalizeStatus status, void* data);
 
 typedef void
 (* JSWeakPointerZonesCallback)(JSContext* cx, void* data);
 
 typedef void
 (* JSWeakPointerCompartmentCallback)(JSContext* cx, JSCompartment* comp, void* data);
 
 typedef bool
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -1693,17 +1693,17 @@ GCRuntime::removeFinalizeCallback(JSFina
         }
     }
 }
 
 void
 GCRuntime::callFinalizeCallbacks(FreeOp* fop, JSFinalizeStatus status) const
 {
     for (auto& p : finalizeCallbacks.ref())
-        p.op(fop, status, !isFull, p.data);
+        p.op(fop, status, p.data);
 }
 
 bool
 GCRuntime::addWeakPointerZonesCallback(JSWeakPointerZonesCallback callback, void* data)
 {
     return updateWeakPointerZonesCallbacks.ref().append(
             Callback<JSWeakPointerZonesCallback>(callback, data));
 }
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -767,17 +767,16 @@ XPCJSRuntime::CustomGCCallback(JSGCStatu
     nsTArray<xpcGCCallback> callbacks(extraGCCallbacks);
     for (uint32_t i = 0; i < callbacks.Length(); ++i)
         callbacks[i](status);
 }
 
 /* static */ void
 XPCJSRuntime::FinalizeCallback(JSFreeOp* fop,
                                JSFinalizeStatus status,
-                               bool isZoneGC,
                                void* data)
 {
     XPCJSRuntime* self = nsXPConnect::GetRuntimeInstance();
     if (!self)
         return;
 
     switch (status) {
         case JSFINALIZE_GROUP_PREPARE:
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -605,17 +605,16 @@ public:
     void CustomOutOfMemoryCallback() override;
     void OnLargeAllocationFailure();
     static void GCSliceCallback(JSContext* cx,
                                 JS::GCProgress progress,
                                 const JS::GCDescription& desc);
     static void DoCycleCollectionCallback(JSContext* cx);
     static void FinalizeCallback(JSFreeOp* fop,
                                  JSFinalizeStatus status,
-                                 bool isZoneGC,
                                  void* data);
     static void WeakPointerZonesCallback(JSContext* cx, void* data);
     static void WeakPointerCompartmentCallback(JSContext* cx, JSCompartment* comp, void* data);
 
     inline void AddVariantRoot(XPCTraceableVariant* variant);
     inline void AddWrappedJSRoot(nsXPCWrappedJS* wrappedJS);
 
     void DebugDump(int16_t depth);