Bug 1376961 - Inline CurrentThreadIsHeapBusy in START_ASSERT_SAME_COMPARTMENT to avoid a TLS lookup for each compartment check. r=jonco
authorJan de Mooij <jdemooij@mozilla.com>
Wed, 28 Jun 2017 16:11:47 -0700
changeset 601751 e54513aa792225bdef5d7c0165f1d86ed189bcef
parent 601750 ed5cc84d317f8c1148eed57f69fd1f91e0eb4cac
child 601752 8b0b1a47321a212e29bd9cfecbe80e0bfa04fe25
push id66200
push userhchang@mozilla.com
push dateThu, 29 Jun 2017 03:53:43 +0000
reviewersjonco
bugs1376961
milestone56.0a1
Bug 1376961 - Inline CurrentThreadIsHeapBusy in START_ASSERT_SAME_COMPARTMENT to avoid a TLS lookup for each compartment check. r=jonco
js/src/jscntxtinlines.h
--- a/js/src/jscntxtinlines.h
+++ b/js/src/jscntxtinlines.h
@@ -195,17 +195,17 @@ class CompartmentChecker
     }
 };
 
 /*
  * 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 (JS::CurrentThreadIsHeapBusy())                                  \
+    if (cx->heapState != JS::HeapState::Idle)                           \
         return;                                                         \
     CompartmentChecker c(cx)
 
 template <class T1> inline void
 releaseAssertSameCompartment(JSContext* cx, const T1& t1)
 {
     START_ASSERT_SAME_COMPARTMENT();
     c.check(t1);