Bug 1301301, part 2 - Add Scope as an AddToCCKind. r=smaug draft
authorAndrew McCreight <continuation@gmail.com>
Tue, 20 Sep 2016 14:22:28 -0700
changeset 416238 ecb426227bc148ffd85ecdde08e3099757cbf350
parent 416237 2a517e4fb9308bd15bea53c452b8c116c4368865
child 416239 de59145ee9354492529e69aa3cfea749827df0dc
push id30069
push userbmo:continuation@gmail.com
push dateWed, 21 Sep 2016 18:14:08 +0000
reviewerssmaug
bugs1301301, 1263355
milestone52.0a1
Bug 1301301, part 2 - Add Scope as an AddToCCKind. r=smaug Bug 1263355 changed scopes from JSObjects (which are represented in the CC graph) to a new kind of GC thing. Many objects can share the same scope, so they will end up calling the scope trace method repeatedly, causing cycle collections to become much slower in some cases. MozReview-Commit-ID: CFO87zXjwgu
xpcom/base/CycleCollectedJSContext.h
--- a/xpcom/base/CycleCollectedJSContext.h
+++ b/xpcom/base/CycleCollectedJSContext.h
@@ -477,17 +477,17 @@ private:
   EnvironmentPreparer mEnvironmentPreparer;
 };
 
 void TraceScriptHolder(nsISupports* aHolder, JSTracer* aTracer);
 
 // Returns true if the JS::TraceKind is one the cycle collector cares about.
 inline bool AddToCCKind(JS::TraceKind aKind)
 {
-  return aKind == JS::TraceKind::Object || aKind == JS::TraceKind::Script;
+  return aKind == JS::TraceKind::Object || aKind == JS::TraceKind::Script || aKind == JS::TraceKind::Scope;
 }
 
 bool
 GetBuildId(JS::BuildIdCharVector* aBuildID);
 
 } // namespace mozilla
 
 #endif // mozilla_CycleCollectedJSContext_h__