From 6d6f2704fccf00a026c958da3c07814f9f4b835d Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 4 Jan 2017 14:52:26 -0500 Subject: [PATCH] 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 --- dom/bindings/SimpleGlobalObject.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dom/bindings/SimpleGlobalObject.cpp b/dom/bindings/SimpleGlobalObject.cpp index 88710f7d95fd..d4d1787f10a3 100644 --- a/dom/bindings/SimpleGlobalObject.cpp +++ b/dom/bindings/SimpleGlobalObject.cpp @@ -104,7 +104,13 @@ SimpleGlobalObject::Create(GlobalType globalType, JS::Handle 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 principal = nsNullPrincipal::Create();