Bug 679251 - InlineReturn should advance the pc always (r=dvander)
authorLuke Wagner <luke@mozilla.com>
Mon, 15 Aug 2011 18:53:11 -0700
changeset 76436 604271b95a33764a36add2b957deabb55c0e45ca
parent 76435 25fad7b95686ae05fc20c796c41451f91a073b4b
child 76437 50edc05d6ee883a4fa4f401aa296a1c1b960327b
push id340
push userclegnitto@mozilla.com
push dateTue, 08 Nov 2011 22:56:33 +0000
treeherdermozilla-beta@f745dc151615 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs679251
milestone8.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 679251 - InlineReturn should advance the pc always (r=dvander)
js/src/methodjit/InvokeHelpers.cpp
--- a/js/src/methodjit/InvokeHelpers.cpp
+++ b/js/src/methodjit/InvokeHelpers.cpp
@@ -174,16 +174,23 @@ top:
  * Clean up a frame and return.
  */
 static void
 InlineReturn(VMFrame &f)
 {
     JS_ASSERT(f.fp() != f.entryfp);
     JS_ASSERT(!js_IsActiveWithOrBlock(f.cx, &f.fp()->scopeChain(), 0));
     f.cx->stack.popInlineFrame(f.regs);
+
+    JS_ASSERT(*f.regs.pc == JSOP_CALL ||
+              *f.regs.pc == JSOP_NEW ||
+              *f.regs.pc == JSOP_EVAL ||
+              *f.regs.pc == JSOP_FUNCALL ||
+              *f.regs.pc == JSOP_FUNAPPLY);
+    f.regs.pc += JSOP_CALL_LENGTH;
 }
 
 void JS_FASTCALL
 stubs::SlowCall(VMFrame &f, uint32 argc)
 {
     if (!Invoke(f.cx, CallArgsFromSp(argc, f.regs.sp)))
         THROW();
 }
@@ -704,30 +711,16 @@ FrameIsFinished(JSContext *cx)
     JSOp op = JSOp(*cx->regs().pc);
     return (op == JSOP_RETURN ||
             op == JSOP_RETRVAL ||
             op == JSOP_STOP)
         ? true
         : cx->fp()->finishedInInterpreter();
 }
 
-
-/* Simulate an inline_return by advancing the pc. */
-static inline void
-AdvanceReturnPC(JSContext *cx)
-{
-    JS_ASSERT(*cx->regs().pc == JSOP_CALL ||
-              *cx->regs().pc == JSOP_NEW ||
-              *cx->regs().pc == JSOP_EVAL ||
-              *cx->regs().pc == JSOP_FUNCALL ||
-              *cx->regs().pc == JSOP_FUNAPPLY);
-    cx->regs().pc += JSOP_CALL_LENGTH;
-}
-
-
 /*
  * Given a frame that is about to return, make sure its return value and
  * activation objects are fixed up. Then, pop the frame and advance the
  * current PC. Note that while we could enter the JIT at this point, the
  * logic would still be necessary for the interpreter, so it's easier
  * (and faster) to finish frames in C++ even if at a safe point here.
  */
 static bool
@@ -769,17 +762,16 @@ HandleFinishedFrame(VMFrame &f, StackFra
         if (JSOp(*cx->regs().pc) == JSOP_RETURN)
             cx->fp()->setReturnValue(f.regs.sp[-1]);
 
         returnOK = ScriptEpilogue(cx, cx->fp(), true);
     }
 
     if (cx->fp() != entryFrame) {
         InlineReturn(f);
-        AdvanceReturnPC(cx);
     }
 
     return returnOK;
 }
 
 /*
  * Given a frame newer than the entry frame, try to finish it. If it's at a
  * return position, pop the frame. If it's at a safe point, execute it in
@@ -809,17 +801,16 @@ EvaluateExcessFrame(VMFrame &f, StackFra
      */
     if (!fp->hasImacropc() && FrameIsFinished(cx))
         return HandleFinishedFrame(f, entryFrame);
 
     if (void *ncode = AtSafePoint(cx)) {
         if (!JaegerShotAtSafePoint(cx, ncode))
             return false;
         InlineReturn(f);
-        AdvanceReturnPC(cx);
         return true;
     }
 
     return PartialInterpret(f);
 }
 
 /*
  * Evaluate frames newer than the entry frame until all are gone. This will