Bug 1118107 - Convert ThreadSafeContext -> ExclusiveContext and remove PJS paths in compartment code. (r=lth)
authorShu-yu Guo <shu@rfrn.org>
Fri, 09 Jan 2015 00:06:03 -0800
changeset 248706 9863f12e48e2efe97ccd9f54851fa64968ce1adc
parent 248705 83490bc3998164157feddc06f63196fb3359e764
child 248707 b1e38a68b8b5194565f5bb4768a35c9d8fbe729b
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1118107
milestone37.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 1118107 - Convert ThreadSafeContext -> ExclusiveContext and remove PJS paths in compartment code. (r=lth)
js/src/jscntxtinlines.h
--- a/js/src/jscntxtinlines.h
+++ b/js/src/jscntxtinlines.h
@@ -137,76 +137,74 @@ class CompartmentChecker
 };
 #endif /* JS_CRASH_DIAGNOSTICS */
 
 /*
  * Don't perform these checks when called from a finalizer. The checking
  * depends on other objects not having been swept yet.
  */
 #define START_ASSERT_SAME_COMPARTMENT()                                       \
-    if (!cx->isExclusiveContext())                                            \
-        return;                                                               \
     if (cx->isJSContext() && cx->asJSContext()->runtime()->isHeapBusy())      \
         return;                                                               \
-    CompartmentChecker c(cx->asExclusiveContext())
+    CompartmentChecker c(cx)
 
 template <class T1> inline void
-assertSameCompartment(ThreadSafeContext *cx, const T1 &t1)
+assertSameCompartment(ExclusiveContext *cx, const T1 &t1)
 {
 #ifdef JS_CRASH_DIAGNOSTICS
     START_ASSERT_SAME_COMPARTMENT();
     c.check(t1);
 #endif
 }
 
 template <class T1> inline void
-assertSameCompartmentDebugOnly(ThreadSafeContext *cx, const T1 &t1)
+assertSameCompartmentDebugOnly(ExclusiveContext *cx, const T1 &t1)
 {
 #if defined(DEBUG) && defined(JS_CRASH_DIAGNOSTICS)
     START_ASSERT_SAME_COMPARTMENT();
     c.check(t1);
 #endif
 }
 
 template <class T1, class T2> inline void
-assertSameCompartment(ThreadSafeContext *cx, const T1 &t1, const T2 &t2)
+assertSameCompartment(ExclusiveContext *cx, const T1 &t1, const T2 &t2)
 {
 #ifdef JS_CRASH_DIAGNOSTICS
     START_ASSERT_SAME_COMPARTMENT();
     c.check(t1);
     c.check(t2);
 #endif
 }
 
 template <class T1, class T2, class T3> inline void
-assertSameCompartment(ThreadSafeContext *cx, const T1 &t1, const T2 &t2, const T3 &t3)
+assertSameCompartment(ExclusiveContext *cx, const T1 &t1, const T2 &t2, const T3 &t3)
 {
 #ifdef JS_CRASH_DIAGNOSTICS
     START_ASSERT_SAME_COMPARTMENT();
     c.check(t1);
     c.check(t2);
     c.check(t3);
 #endif
 }
 
 template <class T1, class T2, class T3, class T4> inline void
-assertSameCompartment(ThreadSafeContext *cx,
+assertSameCompartment(ExclusiveContext *cx,
                       const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
 {
 #ifdef JS_CRASH_DIAGNOSTICS
     START_ASSERT_SAME_COMPARTMENT();
     c.check(t1);
     c.check(t2);
     c.check(t3);
     c.check(t4);
 #endif
 }
 
 template <class T1, class T2, class T3, class T4, class T5> inline void
-assertSameCompartment(ThreadSafeContext *cx,
+assertSameCompartment(ExclusiveContext *cx,
                       const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4, const T5 &t5)
 {
 #ifdef JS_CRASH_DIAGNOSTICS
     START_ASSERT_SAME_COMPARTMENT();
     c.check(t1);
     c.check(t2);
     c.check(t3);
     c.check(t4);
@@ -340,17 +338,17 @@ CallSetter(JSContext *cx, HandleObject o
 
     if (!op)
         return true;
 
     return CallJSPropertyOpSetter(cx, op, obj, id, strict, vp);
 }
 
 inline uintptr_t
-GetNativeStackLimit(ThreadSafeContext *cx)
+GetNativeStackLimit(ExclusiveContext *cx)
 {
     StackKind kind;
     if (cx->isJSContext()) {
         kind = cx->asJSContext()->runningWithTrustedPrincipals()
                  ? StackForTrustedScript : StackForUntrustedScript;
     } else {
         // For other threads, we just use the trusted stack depth, since it's
         // unlikely that we'll be mixing trusted and untrusted code together.