Bug 1326301. Put the global allocated by SimpleGlobalObject in the system zone, so we don't create tons of zones when we're converting JSON to dictionaries many times over. r=mccr8

This commit is contained in:
Boris Zbarsky 2017-01-04 14:52:26 -05:00
parent a0b925e4e6
commit 6d6f2704fc

View File

@ -104,7 +104,13 @@ SimpleGlobalObject::Create(GlobalType globalType, JS::Handle<JS::Value> proto)
JSContext* cx = jsapi.cx();
JS::CompartmentOptions options;
options.creationOptions().setInvisibleToDebugger(true);
options.creationOptions()
.setInvisibleToDebugger(true)
// Put our SimpleGlobalObjects in the system zone, so we won't create
// lots of zones for what are probably very short-lived
// compartments. This should help them be GCed quicker and take up
// less memory before they're GCed.
.setZone(JS::SystemZone);
if (NS_IsMainThread()) {
nsCOMPtr<nsIPrincipal> principal = nsNullPrincipal::Create();