зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1283855
part 7 - Make JS_SetGCZeal take JSContext instead of JSRuntime. r=sfink
This commit is contained in:
Родитель
acb65dff35
Коммит
3ffa1fd00d
|
@ -797,7 +797,7 @@ InitJSContextForWorker(WorkerPrivate* aWorkerPrivate, JSRuntime* aRuntime)
|
|||
js::SetCTypesActivityCallback(aRuntime, CTypesActivityCallback);
|
||||
|
||||
#ifdef JS_GC_ZEAL
|
||||
JS_SetGCZeal(aRuntime, settings.gcZeal, settings.gcZealFrequency);
|
||||
JS_SetGCZeal(workerCx, settings.gcZeal, settings.gcZealFrequency);
|
||||
#endif
|
||||
|
||||
return workerCx;
|
||||
|
|
|
@ -6378,7 +6378,7 @@ WorkerPrivate::UpdateGCZealInternal(JSContext* aCx, uint8_t aGCZeal,
|
|||
{
|
||||
AssertIsOnWorkerThread();
|
||||
|
||||
JS_SetGCZeal(JS_GetRuntime(aCx), aGCZeal, aFrequency);
|
||||
JS_SetGCZeal(aCx, aGCZeal, aFrequency);
|
||||
|
||||
for (uint32_t index = 0; index < mChildWorkers.Length(); index++) {
|
||||
mChildWorkers[index]->UpdateGCZeal(aGCZeal, aFrequency);
|
||||
|
|
|
@ -259,7 +259,7 @@ GCZeal(JSContext *cx, unsigned argc, JS::Value *vp)
|
|||
if (!ToUint32(cx, args.get(0), &zeal))
|
||||
return false;
|
||||
|
||||
JS_SetGCZeal(JS_GetRuntime(cx), uint8_t(zeal), JS_DEFAULT_ZEAL_FREQ);
|
||||
JS_SetGCZeal(cx, uint8_t(zeal), JS_DEFAULT_ZEAL_FREQ);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -720,7 +720,7 @@ GCZeal(JSContext* cx, unsigned argc, Value* vp)
|
|||
return false;
|
||||
}
|
||||
|
||||
JS_SetGCZeal(cx->runtime(), (uint8_t)zeal, frequency);
|
||||
JS_SetGCZeal(cx, (uint8_t)zeal, frequency);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
@ -1310,7 +1310,7 @@ OOMTest(JSContext* cx, unsigned argc, Value* vp)
|
|||
MOZ_ASSERT(!cx->isExceptionPending());
|
||||
rt->hadOutOfMemory = false;
|
||||
|
||||
JS_SetGCZeal(cx->runtime(), 0, JS_DEFAULT_ZEAL_FREQ);
|
||||
JS_SetGCZeal(cx, 0, JS_DEFAULT_ZEAL_FREQ);
|
||||
|
||||
for (unsigned thread = threadStart; thread < threadEnd; thread++) {
|
||||
if (verbose)
|
||||
|
|
|
@ -99,7 +99,7 @@ BEGIN_TEST(testGCFinalizeCallback)
|
|||
/* Full GC with reset due to new compartment, becoming compartment GC. */
|
||||
|
||||
FinalizeCalls = 0;
|
||||
JS_SetGCZeal(rt, 9, 1000000);
|
||||
JS_SetGCZeal(cx, 9, 1000000);
|
||||
JS::PrepareForFullGC(rt);
|
||||
js::SliceBudget budget(js::WorkBudget(1));
|
||||
rt->gc.startDebugGC(GC_NORMAL, budget);
|
||||
|
@ -120,7 +120,7 @@ BEGIN_TEST(testGCFinalizeCallback)
|
|||
CHECK(!IsCompartmentGCBuffer[i]);
|
||||
CHECK(IsCompartmentGCBuffer[FinalizeCalls - 1]);
|
||||
|
||||
JS_SetGCZeal(rt, 0, 0);
|
||||
JS_SetGCZeal(cx, 0, 0);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ BEGIN_TEST(testIncrementalRoots)
|
|||
|
||||
#ifdef JS_GC_ZEAL
|
||||
// Disable zeal modes because this test needs to control exactly when the GC happens.
|
||||
JS_SetGCZeal(rt, 0, 100);
|
||||
JS_SetGCZeal(cx, 0, 100);
|
||||
#endif
|
||||
|
||||
// Construct a big object graph to mark. In JS, the resulting object graph
|
||||
|
|
|
@ -436,14 +436,14 @@ class AutoLeaveZeal
|
|||
explicit AutoLeaveZeal(JSContext* cx) : cx_(cx) {
|
||||
uint32_t dummy;
|
||||
JS_GetGCZealBits(cx_, &zealBits_, &frequency_, &dummy);
|
||||
JS_SetGCZeal(JS_GetRuntime(cx_), 0, 0);
|
||||
JS_SetGCZeal(cx_, 0, 0);
|
||||
JS::PrepareForFullGC(JS_GetRuntime(cx_));
|
||||
JS::GCForReason(JS_GetRuntime(cx_), GC_SHRINK, JS::gcreason::DEBUG_GC);
|
||||
}
|
||||
~AutoLeaveZeal() {
|
||||
for (size_t i = 0; i < sizeof(zealBits_) * 8; i++) {
|
||||
if (zealBits_ & (1 << i))
|
||||
JS_SetGCZeal(JS_GetRuntime(cx_), i, frequency_);
|
||||
JS_SetGCZeal(cx_, i, frequency_);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -6016,9 +6016,9 @@ JS_GetGCZealBits(JSContext* cx, uint32_t* zealBits, uint32_t* frequency, uint32_
|
|||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetGCZeal(JSRuntime* rt, uint8_t zeal, uint32_t frequency)
|
||||
JS_SetGCZeal(JSContext* cx, uint8_t zeal, uint32_t frequency)
|
||||
{
|
||||
rt->gc.setZeal(zeal, frequency);
|
||||
cx->gc.setZeal(zeal, frequency);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
|
|
|
@ -5533,7 +5533,7 @@ extern JS_PUBLIC_API(void)
|
|||
JS_GetGCZealBits(JSContext* cx, uint32_t* zealBits, uint32_t* frequency, uint32_t* nextScheduled);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_SetGCZeal(JSRuntime* rt, uint8_t zeal, uint32_t frequency);
|
||||
JS_SetGCZeal(JSContext* cx, uint8_t zeal, uint32_t frequency);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_ScheduleGC(JSContext* cx, uint32_t count);
|
||||
|
|
|
@ -3026,7 +3026,7 @@ NS_IMETHODIMP
|
|||
nsXPCComponents_Utils::SetGCZeal(int32_t aValue, JSContext* cx)
|
||||
{
|
||||
#ifdef JS_GC_ZEAL
|
||||
JS_SetGCZeal(JS_GetRuntime(cx), uint8_t(aValue), JS_DEFAULT_ZEAL_FREQ);
|
||||
JS_SetGCZeal(cx, uint8_t(aValue), JS_DEFAULT_ZEAL_FREQ);
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -1562,6 +1562,7 @@ ReloadPrefsCallback(const char* pref, void* data)
|
|||
{
|
||||
XPCJSRuntime* runtime = reinterpret_cast<XPCJSRuntime*>(data);
|
||||
JSRuntime* rt = runtime->Runtime();
|
||||
JSContext* cx = runtime->Context();
|
||||
|
||||
bool safeMode = false;
|
||||
nsCOMPtr<nsIXULRuntime> xr = do_GetService("@mozilla.org/xre/runtime;1");
|
||||
|
@ -1611,7 +1612,7 @@ ReloadPrefsCallback(const char* pref, void* data)
|
|||
Preferences::GetInt(JS_OPTIONS_DOT_STR "gczeal.frequency",
|
||||
JS_DEFAULT_ZEAL_FREQ);
|
||||
if (zeal >= 0) {
|
||||
JS_SetGCZeal(rt, (uint8_t)zeal, zeal_frequency);
|
||||
JS_SetGCZeal(cx, (uint8_t)zeal, zeal_frequency);
|
||||
}
|
||||
#endif // JS_GC_ZEAL
|
||||
|
||||
|
|
|
@ -447,7 +447,7 @@ GCZeal(JSContext* cx, unsigned argc, Value* vp)
|
|||
if (!ToUint32(cx, args.get(0), &zeal))
|
||||
return false;
|
||||
|
||||
JS_SetGCZeal(JS_GetRuntime(cx), uint8_t(zeal), JS_DEFAULT_ZEAL_FREQ);
|
||||
JS_SetGCZeal(cx, uint8_t(zeal), JS_DEFAULT_ZEAL_FREQ);
|
||||
args.rval().setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче