Bug 1468792 - Purge dota caches at the same time as deferred atom cache purge r=sfink
authorJon Coppeard <jcoppeard@mozilla.com>
Wed, 20 Jun 2018 09:22:38 +0100
changeset 479877 7aaaed1a9ef133175a7f18054302e890e451f9eb
parent 479876 07a62b4e792399774c6c056140f1a6bf9102b164
child 479878 3dc86f7109f69530d31231ca3f58057cb11521bc
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1468792
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1468792 - Purge dota caches at the same time as deferred atom cache purge r=sfink
js/src/gc/Zone.cpp
js/src/gc/Zone.h
js/src/jit-test/tests/gc/bug-1468792.js
--- a/js/src/gc/Zone.cpp
+++ b/js/src/gc/Zone.cpp
@@ -426,30 +426,44 @@ Zone::ownedByCurrentHelperThread()
 
 void Zone::releaseAtoms()
 {
     MOZ_ASSERT(hasKeptAtoms());
 
     keepAtomsCount--;
 
     if (!hasKeptAtoms() && purgeAtomsDeferred) {
-        atomCache().clearAndShrink();
         purgeAtomsDeferred = false;
+        purgeAtomCache();
     }
 }
 
 void
 Zone::purgeAtomCacheOrDefer()
 {
     if (hasKeptAtoms()) {
         purgeAtomsDeferred = true;
         return;
     }
 
+    purgeAtomCache();
+}
+
+void
+Zone::purgeAtomCache()
+{
+    MOZ_ASSERT(!hasKeptAtoms());
+    MOZ_ASSERT(!purgeAtomsDeferred);
+
     atomCache().clearAndShrink();
+
+    // Also purge the dtoa caches so that subsequent lookups populate atom
+    // cache too.
+    for (RealmsInZoneIter r(this); !r.done(); r.next())
+        r->dtoaCache.purge();
 }
 
 void
 Zone::traceAtomCache(JSTracer* trc)
 {
     MOZ_ASSERT(hasKeptAtoms());
     for (auto r = atomCache().all(); !r.empty(); r.popFront()) {
         JSAtom* atom = r.front().asPtrUnbarriered();
--- a/js/src/gc/Zone.h
+++ b/js/src/gc/Zone.h
@@ -519,16 +519,17 @@ class Zone : public JS::shadow::Zone,
 
   public:
     js::SparseBitmap& markedAtoms() { return markedAtoms_.ref(); }
 
     js::AtomSet& atomCache() { return atomCache_.ref(); }
 
     void traceAtomCache(JSTracer* trc);
     void purgeAtomCacheOrDefer();
+    void purgeAtomCache();
 
     js::ExternalStringCache& externalStringCache() { return externalStringCache_.ref(); };
 
     js::FunctionToStringCache& functionToStringCache() { return functionToStringCache_.ref(); }
 
     // Track heap usage under this Zone.
     js::gc::HeapUsage usage;
 
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/gc/bug-1468792.js
@@ -0,0 +1,18 @@
+// |jit-test| error: ReferenceError
+
+loadFile(`
+  gczeal(2,9);
+  evaluate(\`
+    reportCompare(expect, actual, summary);
+  \`);
+`);
+function loadFile(lfVarx) {
+    try {
+        evaluate(lfVarx);
+    } catch (lfVare) {}
+}
+eval("(function(){({6953421313:0})})")();
+function f() {
+    x[6953421313] = "a";
+}
+f();