[INFER] Don't use invalid ICs when compiling a callee triggers recompilation of the caller.
authorBrian Hackett <bhackett1024@gmail.com>
Mon, 20 Dec 2010 12:39:19 -0800
changeset 74677 37cb2df6927b870b6a9d4086e34d3329e40a30d9
parent 74676 5b1c3bece05b9742d4ede73373d3c394903abd53
child 74678 cc75bc35dfbae4fe1c68b075bce3a8a45001f237
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
milestone2.0b8pre
[INFER] Don't use invalid ICs when compiling a callee triggers recompilation of the caller.
js/src/methodjit/MonoIC.cpp
--- a/js/src/methodjit/MonoIC.cpp
+++ b/js/src/methodjit/MonoIC.cpp
@@ -841,29 +841,31 @@ class CallCompiler : public BaseCompiler
         Repatcher repatch(jit);
         repatch.relink(ic.funJump, ic.nativeStart);
 
         return true;
     }
 
     void *update()
     {
-        JITScript *jit = f.jit();
+        JSStackFrame *fp = f.fp();
+        JITScript *jit = fp->jit();
         uint32 recompilations = jit->recompilations;
 
         stubs::UncachedCallResult ucr;
         if (callingNew)
             stubs::UncachedNewHelper(f, ic.frameSize.staticArgc(), &ucr);
         else
             stubs::UncachedCallHelper(f, ic.frameSize.getArgc(f), &ucr);
 
-        // if the helper invoked the function, it may have triggered recompilation
-        // of this script, invaliding the IC.
-        if (!ucr.codeAddr && f.jit()->recompilations != recompilations)
-            return NULL;
+        // Watch out in case the IC was invalidated by a recompilation on the calling
+        // script. This can happen either if the callee is executed or if it compiles
+        // and the compilation has a static overflow.
+        if (fp->jit()->recompilations != recompilations)
+            return ucr.codeAddr;
 
         // If the function cannot be jitted (generally unjittable or empty script),
         // patch this site to go to a slow path always.
         if (!ucr.codeAddr) {
             disable(jit);
             return NULL;
         }