Bug 636296 - Fix forceReturn trampoline on Win64/Solaris (r=dvander)
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Mon, 28 Mar 2011 17:33:53 -0700
changeset 67899 2d641bd67adffa3def63f0f182530809b621d635
parent 67898 823d4b7517c27a696d75c7cb6e37ef81611b8c17
child 67900 77c996c349742bf0d53f2699bd5ea7a171e5eeb7
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs636296
milestone2.2a1pre
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 636296 - Fix forceReturn trampoline on Win64/Solaris (r=dvander)
js/src/methodjit/InvokeHelpers.cpp
js/src/methodjit/MethodJIT.h
js/src/methodjit/StubCalls.cpp
--- a/js/src/methodjit/InvokeHelpers.cpp
+++ b/js/src/methodjit/InvokeHelpers.cpp
@@ -518,18 +518,17 @@ js_InternalThrow(VMFrame &f)
                         cx->debugHooks->throwHookData)) {
           case JSTRAP_ERROR:
             cx->clearPendingException();
             return NULL;
 
           case JSTRAP_RETURN:
             cx->clearPendingException();
             cx->fp()->setReturnValue(rval);
-            return JS_FUNC_TO_DATA_PTR(void *,
-                   cx->jaegerCompartment()->forceReturnTrampoline());
+            return cx->jaegerCompartment()->forceReturnFromExternC();
 
           case JSTRAP_THROW:
             cx->setPendingException(rval);
             break;
 
           default:
             break;
         }
@@ -1039,20 +1038,17 @@ RunTracer(VMFrame &f)
     /* IMacros are guaranteed to have been removed by now. */
     JS_ASSERT(f.fp() == entryFrame);
     JS_ASSERT(!entryFrame->hasImacropc());
 
     /* Step 2. If entryFrame is done, use a special path to return to EnterMethodJIT(). */
     if (FrameIsFinished(cx)) {
         if (!HandleFinishedFrame(f, entryFrame))
             THROWV(NULL);
-
-        void *retPtr = JS_FUNC_TO_DATA_PTR(void *,
-                       cx->jaegerCompartment()->forceReturnTrampoline());
-        *f.returnAddressLocation() = retPtr;
+        *f.returnAddressLocation() = cx->jaegerCompartment()->forceReturnFromFastCall();
         return NULL;
     }
 
     /* Step 3. If entryFrame is at a safe point, just leave. */
     if (void *ncode = AtSafePoint(cx))
         return ncode;
 
     /* Step 4. Do a partial interp, then restart the whole process. */
--- a/js/src/methodjit/MethodJIT.h
+++ b/js/src/methodjit/MethodJIT.h
@@ -195,25 +195,27 @@ class JaegerCompartment {
         activeFrame_ = f;
     }
 
     void popActiveFrame() {
         JS_ASSERT(activeFrame_);
         activeFrame_ = activeFrame_->previous;
     }
 
-    Trampolines::TrampolinePtr forceReturnTrampoline() const {
-        return trampolines.forceReturn;
+    void *forceReturnFromExternC() const {
+        return JS_FUNC_TO_DATA_PTR(void *, trampolines.forceReturn);
     }
 
+    void *forceReturnFromFastCall() const {
 #if (defined(JS_NO_FASTCALL) && defined(JS_CPU_X86)) || defined(_WIN64)
-    Trampolines::TrampolinePtr forceReturnFastTrampoline() const {
-        return trampolines.forceReturnFast;
+        return JS_FUNC_TO_DATA_PTR(void *, trampolines.forceReturnFast);
+#else
+        return JS_FUNC_TO_DATA_PTR(void *, trampolines.forceReturn);
+#endif
     }
-#endif
 };
 
 /*
  * Allocation policy for compiler jstl objects. The goal is to free the
  * compiler from having to check and propagate OOM after every time we
  * append to a vector. We do this by reporting OOM to the engine and
  * setting a flag on the compiler when OOM occurs. The compiler is required
  * to check for OOM only before trying to use the contents of the list.
--- a/js/src/methodjit/StubCalls.cpp
+++ b/js/src/methodjit/StubCalls.cpp
@@ -1173,23 +1173,17 @@ stubs::Debugger(VMFrame &f, jsbytecode *
                         f.cx->debugHooks->debuggerHandlerData)) {
           case JSTRAP_THROW:
             f.cx->setPendingException(rval);
             THROW();
 
           case JSTRAP_RETURN:
             f.cx->clearPendingException();
             f.cx->fp()->setReturnValue(rval);
-#if (defined(JS_NO_FASTCALL) && defined(JS_CPU_X86)) || defined(_WIN64)
-            *f.returnAddressLocation() = JS_FUNC_TO_DATA_PTR(void *,
-                                         f.cx->jaegerCompartment()->forceReturnFastTrampoline());
-#else
-            *f.returnAddressLocation() = JS_FUNC_TO_DATA_PTR(void *,
-                                         f.cx->jaegerCompartment()->forceReturnTrampoline());
-#endif
+            *f.returnAddressLocation() = f.cx->jaegerCompartment()->forceReturnFromFastCall();
             break;
 
           case JSTRAP_ERROR:
             f.cx->clearPendingException();
             THROW();
 
           default:
             break;
@@ -1233,23 +1227,17 @@ stubs::Trap(VMFrame &f, uint32 trapTypes
     switch (result) {
       case JSTRAP_THROW:
         f.cx->setPendingException(rval);
         THROW();
 
       case JSTRAP_RETURN:
         f.cx->clearPendingException();
         f.cx->fp()->setReturnValue(rval);
-#if (defined(JS_NO_FASTCALL) && defined(JS_CPU_X86)) || defined(_WIN64)
-        *f.returnAddressLocation() = JS_FUNC_TO_DATA_PTR(void *,
-                                     f.cx->jaegerCompartment()->forceReturnFastTrampoline());
-#else
-        *f.returnAddressLocation() = JS_FUNC_TO_DATA_PTR(void *,
-                                     f.cx->jaegerCompartment()->forceReturnTrampoline());
-#endif
+        *f.returnAddressLocation() = f.cx->jaegerCompartment()->forceReturnFromFastCall();
         break;
 
       case JSTRAP_ERROR:
         f.cx->clearPendingException();
         THROW();
 
       default:
         break;