Create a new IonContext in a second place (bug 786437, r=dvander)
authorMarty Rosenberg <mrosenberg@mozilla.com>
Tue, 28 Aug 2012 19:20:59 -0400
changeset 105031 07d466a718a660c156f195a05c15c7cfe5abd99d
parent 105030 b63bb39ed1c08605128c984987bbf176dfd81999
child 105032 d11dafc10fc07049b51f0187be5790553c8104a8
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersdvander
bugs786437
milestone17.0a1
Create a new IonContext in a second place (bug 786437, r=dvander)
js/src/ion/Ion.cpp
--- a/js/src/ion/Ion.cpp
+++ b/js/src/ion/Ion.cpp
@@ -716,16 +716,17 @@ IonScript::purgeCaches(JSCompartment *c)
     AutoFlushCache afc("purgeCaches");
     for (size_t i = 0; i < numCaches(); i++)
         getCache(i).reset();
 }
 
 void
 ion::ToggleBarriers(JSCompartment *comp, bool needs)
 {
+    IonContext ictx(NULL, comp, NULL);
     AutoFlushCache afc("ToggleBarriers");
     for (gc::CellIterUnderGC i(comp, gc::FINALIZE_SCRIPT); !i.done(); i.next()) {
         JSScript *script = i.get<JSScript>();
         if (script->hasIonScript())
             script->ion->toggleBarriers(needs);
     }
 }
 
@@ -1675,17 +1676,20 @@ ion::UsesBeforeIonRecompile(JSScript *sc
     // To accomplish this, we use a slightly higher threshold for inner loops.
     // Note that we use +1 to prefer non-OSR over OSR.
     return minUses + (loop->depth + 1) * 100;
 }
 
 void
 AutoFlushCache::updateTop(uintptr_t p, size_t len)
 {
-    GetIonContext()->compartment->ionCompartment()->flusher()->update(p, len);
+    IonContext *ictx = GetIonContext();
+    IonCompartment *icmp = ictx->compartment->ionCompartment();
+    AutoFlushCache *afc = icmp->flusher();
+    afc->update(p, len);
 }
 
 AutoFlushCache::AutoFlushCache(const char *nonce, IonCompartment *comp)
   : start_(0),
     stop_(0),
     name_(nonce),
     used_(false)
 {