Bug 997440 - Push some more cxes in jsd. r=bz
authorBobby Holley <bobbyholley@gmail.com>
Tue, 20 May 2014 22:52:18 -0700
changeset 184057 8210c3079afc38e4d1a45704e82e63f0d4f01fc3
parent 184056 efa8579fe73a883ea656c1c98e62e4d1fdc238a0
child 184058 cde76de1bea63d50916fe2b56be3907e43e6ab48
push id26810
push usercbook@mozilla.com
push dateWed, 21 May 2014 11:46:36 +0000
treeherdermozilla-central@50fb8c4db2fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs997440
milestone32.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 997440 - Push some more cxes in jsd. r=bz
js/jsd/jsd_stak.cpp
--- a/js/jsd/jsd_stak.cpp
+++ b/js/jsd/jsd_stak.cpp
@@ -265,17 +265,18 @@ jsd_GetCallObjectForStackFrame(JSDContex
 {
     JSObject* obj;
     JSDValue* jsdval = nullptr;
 
     JSD_LOCK_THREADSTATES(jsdc);
 
     if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) )
     {
-        obj = jsdframe->frame.callObject(jsdthreadstate->context);
+        AutoPushJSContext cx(jsdthreadstate->context);
+        obj = jsdframe->frame.callObject(cx);
         if(obj)                                                             
             jsdval = JSD_NewValue(jsdc, OBJECT_TO_JSVAL(obj));              
     }
 
     JSD_UNLOCK_THREADSTATES(jsdc);
 
     return jsdval;
 }
@@ -287,19 +288,18 @@ jsd_GetScopeChainForStackFrame(JSDContex
 {
     JS::RootedObject obj(jsdthreadstate->context);
     JSDValue* jsdval = nullptr;
 
     JSD_LOCK_THREADSTATES(jsdc);
 
     if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) )
     {
-        JS_BeginRequest(jsdthreadstate->context);
-        obj = jsdframe->frame.scopeChain(jsdthreadstate->context);
-        JS_EndRequest(jsdthreadstate->context);
+        AutoPushJSContext cx(jsdthreadstate->context);
+        obj = jsdframe->frame.scopeChain(cx);
         if(obj)
             jsdval = JSD_NewValue(jsdc, OBJECT_TO_JSVAL(obj));
     }
 
     JSD_UNLOCK_THREADSTATES(jsdc);
 
     return jsdval;
 }
@@ -311,19 +311,18 @@ jsd_GetThisForStackFrame(JSDContext* jsd
 {
     JSDValue* jsdval = nullptr;
     JSD_LOCK_THREADSTATES(jsdc);
 
     if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) )
     {
         bool ok;
         JS::RootedValue thisval(jsdthreadstate->context);
-        JS_BeginRequest(jsdthreadstate->context);
-        ok = jsdframe->frame.getThisValue(jsdthreadstate->context, &thisval);
-        JS_EndRequest(jsdthreadstate->context);
+        AutoPushJSContext cx(jsdthreadstate->context);
+        ok = jsdframe->frame.getThisValue(cx, &thisval);
         if(ok)
             jsdval = JSD_NewValue(jsdc, thisval);
     }
 
     JSD_UNLOCK_THREADSTATES(jsdc);
     return jsdval;
 }
 
@@ -468,27 +467,25 @@ JSString*
 jsd_ValToStringInStackFrame(JSDContext* jsdc, 
                             JSDThreadState* jsdthreadstate,
                             JSDStackFrameInfo* jsdframe,
                             jsval val)
 {
     bool valid;
     JSString* retval;
     JSExceptionState* exceptionState;
-    JSContext* cx;
 
     JSD_LOCK_THREADSTATES(jsdc);
     valid = jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe);
     JSD_UNLOCK_THREADSTATES(jsdc);
 
     if( ! valid )
         return nullptr;
 
-    cx = jsdthreadstate->context;
-    MOZ_ASSERT(cx);
+    AutoPushJSContext cx(jsdthreadstate->context);
 
     JS::RootedValue v(cx, val);
     exceptionState = JS_SaveExceptionState(cx);
     retval = JS::ToString(cx, v);
     JS_RestoreExceptionState(cx, exceptionState);
 
     return retval;
 }