mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1283855
part 25 - Make JS_GC take JSContext instead of JSRuntime. r=terrence
This commit is contained in:
parent
cd41339786
commit
96da4695c8
@ -2583,7 +2583,7 @@ WorkerThreadPrimaryRunnable::Run()
|
||||
|
||||
// Perform a full GC. This will collect the main worker global and CC,
|
||||
// which should break all cycles that touch JS.
|
||||
JS_GC(JS_GetRuntime(cx));
|
||||
JS_GC(cx);
|
||||
|
||||
// Before shutting down the cycle collector we need to do one more pass
|
||||
// through the event loop to clean up any C++ objects that need deferred
|
||||
|
@ -240,11 +240,8 @@ GC(JSContext *cx,
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
JSRuntime *rt = JS_GetRuntime(cx);
|
||||
JS_GC(rt);
|
||||
#ifdef JS_GCMETER
|
||||
js_DumpGCStats(rt, stdout);
|
||||
#endif
|
||||
JS_GC(cx);
|
||||
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
@ -470,8 +467,7 @@ XPCShellEnvironment::~XPCShellEnvironment()
|
||||
}
|
||||
mGlobalHolder.reset();
|
||||
|
||||
JSRuntime *rt = JS_GetRuntime(cx);
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,8 +148,8 @@ BEGIN_TEST(testArrayBuffer_bug720949_viewList)
|
||||
|
||||
static void GC(JSContext* cx)
|
||||
{
|
||||
JS_GC(JS_GetRuntime(cx));
|
||||
JS_GC(JS_GetRuntime(cx)); // Trigger another to wait for background finalization to end
|
||||
JS_GC(cx);
|
||||
JS_GC(cx); // Trigger another to wait for background finalization to end
|
||||
}
|
||||
|
||||
bool hasDetachedBuffer(JS::HandleObject obj) {
|
||||
|
@ -37,7 +37,7 @@ static JSObject*
|
||||
PreWrap(JSContext* cx, JS::HandleObject scope, JS::HandleObject obj,
|
||||
JS::HandleObject objectPassedToWrap)
|
||||
{
|
||||
JS_GC(JS_GetRuntime(cx));
|
||||
JS_GC(cx);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -10,9 +10,9 @@ char test_data[] = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwx
|
||||
|
||||
static void GC(JSContext* cx)
|
||||
{
|
||||
JS_GC(JS_GetRuntime(cx));
|
||||
JS_GC(cx);
|
||||
// Trigger another to wait for background finalization to end.
|
||||
JS_GC(JS_GetRuntime(cx));
|
||||
JS_GC(cx);
|
||||
}
|
||||
|
||||
BEGIN_TEST(testExternalArrayBuffer)
|
||||
|
@ -48,7 +48,7 @@ BEGIN_TEST(testExternalStrings)
|
||||
// clear that newborn root
|
||||
JS_NewUCStringCopyN(cx, arr, arrlen);
|
||||
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
|
||||
// a generous fudge factor to account for strings rooted by conservative gc
|
||||
const unsigned epsilon = 10;
|
||||
|
@ -20,7 +20,7 @@ BEGIN_TEST(testGCExactRooting)
|
||||
JS::RootedObject rootCx(cx, JS_NewPlainObject(cx));
|
||||
JS::RootedObject rootRt(cx->runtime(), JS_NewPlainObject(cx));
|
||||
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
|
||||
/* Use the objects we just created to ensure that they are still alive. */
|
||||
JS_DefineProperty(cx, rootCx, "foo", JS::UndefinedHandleValue, 0);
|
||||
@ -79,8 +79,8 @@ BEGIN_TEST(testGCRootedStaticStructInternalStackStorageAugmented)
|
||||
container.obj() = JS_NewObject(cx, nullptr);
|
||||
container.str() = JS_NewStringCopyZ(cx, "Hello");
|
||||
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
JS_GC(cx);
|
||||
|
||||
JS::RootedObject obj(cx, container.obj());
|
||||
JS::RootedValue val(cx, StringValue(container.str()));
|
||||
@ -107,8 +107,8 @@ BEGIN_TEST(testGCRootedStaticStructInternalStackStorageAugmented)
|
||||
obj = nullptr;
|
||||
actual = nullptr;
|
||||
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
JS_GC(cx);
|
||||
|
||||
obj = heap.obj();
|
||||
CHECK(JS_GetProperty(cx, obj, "foo", &val));
|
||||
@ -172,8 +172,8 @@ BEGIN_TEST(testGCRootedHashMap)
|
||||
CHECK(map.putNew(obj->as<NativeObject>().lastProperty(), obj));
|
||||
}
|
||||
|
||||
JS_GC(rt);
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
JS_GC(cx);
|
||||
|
||||
for (auto r = map.all(); !r.empty(); r.popFront()) {
|
||||
RootedObject obj(cx, r.front().value());
|
||||
@ -222,8 +222,8 @@ BEGIN_TEST(testGCHandleHashMap)
|
||||
|
||||
CHECK(FillMyHashMap(cx, &map));
|
||||
|
||||
JS_GC(rt);
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
JS_GC(cx);
|
||||
|
||||
CHECK(CheckMyHashMap(cx, map));
|
||||
|
||||
@ -249,8 +249,8 @@ BEGIN_TEST(testGCRootedVector)
|
||||
CHECK(shapes.append(obj->as<NativeObject>().lastProperty()));
|
||||
}
|
||||
|
||||
JS_GC(rt);
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
JS_GC(cx);
|
||||
|
||||
for (size_t i = 0; i < 10; ++i) {
|
||||
// Check the shape to ensure it did not get collected.
|
||||
@ -327,8 +327,8 @@ BEGIN_TEST(testTraceableFifo)
|
||||
|
||||
CHECK(shapes.length() == 10);
|
||||
|
||||
JS_GC(rt);
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
JS_GC(cx);
|
||||
|
||||
for (size_t i = 0; i < 10; ++i) {
|
||||
// Check the shape to ensure it did not get collected.
|
||||
@ -404,8 +404,8 @@ BEGIN_TEST(testGCHandleVector)
|
||||
|
||||
CHECK(FillVector(cx, &vec));
|
||||
|
||||
JS_GC(rt);
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
JS_GC(cx);
|
||||
|
||||
CHECK(CheckVector(cx, vec));
|
||||
|
||||
|
@ -15,7 +15,7 @@ BEGIN_TEST(testGCFinalizeCallback)
|
||||
|
||||
/* Full GC, non-incremental. */
|
||||
FinalizeCalls = 0;
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
CHECK(rt->gc.isFullGc());
|
||||
CHECK(checkSingleGroup());
|
||||
CHECK(checkFinalizeStatus());
|
||||
|
@ -17,10 +17,10 @@ BEGIN_TEST(testGCHeapPostBarriers)
|
||||
#endif /* JS_GC_ZEAL */
|
||||
|
||||
/* Sanity check - objects start in the nursery and then become tenured. */
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
JS::RootedObject obj(cx, NurseryObject());
|
||||
CHECK(js::gc::IsInsideNursery(obj.get()));
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
CHECK(!js::gc::IsInsideNursery(obj.get()));
|
||||
JS::RootedObject tenuredObject(cx, obj);
|
||||
|
||||
|
@ -32,7 +32,7 @@ BEGIN_TEST(testGCOutOfMemory)
|
||||
CHECK(match);
|
||||
JS_ClearPendingException(cx);
|
||||
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
|
||||
// The above GC should have discarded everything. Verify that we can now
|
||||
// allocate half as many objects without OOMing.
|
||||
|
@ -22,10 +22,10 @@ volatile int AutoIgnoreRootingHazards::depth = 0;
|
||||
BEGIN_TEST(testGCStoreBufferRemoval)
|
||||
{
|
||||
// Sanity check - objects start in the nursery and then become tenured.
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
JS::RootedObject obj(cx, NurseryObject());
|
||||
CHECK(js::gc::IsInsideNursery(obj.get()));
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
CHECK(!js::gc::IsInsideNursery(obj.get()));
|
||||
JS::RootedObject tenuredObject(cx, obj);
|
||||
|
||||
@ -42,21 +42,21 @@ BEGIN_TEST(testGCStoreBufferRemoval)
|
||||
*relocPtr = NurseryObject();
|
||||
relocPtr->~HeapPtr<JSObject*>();
|
||||
punnedPtr = badObject;
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
|
||||
new (relocPtr) HeapPtr<JSObject*>;
|
||||
*relocPtr = NurseryObject();
|
||||
*relocPtr = tenuredObject;
|
||||
relocPtr->~HeapPtr<JSObject*>();
|
||||
punnedPtr = badObject;
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
|
||||
new (relocPtr) HeapPtr<JSObject*>;
|
||||
*relocPtr = NurseryObject();
|
||||
*relocPtr = nullptr;
|
||||
relocPtr->~HeapPtr<JSObject*>();
|
||||
punnedPtr = badObject;
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
}
|
||||
|
||||
// Test removal of store buffer entries added by HeapPtr<Value>.
|
||||
@ -67,21 +67,21 @@ BEGIN_TEST(testGCStoreBufferRemoval)
|
||||
*relocValue = ObjectValue(*NurseryObject());
|
||||
relocValue->~HeapPtr<Value>();
|
||||
punnedValue = ObjectValueCrashOnTouch();
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
|
||||
new (relocValue) HeapPtr<Value>;
|
||||
*relocValue = ObjectValue(*NurseryObject());
|
||||
*relocValue = ObjectValue(*tenuredObject);
|
||||
relocValue->~HeapPtr<Value>();
|
||||
punnedValue = ObjectValueCrashOnTouch();
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
|
||||
new (relocValue) HeapPtr<Value>;
|
||||
*relocValue = ObjectValue(*NurseryObject());
|
||||
*relocValue = NullValue();
|
||||
relocValue->~HeapPtr<Value>();
|
||||
punnedValue = ObjectValueCrashOnTouch();
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
}
|
||||
|
||||
// Test removal of store buffer entries added by Heap<T>.
|
||||
@ -94,21 +94,21 @@ BEGIN_TEST(testGCStoreBufferRemoval)
|
||||
*heapPtr = NurseryObject();
|
||||
heapPtr->~Heap<JSObject*>();
|
||||
punnedPtr = badObject;
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
|
||||
new (heapPtr) Heap<JSObject*>;
|
||||
*heapPtr = NurseryObject();
|
||||
*heapPtr = tenuredObject;
|
||||
heapPtr->~Heap<JSObject*>();
|
||||
punnedPtr = badObject;
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
|
||||
new (heapPtr) Heap<JSObject*>;
|
||||
*heapPtr = NurseryObject();
|
||||
*heapPtr = nullptr;
|
||||
heapPtr->~Heap<JSObject*>();
|
||||
punnedPtr = badObject;
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -16,8 +16,8 @@ MinimizeHeap(JSRuntime* rt)
|
||||
{
|
||||
// The second collection is to force us to wait for the background
|
||||
// sweeping that the first GC started to finish.
|
||||
JS_GC(rt);
|
||||
JS_GC(rt);
|
||||
JS_GC(JS_GetContext(rt));
|
||||
JS_GC(JS_GetContext(rt));
|
||||
js::gc::FinishGC(rt);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ BEGIN_TEST(testWeakCacheSet)
|
||||
// the test will continue to work, it will just not test as much.
|
||||
JS::RootedObject tenured1(cx, JS_NewPlainObject(cx));
|
||||
JS::RootedObject tenured2(cx, JS_NewPlainObject(cx));
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
JS::RootedObject nursery1(cx, JS_NewPlainObject(cx));
|
||||
JS::RootedObject nursery2(cx, JS_NewPlainObject(cx));
|
||||
|
||||
@ -35,7 +35,7 @@ BEGIN_TEST(testWeakCacheSet)
|
||||
cache.put(nursery2);
|
||||
|
||||
// Verify relocation and that we don't sweep too aggressively.
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
CHECK(cache.has(tenured1));
|
||||
CHECK(cache.has(tenured2));
|
||||
CHECK(cache.has(nursery1));
|
||||
@ -43,7 +43,7 @@ BEGIN_TEST(testWeakCacheSet)
|
||||
|
||||
// Unroot two entries and verify that they get removed.
|
||||
tenured2 = nursery2 = nullptr;
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
CHECK(cache.has(tenured1));
|
||||
CHECK(cache.has(nursery1));
|
||||
CHECK(cache.count() == 2);
|
||||
@ -60,7 +60,7 @@ BEGIN_TEST(testWeakCacheMap)
|
||||
// the test will continue to work, it will just not test as much.
|
||||
JS::RootedObject tenured1(cx, JS_NewPlainObject(cx));
|
||||
JS::RootedObject tenured2(cx, JS_NewPlainObject(cx));
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
JS::RootedObject nursery1(cx, JS_NewPlainObject(cx));
|
||||
JS::RootedObject nursery2(cx, JS_NewPlainObject(cx));
|
||||
|
||||
@ -75,14 +75,14 @@ BEGIN_TEST(testWeakCacheMap)
|
||||
cache.put(nursery1, 3);
|
||||
cache.put(nursery2, 4);
|
||||
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
CHECK(cache.has(tenured1));
|
||||
CHECK(cache.has(tenured2));
|
||||
CHECK(cache.has(nursery1));
|
||||
CHECK(cache.has(nursery2));
|
||||
|
||||
tenured2 = nursery2 = nullptr;
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
CHECK(cache.has(tenured1));
|
||||
CHECK(cache.has(nursery1));
|
||||
CHECK(cache.count() == 2);
|
||||
|
@ -46,7 +46,7 @@ BEGIN_TEST(testGCWeakRef)
|
||||
|
||||
// A full collection with a second ref should keep the object as well.
|
||||
CHECK(obj == heap.get().weak);
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
CHECK(obj == heap.get().weak);
|
||||
v = JS::UndefinedValue();
|
||||
CHECK(JS_GetProperty(cx, obj, "x", &v));
|
||||
@ -56,7 +56,7 @@ BEGIN_TEST(testGCWeakRef)
|
||||
// A full collection after nulling the root should collect the object, or
|
||||
// at least null out the weak reference before returning to the mutator.
|
||||
obj = nullptr;
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
CHECK(heap.get().weak == nullptr);
|
||||
|
||||
return true;
|
||||
|
@ -34,7 +34,7 @@ BEGIN_TEST(testPinAcrossGC)
|
||||
sw.strOk = false;
|
||||
CHECK(sw.str);
|
||||
JS_AddFinalizeCallback(cx, FinalizeCallback, nullptr);
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
CHECK(sw.strOk);
|
||||
return true;
|
||||
}
|
||||
|
@ -13,14 +13,14 @@ BEGIN_TEST(testIsInsideNursery)
|
||||
CHECK(!rt->gc.nursery.isInside(rt));
|
||||
CHECK(!rt->gc.nursery.isInside((void*)nullptr));
|
||||
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
|
||||
JS::RootedObject object(cx, JS_NewPlainObject(cx));
|
||||
|
||||
/* Objects are initially allocated in the nursery. */
|
||||
CHECK(js::gc::IsInsideNursery(object));
|
||||
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
|
||||
/* And are tenured if still live after a GC. */
|
||||
CHECK(!js::gc::IsInsideNursery(object));
|
||||
|
@ -177,9 +177,9 @@ bool TestTransferObject()
|
||||
|
||||
static void GC(JSContext* cx)
|
||||
{
|
||||
JS_GC(JS_GetRuntime(cx));
|
||||
JS_GC(cx);
|
||||
// Trigger another to wait for background finalization to end.
|
||||
JS_GC(JS_GetRuntime(cx));
|
||||
JS_GC(cx);
|
||||
}
|
||||
|
||||
END_TEST(testMappedArrayBuffer_bug945152)
|
||||
|
@ -14,7 +14,7 @@ BEGIN_TEST(testNullRoot)
|
||||
script.init(cx, nullptr);
|
||||
|
||||
// This used to crash because obj was nullptr.
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ GCFinalizesNBarkers(JSContext* cx, int n)
|
||||
int preGCTrace = BarkWhenTracedClass::traceCount;
|
||||
int preGCFinalize = BarkWhenTracedClass::finalizeCount;
|
||||
|
||||
JS_GC(JS_GetRuntime(cx));
|
||||
JS_GC(cx);
|
||||
|
||||
return (BarkWhenTracedClass::finalizeCount == preGCFinalize + n &&
|
||||
BarkWhenTracedClass::traceCount > preGCTrace);
|
||||
@ -94,7 +94,7 @@ BEGIN_TEST(test_PersistentRooted)
|
||||
kennel = nullptr;
|
||||
|
||||
// Now GC should not be able to find the barker.
|
||||
JS_GC(JS_GetRuntime(cx));
|
||||
JS_GC(cx);
|
||||
CHECK(BarkWhenTracedClass::finalizeCount == 1);
|
||||
|
||||
return true;
|
||||
@ -109,7 +109,7 @@ BEGIN_TEST(test_PersistentRootedNull)
|
||||
Kennel kennel(cx);
|
||||
CHECK(!kennel.obj);
|
||||
|
||||
JS_GC(JS_GetRuntime(cx));
|
||||
JS_GC(cx);
|
||||
CHECK(BarkWhenTracedClass::finalizeCount == 0);
|
||||
|
||||
return true;
|
||||
@ -139,7 +139,7 @@ BEGIN_TEST(test_PersistentRootedCopy)
|
||||
|
||||
// Now that kennel and nowKennel are both deallocated, GC should not be
|
||||
// able to find the barker.
|
||||
JS_GC(JS_GetRuntime(cx));
|
||||
JS_GC(cx);
|
||||
CHECK(BarkWhenTracedClass::finalizeCount == 1);
|
||||
|
||||
return true;
|
||||
@ -184,7 +184,7 @@ BEGIN_TEST(test_PersistentRootedAssign)
|
||||
|
||||
// Now that kennel and kennel2 are both deallocated, GC should not be
|
||||
// able to find the barker.
|
||||
JS_GC(JS_GetRuntime(cx));
|
||||
JS_GC(cx);
|
||||
CHECK(BarkWhenTracedClass::finalizeCount == 2);
|
||||
|
||||
return true;
|
||||
@ -216,7 +216,7 @@ BEGIN_TEST(test_GlobalPersistentRooted)
|
||||
CHECK(!gGlobalRoot.initialized());
|
||||
|
||||
// Now GC should not be able to find the barker.
|
||||
JS_GC(JS_GetRuntime(cx));
|
||||
JS_GC(cx);
|
||||
CHECK(BarkWhenTracedClass::finalizeCount == 1);
|
||||
|
||||
return true;
|
||||
|
@ -102,7 +102,7 @@ BEGIN_TEST(testSavedStacks_RangeBasedForLoops)
|
||||
|
||||
JS::Rooted<js::SavedFrame*> rf(cx, savedFrame);
|
||||
for (JS::Handle<js::SavedFrame*> frame : js::SavedFrame::RootedRange(cx, rf)) {
|
||||
JS_GC(cx->runtime());
|
||||
JS_GC(cx);
|
||||
CHECK(frame == rf);
|
||||
rf = rf->getParent();
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ struct ScriptObjectFixture : public JSAPITest {
|
||||
{
|
||||
CHECK(script);
|
||||
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
|
||||
/* After a garbage collection, the script should still work. */
|
||||
JS::RootedValue result(cx);
|
||||
|
@ -35,14 +35,14 @@ BEGIN_TEST(testWeakMap_basicOperations)
|
||||
CHECK(r == val);
|
||||
CHECK(checkSize(map, 1));
|
||||
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
|
||||
CHECK(GetWeakMapEntry(cx, map, key, &r));
|
||||
CHECK(r == val);
|
||||
CHECK(checkSize(map, 1));
|
||||
|
||||
key = nullptr;
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
|
||||
CHECK(checkSize(map, 0));
|
||||
|
||||
@ -71,7 +71,7 @@ END_TEST(testWeakMap_basicOperations)
|
||||
BEGIN_TEST(testWeakMap_keyDelegates)
|
||||
{
|
||||
JS_SetGCParameter(cx, JSGC_MODE, JSGC_MODE_INCREMENTAL);
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
JS::RootedObject map(cx, JS::NewWeakMapObject(cx));
|
||||
CHECK(map);
|
||||
|
||||
@ -130,7 +130,7 @@ BEGIN_TEST(testWeakMap_keyDelegates)
|
||||
/* Check that when the delegate becomes unreachable the entry is removed. */
|
||||
delegateRoot = nullptr;
|
||||
keyDelegate = nullptr;
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
CHECK(checkSize(map, 0));
|
||||
|
||||
return true;
|
||||
|
@ -70,7 +70,7 @@ BEGIN_TEST(testXDR_bug506491)
|
||||
CHECK(JS_ExecuteScript(cx, script, &v2));
|
||||
|
||||
// try to break the Block object that is the parent of f
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
|
||||
// confirm
|
||||
EVAL("f() === 'ok';\n", &v2);
|
||||
|
@ -1333,11 +1333,11 @@ JS_RemoveExtraGCRootsTracer(JSContext* cx, JSTraceDataOp traceOp, void* data)
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_GC(JSRuntime* rt)
|
||||
JS_GC(JSContext* cx)
|
||||
{
|
||||
AssertHeapIsIdle(rt);
|
||||
JS::PrepareForFullGC(rt);
|
||||
rt->gc.gc(GC_NORMAL, JS::gcreason::API);
|
||||
AssertHeapIsIdle(cx);
|
||||
JS::PrepareForFullGC(cx);
|
||||
cx->gc.gc(GC_NORMAL, JS::gcreason::API);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
|
@ -1608,7 +1608,7 @@ JS_RemoveExtraGCRootsTracer(JSContext* cx, JSTraceDataOp traceOp, void* data);
|
||||
* Garbage collector API.
|
||||
*/
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_GC(JSRuntime* rt);
|
||||
JS_GC(JSContext* cx);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_MaybeGC(JSContext* cx);
|
||||
|
@ -429,11 +429,9 @@ static bool
|
||||
GC(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JSRuntime* rt = JS_GetRuntime(cx);
|
||||
JS_GC(rt);
|
||||
#ifdef JS_GCMETER
|
||||
js_DumpGCStats(rt, stdout);
|
||||
#endif
|
||||
|
||||
JS_GC(cx);
|
||||
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
@ -1583,9 +1581,9 @@ XRE_XPCShellMain(int argc, char** argv, char** envp,
|
||||
JS_DropPrincipals(cx, gJSPrincipals);
|
||||
JS_SetAllNonReservedSlotsToUndefined(cx, glob);
|
||||
JS_SetAllNonReservedSlotsToUndefined(cx, JS_GlobalLexicalScope(glob));
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
}
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
} // this scopes the nsCOMPtrs
|
||||
|
||||
if (!XRE_ShutdownTestShell())
|
||||
|
@ -1079,7 +1079,7 @@ nsXREDirProvider::DoShutdown()
|
||||
|
||||
JSRuntime *rt = xpc::GetJSRuntime();
|
||||
if (rt) {
|
||||
JS_GC(rt);
|
||||
JS_GC(JS_GetContext(rt));
|
||||
}
|
||||
|
||||
// Phase 3: Notify observers of a profile change
|
||||
|
@ -40,9 +40,9 @@ const size_t InitialElements = ElementCount / 10;
|
||||
|
||||
template<class ArrayT>
|
||||
static void
|
||||
RunTest(JSRuntime* rt, JSContext* cx, ArrayT* array)
|
||||
RunTest(JSContext* cx, ArrayT* array)
|
||||
{
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
|
||||
ASSERT_TRUE(array != nullptr);
|
||||
JS_AddExtraGCRootsTracer(cx, TraceArray<ArrayT>, array);
|
||||
@ -65,7 +65,7 @@ RunTest(JSRuntime* rt, JSContext* cx, ArrayT* array)
|
||||
* If postbarriers are not working, we will crash here when we try to mark
|
||||
* objects that have been moved to the tenured heap.
|
||||
*/
|
||||
JS_GC(rt);
|
||||
JS_GC(cx);
|
||||
|
||||
/*
|
||||
* Sanity check that our array contains what we expect.
|
||||
@ -82,7 +82,7 @@ RunTest(JSRuntime* rt, JSContext* cx, ArrayT* array)
|
||||
}
|
||||
|
||||
static void
|
||||
CreateGlobalAndRunTest(JSRuntime* rt, JSContext* cx)
|
||||
CreateGlobalAndRunTest(JSContext* cx)
|
||||
{
|
||||
static const JSClassOps GlobalClassOps = {
|
||||
nullptr, nullptr, nullptr, nullptr,
|
||||
@ -108,19 +108,19 @@ CreateGlobalAndRunTest(JSRuntime* rt, JSContext* cx)
|
||||
|
||||
{
|
||||
nsTArray<ElementT>* array = new nsTArray<ElementT>(InitialElements);
|
||||
RunTest(rt, cx, array);
|
||||
RunTest(cx, array);
|
||||
delete array;
|
||||
}
|
||||
|
||||
{
|
||||
FallibleTArray<ElementT>* array = new FallibleTArray<ElementT>(InitialElements);
|
||||
RunTest(rt, cx, array);
|
||||
RunTest(cx, array);
|
||||
delete array;
|
||||
}
|
||||
|
||||
{
|
||||
AutoTArray<ElementT, InitialElements> array;
|
||||
RunTest(rt, cx, &array);
|
||||
RunTest(cx, &array);
|
||||
}
|
||||
|
||||
JS_LeaveCompartment(cx, oldCompartment);
|
||||
@ -136,7 +136,7 @@ TEST(GCPostBarriers, nsTArray) {
|
||||
|
||||
JS_BeginRequest(cx);
|
||||
|
||||
CreateGlobalAndRunTest(rt, cx);
|
||||
CreateGlobalAndRunTest(cx);
|
||||
|
||||
JS_EndRequest(cx);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user