зеркало из https://github.com/mozilla/gecko-dev.git
Bug 903212 - Add a GC when popping a script entry point. r=mrbkap
I think that this is more or less isomorphic with the MaybeGC we do in ScriptEvaluated in the cases that matter. And doing it in a spec-defined place is helpful in getting rid of spec-nonsensical machinery.
This commit is contained in:
Родитель
4c9559f8e1
Коммит
0a570c79b5
|
@ -146,6 +146,15 @@ AutoCxPusher::AutoCxPusher(JSContext* cx, bool allowNull) : mScriptIsRunning(fal
|
|||
NS_EXPORT
|
||||
AutoCxPusher::~AutoCxPusher()
|
||||
{
|
||||
// GC when we pop a script entry point. This is a useful heuristic that helps
|
||||
// us out on certain (flawed) benchmarks like sunspider, because it lets us
|
||||
// avoid GCing during the timing loop.
|
||||
//
|
||||
// NB: We need to take care to only do this if we're in a compartment,
|
||||
// otherwise JS_MaybeGC will segfault.
|
||||
if (mScx && !mAutoCompartment.empty())
|
||||
JS_MaybeGC(nsXPConnect::XPConnect()->GetCurrentJSContext());
|
||||
|
||||
// Leave the compartment and request before popping.
|
||||
mAutoCompartment.destroyIfConstructed();
|
||||
mAutoRequest.destroyIfConstructed();
|
||||
|
|
Загрузка…
Ссылка в новой задаче