Bug 1118107 - Convert ThreadSafeContext -> ExclusiveContext and remove PJS paths in TypedObject code. (r=lth)
authorShu-yu Guo <shu@rfrn.org>
Fri, 09 Jan 2015 00:06:03 -0800
changeset 248705 83490bc3998164157feddc06f63196fb3359e764
parent 248704 db4f4627bbc19bbf8063af46577c2221a8163c90
child 248706 9863f12e48e2efe97ccd9f54851fa64968ce1adc
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 TypedObject code. (r=lth)
js/src/builtin/TypedObject.cpp
js/src/builtin/TypedObject.h
js/src/jit/MCallOptimize.cpp
js/src/jscntxt.h
js/src/vm/SelfHosting.cpp
--- a/js/src/builtin/TypedObject.cpp
+++ b/js/src/builtin/TypedObject.cpp
@@ -2549,194 +2549,140 @@ js::NewDerivedTypedObject(JSContext *cx,
     if (!obj)
         return false;
 
     args.rval().setObject(*obj);
     return true;
 }
 
 bool
-js::AttachTypedObject(ThreadSafeContext *cx, unsigned argc, Value *vp)
+js::AttachTypedObject(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     MOZ_ASSERT(args.length() == 3);
     MOZ_ASSERT(args[2].isInt32());
 
     OutlineTypedObject &handle = args[0].toObject().as<OutlineTypedObject>();
     TypedObject &target = args[1].toObject().as<TypedObject>();
     MOZ_ASSERT(!handle.isAttached());
     size_t offset = args[2].toInt32();
 
-    if (cx->isForkJoinContext()) {
-        LockedJSContext ncx(cx->asForkJoinContext());
-        handle.attach(ncx, target, offset);
-    } else {
-        handle.attach(cx->asJSContext(), target, offset);
-    }
+    handle.attach(cx, target, offset);
+
     return true;
 }
 
-JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::AttachTypedObjectJitInfo,
-                                      AttachTypedObjectJitInfo,
-                                      js::AttachTypedObject);
-
 bool
-js::SetTypedObjectOffset(ThreadSafeContext *, unsigned argc, Value *vp)
+js::SetTypedObjectOffset(JSContext *, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     MOZ_ASSERT(args.length() == 2);
     MOZ_ASSERT(args[0].isObject() && args[0].toObject().is<TypedObject>());
     MOZ_ASSERT(args[1].isInt32());
 
     OutlineTypedObject &typedObj = args[0].toObject().as<OutlineTypedObject>();
     int32_t offset = args[1].toInt32();
 
     MOZ_ASSERT(typedObj.isAttached());
     typedObj.setData(typedObj.typedMemBase() + offset);
     args.rval().setUndefined();
     return true;
 }
 
 bool
-js::intrinsic_SetTypedObjectOffset(JSContext *cx, unsigned argc, Value *vp)
-{
-    // Do not use JSNativeThreadSafeWrapper<> so that ion can reference
-    // this function more easily when inlining.
-    return SetTypedObjectOffset(cx, argc, vp);
-}
-
-JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::intrinsic_SetTypedObjectOffsetJitInfo,
-                                      SetTypedObjectJitInfo,
-                                      SetTypedObjectOffset);
-
-bool
-js::ObjectIsTypeDescr(ThreadSafeContext *, unsigned argc, Value *vp)
+js::ObjectIsTypeDescr(JSContext *, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     MOZ_ASSERT(args.length() == 1);
     MOZ_ASSERT(args[0].isObject());
     args.rval().setBoolean(args[0].toObject().is<TypeDescr>());
     return true;
 }
 
-JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::ObjectIsTypeDescrJitInfo, ObjectIsTypeDescrJitInfo,
-                                      js::ObjectIsTypeDescr);
-
 bool
-js::ObjectIsTypedObject(ThreadSafeContext *, unsigned argc, Value *vp)
+js::ObjectIsTypedObject(JSContext *, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     MOZ_ASSERT(args.length() == 1);
     MOZ_ASSERT(args[0].isObject());
     args.rval().setBoolean(args[0].toObject().is<TypedObject>());
     return true;
 }
 
-JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::ObjectIsTypedObjectJitInfo,
-                                      ObjectIsTypedObjectJitInfo,
-                                      js::ObjectIsTypedObject);
-
 bool
-js::ObjectIsOpaqueTypedObject(ThreadSafeContext *, unsigned argc, Value *vp)
+js::ObjectIsOpaqueTypedObject(JSContext *, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     MOZ_ASSERT(args.length() == 1);
     JSObject &obj = args[0].toObject();
     args.rval().setBoolean(obj.is<TypedObject>() && obj.as<TypedObject>().opaque());
     return true;
 }
 
-JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::ObjectIsOpaqueTypedObjectJitInfo,
-                                      ObjectIsOpaqueTypedObjectJitInfo,
-                                      js::ObjectIsOpaqueTypedObject);
-
 bool
-js::ObjectIsTransparentTypedObject(ThreadSafeContext *, unsigned argc, Value *vp)
+js::ObjectIsTransparentTypedObject(JSContext *, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     MOZ_ASSERT(args.length() == 1);
     JSObject &obj = args[0].toObject();
     args.rval().setBoolean(obj.is<TypedObject>() && !obj.as<TypedObject>().opaque());
     return true;
 }
 
-JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::ObjectIsTransparentTypedObjectJitInfo,
-                                      ObjectIsTransparentTypedObjectJitInfo,
-                                      js::ObjectIsTransparentTypedObject);
-
 bool
-js::TypeDescrIsSimpleType(ThreadSafeContext *, unsigned argc, Value *vp)
+js::TypeDescrIsSimpleType(JSContext *, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     MOZ_ASSERT(args.length() == 1);
     MOZ_ASSERT(args[0].isObject());
     MOZ_ASSERT(args[0].toObject().is<js::TypeDescr>());
     args.rval().setBoolean(args[0].toObject().is<js::SimpleTypeDescr>());
     return true;
 }
 
-JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::TypeDescrIsSimpleTypeJitInfo,
-                                      TypeDescrIsSimpleTypeJitInfo,
-                                      js::TypeDescrIsSimpleType);
-
 bool
-js::TypeDescrIsArrayType(ThreadSafeContext *, unsigned argc, Value *vp)
+js::TypeDescrIsArrayType(JSContext *, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     MOZ_ASSERT(args.length() == 1);
     MOZ_ASSERT(args[0].isObject());
     MOZ_ASSERT(args[0].toObject().is<js::TypeDescr>());
     JSObject& obj = args[0].toObject();
     args.rval().setBoolean(obj.is<js::ArrayTypeDescr>());
     return true;
 }
 
-JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::TypeDescrIsArrayTypeJitInfo,
-                                      TypeDescrIsArrayTypeJitInfo,
-                                      js::TypeDescrIsArrayType);
-
 bool
-js::TypedObjectIsAttached(ThreadSafeContext *cx, unsigned argc, Value *vp)
+js::TypedObjectIsAttached(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     TypedObject &typedObj = args[0].toObject().as<TypedObject>();
     args.rval().setBoolean(typedObj.isAttached());
     return true;
 }
 
-JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::TypedObjectIsAttachedJitInfo,
-                                      TypedObjectIsAttachedJitInfo,
-                                      js::TypedObjectIsAttached);
-
 bool
-js::TypedObjectTypeDescr(ThreadSafeContext *cx, unsigned argc, Value *vp)
+js::TypedObjectTypeDescr(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     TypedObject &typedObj = args[0].toObject().as<TypedObject>();
     args.rval().setObject(typedObj.typeDescr());
     return true;
 }
 
-JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::TypedObjectTypeDescrJitInfo,
-                                      TypedObjectTypeDescrJitInfo,
-                                      js::TypedObjectTypeDescr);
-
 bool
-js::ClampToUint8(ThreadSafeContext *, unsigned argc, Value *vp)
+js::ClampToUint8(JSContext *, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     MOZ_ASSERT(args.length() == 1);
     MOZ_ASSERT(args[0].isNumber());
     args.rval().setNumber(ClampDoubleToUint8(args[0].toNumber()));
     return true;
 }
 
-JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::ClampToUint8JitInfo, ClampToUint8JitInfo,
-                                      js::ClampToUint8);
-
 bool
 js::GetTypedObjectModule(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     Rooted<GlobalObject*> global(cx, cx->global());
     MOZ_ASSERT(global);
     args.rval().setObject(global->getTypedObjectModule());
     return true;
@@ -2759,17 +2705,17 @@ js::GetInt32x4TypeDescr(JSContext *cx, u
     Rooted<GlobalObject*> global(cx, cx->global());
     MOZ_ASSERT(global);
     args.rval().setObject(global->int32x4TypeDescr());
     return true;
 }
 
 #define JS_STORE_SCALAR_CLASS_IMPL(_constant, T, _name)                         \
 bool                                                                            \
-js::StoreScalar##T::Func(ThreadSafeContext *, unsigned argc, Value *vp)         \
+js::StoreScalar##T::Func(JSContext *, unsigned argc, Value *vp)         \
 {                                                                               \
     CallArgs args = CallArgsFromVp(argc, vp);                                   \
     MOZ_ASSERT(args.length() == 3);                                             \
     MOZ_ASSERT(args[0].isObject() && args[0].toObject().is<TypedObject>());     \
     MOZ_ASSERT(args[1].isInt32());                                              \
     MOZ_ASSERT(args[2].isNumber());                                             \
                                                                                 \
     TypedObject &typedObj = args[0].toObject().as<TypedObject>();               \
@@ -2778,25 +2724,21 @@ js::StoreScalar##T::Func(ThreadSafeConte
     /* Should be guaranteed by the typed objects API: */                        \
     MOZ_ASSERT(offset % MOZ_ALIGNOF(T) == 0);                                   \
                                                                                 \
     T *target = reinterpret_cast<T*>(typedObj.typedMem(offset));                \
     double d = args[2].toNumber();                                              \
     *target = ConvertScalar<T>(d);                                              \
     args.rval().setUndefined();                                                 \
     return true;                                                                \
-}                                                                               \
-                                                                                \
-JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::StoreScalar##T::JitInfo,              \
-                                      StoreScalar##T,                           \
-                                      js::StoreScalar##T::Func);
+}
 
 #define JS_STORE_REFERENCE_CLASS_IMPL(_constant, T, _name)                      \
 bool                                                                            \
-js::StoreReference##T::Func(ThreadSafeContext *cx, unsigned argc, Value *vp)    \
+js::StoreReference##T::Func(JSContext *cx, unsigned argc, Value *vp)    \
 {                                                                               \
     CallArgs args = CallArgsFromVp(argc, vp);                                   \
     MOZ_ASSERT(args.length() == 4);                                             \
     MOZ_ASSERT(args[0].isObject() && args[0].toObject().is<TypedObject>());     \
     MOZ_ASSERT(args[1].isInt32());                                              \
     MOZ_ASSERT(args[2].isString() || args[2].isNull());                         \
                                                                                 \
     TypedObject &typedObj = args[0].toObject().as<TypedObject>();               \
@@ -2809,75 +2751,64 @@ js::StoreReference##T::Func(ThreadSafeCo
     /* Should be guaranteed by the typed objects API: */                        \
     MOZ_ASSERT(offset % MOZ_ALIGNOF(T) == 0);                                   \
                                                                                 \
     T *target = reinterpret_cast<T*>(typedObj.typedMem(offset));                \
     if (!store(cx, target, args[3], &typedObj, id))                             \
         return false;                                                           \
     args.rval().setUndefined();                                                 \
     return true;                                                                \
-}                                                                               \
-                                                                                \
-JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::StoreReference##T::JitInfo,           \
-                                      StoreReference##T,                        \
-                                      js::StoreReference##T::Func);
+}
 
 #define JS_LOAD_SCALAR_CLASS_IMPL(_constant, T, _name)                                  \
 bool                                                                                    \
-js::LoadScalar##T::Func(ThreadSafeContext *, unsigned argc, Value *vp)                  \
+js::LoadScalar##T::Func(JSContext *, unsigned argc, Value *vp)                  \
 {                                                                                       \
     CallArgs args = CallArgsFromVp(argc, vp);                                           \
     MOZ_ASSERT(args.length() == 2);                                                     \
     MOZ_ASSERT(args[0].isObject() && args[0].toObject().is<TypedObject>());             \
     MOZ_ASSERT(args[1].isInt32());                                                      \
                                                                                         \
     TypedObject &typedObj = args[0].toObject().as<TypedObject>();                       \
     int32_t offset = args[1].toInt32();                                                 \
                                                                                         \
     /* Should be guaranteed by the typed objects API: */                                \
     MOZ_ASSERT(offset % MOZ_ALIGNOF(T) == 0);                                           \
                                                                                         \
     T *target = reinterpret_cast<T*>(typedObj.typedMem(offset));                        \
     args.rval().setNumber((double) *target);                                            \
     return true;                                                                        \
-}                                                                                       \
-                                                                                        \
-JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::LoadScalar##T::JitInfo, LoadScalar##T,        \
-                                      js::LoadScalar##T::Func);
+}
 
 #define JS_LOAD_REFERENCE_CLASS_IMPL(_constant, T, _name)                       \
 bool                                                                            \
-js::LoadReference##T::Func(ThreadSafeContext *, unsigned argc, Value *vp)       \
+js::LoadReference##T::Func(JSContext *, unsigned argc, Value *vp)       \
 {                                                                               \
     CallArgs args = CallArgsFromVp(argc, vp);                                   \
     MOZ_ASSERT(args.length() == 2);                                             \
     MOZ_ASSERT(args[0].isObject() && args[0].toObject().is<TypedObject>());     \
     MOZ_ASSERT(args[1].isInt32());                                              \
                                                                                 \
     TypedObject &typedObj = args[0].toObject().as<TypedObject>();               \
     int32_t offset = args[1].toInt32();                                         \
                                                                                 \
     /* Should be guaranteed by the typed objects API: */                        \
     MOZ_ASSERT(offset % MOZ_ALIGNOF(T) == 0);                                   \
                                                                                 \
     T *target = reinterpret_cast<T*>(typedObj.typedMem(offset));                \
     load(target, args.rval());                                                  \
     return true;                                                                \
-}                                                                               \
-                                                                                \
-JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::LoadReference##T::JitInfo,            \
-                                      LoadReference##T,                         \
-                                      js::LoadReference##T::Func);
+}
 
 // Because the precise syntax for storing values/objects/strings
 // differs, we abstract it away using specialized variants of the
 // private methods `store()` and `load()`.
 
 bool
-StoreReferenceHeapValue::store(ThreadSafeContext *cx, HeapValue *heap, const Value &v,
+StoreReferenceHeapValue::store(JSContext *cx, HeapValue *heap, const Value &v,
                                TypedObject *obj, jsid id)
 {
     // Undefined values are not included in type inference information for
     // value properties of typed objects, as these properties are always
     // considered to contain undefined.
     if (!v.isUndefined()) {
         if (cx->isJSContext())
             types::AddTypePropertyId(cx->asJSContext(), obj, id, v);
@@ -2885,17 +2816,17 @@ StoreReferenceHeapValue::store(ThreadSaf
             return false;
     }
 
     *heap = v;
     return true;
 }
 
 bool
-StoreReferenceHeapPtrObject::store(ThreadSafeContext *cx, HeapPtrObject *heap, const Value &v,
+StoreReferenceHeapPtrObject::store(JSContext *cx, HeapPtrObject *heap, const Value &v,
                                    TypedObject *obj, jsid id)
 {
     MOZ_ASSERT(v.isObjectOrNull()); // or else Store_object is being misused
 
     // Null pointers are not included in type inference information for
     // object properties of typed objects, as these properties are always
     // considered to contain null.
     if (v.isObject()) {
@@ -2905,17 +2836,17 @@ StoreReferenceHeapPtrObject::store(Threa
             return false;
     }
 
     *heap = v.toObjectOrNull();
     return true;
 }
 
 bool
-StoreReferenceHeapPtrString::store(ThreadSafeContext *cx, HeapPtrString *heap, const Value &v,
+StoreReferenceHeapPtrString::store(JSContext *cx, HeapPtrString *heap, const Value &v,
                                    TypedObject *obj, jsid id)
 {
     MOZ_ASSERT(v.isString()); // or else Store_string is being misused
 
     // Note: string references are not reflected in type information for the object.
     *heap = v.toString();
 
     return true;
--- a/js/src/builtin/TypedObject.h
+++ b/js/src/builtin/TypedObject.h
@@ -790,93 +790,81 @@ bool NewOpaqueTypedObject(JSContext *cx,
 bool NewDerivedTypedObject(JSContext *cx, unsigned argc, Value *vp);
 
 /*
  * Usage: AttachTypedObject(typedObj, newDatum, newOffset)
  *
  * Moves `typedObj` to point at the memory referenced by `newDatum` with
  * the offset `newOffset`.
  */
-bool AttachTypedObject(ThreadSafeContext *cx, unsigned argc, Value *vp);
-extern const JSJitInfo AttachTypedObjectJitInfo;
+bool AttachTypedObject(JSContext *cx, unsigned argc, Value *vp);
 
 /*
  * Usage: SetTypedObjectOffset(typedObj, offset)
  *
  * Changes the offset for `typedObj` within its buffer to `offset`.
  * `typedObj` must already be attached.
  */
-bool intrinsic_SetTypedObjectOffset(JSContext *cx, unsigned argc, Value *vp);
-bool SetTypedObjectOffset(ThreadSafeContext *, unsigned argc, Value *vp);
-extern const JSJitInfo intrinsic_SetTypedObjectOffsetJitInfo;
+bool SetTypedObjectOffset(JSContext *, unsigned argc, Value *vp);
 
 /*
  * Usage: ObjectIsTypeDescr(obj)
  *
  * True if `obj` is a type object.
  */
-bool ObjectIsTypeDescr(ThreadSafeContext *cx, unsigned argc, Value *vp);
-extern const JSJitInfo ObjectIsTypeDescrJitInfo;
+bool ObjectIsTypeDescr(JSContext *cx, unsigned argc, Value *vp);
 
 /*
  * Usage: ObjectIsTypedObject(obj)
  *
  * True if `obj` is a transparent or opaque typed object.
  */
-bool ObjectIsTypedObject(ThreadSafeContext *cx, unsigned argc, Value *vp);
-extern const JSJitInfo ObjectIsTypedObjectJitInfo;
+bool ObjectIsTypedObject(JSContext *cx, unsigned argc, Value *vp);
 
 /*
  * Usage: ObjectIsOpaqueTypedObject(obj)
  *
  * True if `obj` is an opaque typed object.
  */
-bool ObjectIsOpaqueTypedObject(ThreadSafeContext *cx, unsigned argc, Value *vp);
-extern const JSJitInfo ObjectIsOpaqueTypedObjectJitInfo;
+bool ObjectIsOpaqueTypedObject(JSContext *cx, unsigned argc, Value *vp);
 
 /*
  * Usage: ObjectIsTransparentTypedObject(obj)
  *
  * True if `obj` is a transparent typed object.
  */
-bool ObjectIsTransparentTypedObject(ThreadSafeContext *cx, unsigned argc, Value *vp);
-extern const JSJitInfo ObjectIsTransparentTypedObjectJitInfo;
+bool ObjectIsTransparentTypedObject(JSContext *cx, unsigned argc, Value *vp);
 
 /* Predicates on type descriptor objects.  In all cases, 'obj' must be a type descriptor. */
 
-bool TypeDescrIsSimpleType(ThreadSafeContext *, unsigned argc, Value *vp);
-extern const JSJitInfo TypeDescrIsSimpleTypeJitInfo;
+bool TypeDescrIsSimpleType(JSContext *, unsigned argc, Value *vp);
 
-bool TypeDescrIsArrayType(ThreadSafeContext *, unsigned argc, Value *vp);
-extern const JSJitInfo TypeDescrIsArrayTypeJitInfo;
+bool TypeDescrIsArrayType(JSContext *, unsigned argc, Value *vp);
 
 /*
  * Usage: TypedObjectIsAttached(obj)
  *
  * Given a TypedObject `obj`, returns true if `obj` is
  * "attached" (i.e., its data pointer is nullptr).
  */
-bool TypedObjectIsAttached(ThreadSafeContext *cx, unsigned argc, Value *vp);
-extern const JSJitInfo TypedObjectIsAttachedJitInfo;
+bool TypedObjectIsAttached(JSContext *cx, unsigned argc, Value *vp);
 
 /*
  * Usage: TypedObjectTypeDescr(obj)
  *
  * Given a TypedObject `obj`, returns the object's type descriptor.
  */
-bool TypedObjectTypeDescr(ThreadSafeContext *cx, unsigned argc, Value *vp);
-extern const JSJitInfo TypedObjectTypeDescrJitInfo;
+bool TypedObjectTypeDescr(JSContext *cx, unsigned argc, Value *vp);
 
 /*
  * Usage: ClampToUint8(v)
  *
  * Same as the C function ClampDoubleToUint8. `v` must be a number.
  */
-bool ClampToUint8(ThreadSafeContext *cx, unsigned argc, Value *vp);
-extern const JSJitInfo ClampToUint8JitInfo;
+bool ClampToUint8(JSContext *cx, unsigned argc, Value *vp);
 
 /*
  * Usage: GetTypedObjectModule()
  *
  * Returns the global "typed object" module, which provides access
  * to the various builtin type descriptors. These are currently
  * exported as immutable properties so it is safe for self-hosted code
  * to access them; eventually this should be linked into the module
@@ -914,17 +902,17 @@ bool GetInt32x4TypeDescr(JSContext *cx, 
  * Assumes (and asserts) that:
  * - `targetDatum` is attached
  * - `targetOffset` is a valid offset within the bounds of `targetDatum`
  * - `value` is a number
  */
 #define JS_STORE_SCALAR_CLASS_DEFN(_constant, T, _name)                       \
 class StoreScalar##T {                                                        \
   public:                                                                     \
-    static bool Func(ThreadSafeContext *cx, unsigned argc, Value *vp);        \
+    static bool Func(JSContext *cx, unsigned argc, Value *vp);        \
     static const JSJitInfo JitInfo;                                           \
 };
 
 /*
  * Usage: Store_Any(targetDatum, targetOffset, fieldName, value)
  *        Store_Object(targetDatum, targetOffset, fieldName, value)
  *        Store_string(targetDatum, targetOffset, fieldName, value)
  *
@@ -934,36 +922,36 @@ class StoreScalar##T {                  
  * Assumes (and asserts) that:
  * - `targetDatum` is attached
  * - `targetOffset` is a valid offset within the bounds of `targetDatum`
  * - `value` is an object or null (`Store_Object`) or string (`Store_string`).
  */
 #define JS_STORE_REFERENCE_CLASS_DEFN(_constant, T, _name)                    \
 class StoreReference##T {                                                     \
   private:                                                                    \
-    static bool store(ThreadSafeContext *cx, T* heap, const Value &v,         \
+    static bool store(JSContext *cx, T* heap, const Value &v,         \
                       TypedObject *obj, jsid id);                             \
                                                                               \
   public:                                                                     \
-    static bool Func(ThreadSafeContext *cx, unsigned argc, Value *vp);        \
+    static bool Func(JSContext *cx, unsigned argc, Value *vp);        \
     static const JSJitInfo JitInfo;                                           \
 };
 
 /*
  * Usage: LoadScalar(targetDatum, targetOffset, value)
  *
  * Intrinsic function. Loads value (which must be an int32 or uint32)
  * by `scalarTypeRepr` (which must be a type repr obj) and loads the
  * value at the memory for `targetDatum` at offset `targetOffset`.
  * `targetDatum` must be attached.
  */
 #define JS_LOAD_SCALAR_CLASS_DEFN(_constant, T, _name)                        \
 class LoadScalar##T {                                                         \
   public:                                                                     \
-    static bool Func(ThreadSafeContext *cx, unsigned argc, Value *vp);        \
+    static bool Func(JSContext *cx, unsigned argc, Value *vp);        \
     static const JSJitInfo JitInfo;                                           \
 };
 
 /*
  * Usage: LoadReference(targetDatum, targetOffset, value)
  *
  * Intrinsic function. Stores value (which must be an int32 or uint32)
  * by `scalarTypeRepr` (which must be a type repr obj) and stores the
@@ -971,17 +959,17 @@ class LoadScalar##T {                   
  * `targetDatum` must be attached.
  */
 #define JS_LOAD_REFERENCE_CLASS_DEFN(_constant, T, _name)                     \
 class LoadReference##T {                                                      \
   private:                                                                    \
     static void load(T* heap, MutableHandleValue v);                          \
                                                                               \
   public:                                                                     \
-    static bool Func(ThreadSafeContext *cx, unsigned argc, Value *vp);        \
+    static bool Func(JSContext *cx, unsigned argc, Value *vp);        \
     static const JSJitInfo JitInfo;                                           \
 };
 
 // I was using templates for this stuff instead of macros, but ran
 // into problems with the Unagi compiler.
 JS_FOR_EACH_UNIQUE_SCALAR_TYPE_REPR_CTYPE(JS_STORE_SCALAR_CLASS_DEFN)
 JS_FOR_EACH_UNIQUE_SCALAR_TYPE_REPR_CTYPE(JS_LOAD_SCALAR_CLASS_DEFN)
 JS_FOR_EACH_REFERENCE_TYPE_REPR(JS_STORE_REFERENCE_CLASS_DEFN)
--- a/js/src/jit/MCallOptimize.cpp
+++ b/js/src/jit/MCallOptimize.cpp
@@ -203,38 +203,38 @@ IonBuilder::inlineNativeCall(CallInfo &c
 
     // TypedArray intrinsics.
     if (native == intrinsic_IsTypedArray)
         return inlineIsTypedArray(callInfo);
     if (native == intrinsic_TypedArrayLength)
         return inlineTypedArrayLength(callInfo);
 
     // TypedObject intrinsics.
-    if (native == intrinsic_ObjectIsTypedObject)
+    if (native == js::ObjectIsTypedObject)
         return inlineHasClass(callInfo,
                               &OutlineTransparentTypedObject::class_,
                               &OutlineOpaqueTypedObject::class_,
                               &InlineTransparentTypedObject::class_,
                               &InlineOpaqueTypedObject::class_);
-    if (native == intrinsic_ObjectIsTransparentTypedObject)
+    if (native == js::ObjectIsTransparentTypedObject)
         return inlineHasClass(callInfo,
                               &OutlineTransparentTypedObject::class_,
                               &InlineTransparentTypedObject::class_);
-    if (native == intrinsic_ObjectIsOpaqueTypedObject)
+    if (native == js::ObjectIsOpaqueTypedObject)
         return inlineHasClass(callInfo,
                               &OutlineOpaqueTypedObject::class_,
                               &InlineOpaqueTypedObject::class_);
-    if (native == intrinsic_ObjectIsTypeDescr)
+    if (native == js::ObjectIsTypeDescr)
         return inlineObjectIsTypeDescr(callInfo);
-    if (native == intrinsic_TypeDescrIsSimpleType)
+    if (native == js::TypeDescrIsSimpleType)
         return inlineHasClass(callInfo,
                               &ScalarTypeDescr::class_, &ReferenceTypeDescr::class_);
-    if (native == intrinsic_TypeDescrIsArrayType)
+    if (native == js::TypeDescrIsArrayType)
         return inlineHasClass(callInfo, &ArrayTypeDescr::class_);
-    if (native == intrinsic_SetTypedObjectOffset)
+    if (native == js::SetTypedObjectOffset)
         return inlineSetTypedObjectOffset(callInfo);
 
     // Testing Functions
     if (native == testingFunc_bailout)
         return inlineBailout(callInfo);
     if (native == testingFunc_assertFloat32)
         return inlineAssertFloat32(callInfo);
 
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -950,28 +950,16 @@ bool intrinsic_DefineDataProperty(JSCont
 bool intrinsic_UnsafeSetReservedSlot(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_UnsafeGetReservedSlot(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_UnsafeGetObjectFromReservedSlot(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_UnsafeGetInt32FromReservedSlot(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_UnsafeGetStringFromReservedSlot(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_UnsafeGetBooleanFromReservedSlot(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_IsPackedArray(JSContext *cx, unsigned argc, Value *vp);
 
-bool intrinsic_ShouldForceSequential(JSContext *cx, unsigned argc, Value *vp);
-bool intrinsic_NewParallelArray(JSContext *cx, unsigned argc, Value *vp);
-bool intrinsic_ForkJoinGetSlice(JSContext *cx, unsigned argc, Value *vp);
-bool intrinsic_InParallelSection(JSContext *cx, unsigned argc, Value *vp);
-
-bool intrinsic_ObjectIsTypedObject(JSContext *cx, unsigned argc, Value *vp);
-bool intrinsic_ObjectIsTransparentTypedObject(JSContext *cx, unsigned argc, Value *vp);
-bool intrinsic_ObjectIsOpaqueTypedObject(JSContext *cx, unsigned argc, Value *vp);
-bool intrinsic_ObjectIsTypeDescr(JSContext *cx, unsigned argc, Value *vp);
-bool intrinsic_TypeDescrIsSimpleType(JSContext *cx, unsigned argc, Value *vp);
-bool intrinsic_TypeDescrIsArrayType(JSContext *cx, unsigned argc, Value *vp);
-
 bool intrinsic_IsSuspendedStarGenerator(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_IsArrayIterator(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_IsStringIterator(JSContext *cx, unsigned argc, Value *vp);
 
 bool intrinsic_IsTypedArray(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_TypedArrayLength(JSContext *cx, unsigned argc, Value *vp);
 
 class AutoLockForExclusiveAccess
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -775,56 +775,16 @@ intrinsic_IsWeakSet(JSContext *cx, unsig
     CallArgs args = CallArgsFromVp(argc, vp);
     MOZ_ASSERT(args.length() == 1);
     MOZ_ASSERT(args[0].isObject());
 
     args.rval().setBoolean(args[0].toObject().is<WeakSetObject>());
     return true;
 }
 
-/* These wrappers are needed in order to recognize the function
- * pointers within the JIT, and the raw js:: functions can't be used
- * directly because they take a ThreadSafeContext* argument.
- */
-bool
-js::intrinsic_ObjectIsTypedObject(JSContext *cx, unsigned argc, Value *vp)
-{
-    return js::ObjectIsTypedObject(cx, argc, vp);
-}
-
-bool
-js::intrinsic_ObjectIsTransparentTypedObject(JSContext *cx, unsigned argc, Value *vp)
-{
-    return js::ObjectIsTransparentTypedObject(cx, argc, vp);
-}
-
-bool
-js::intrinsic_ObjectIsOpaqueTypedObject(JSContext *cx, unsigned argc, Value *vp)
-{
-    return js::ObjectIsOpaqueTypedObject(cx, argc, vp);
-}
-
-bool
-js::intrinsic_ObjectIsTypeDescr(JSContext *cx, unsigned argc, Value *vp)
-{
-    return js::ObjectIsTypeDescr(cx, argc, vp);
-}
-
-bool
-js::intrinsic_TypeDescrIsSimpleType(JSContext *cx, unsigned argc, Value *vp)
-{
-    return js::TypeDescrIsSimpleType(cx, argc, vp);
-}
-
-bool
-js::intrinsic_TypeDescrIsArrayType(JSContext *cx, unsigned argc, Value *vp)
-{
-    return js::TypeDescrIsArrayType(cx, argc, vp);
-}
-
 /**
  * Returns the default locale as a well-formed, but not necessarily canonicalized,
  * BCP-47 language tag.
  */
 static bool
 intrinsic_RuntimeDefaultLocale(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
@@ -988,82 +948,46 @@ static const JSFunctionSpec intrinsic_fu
     JS_FN("CallStarGeneratorMethodIfWrapped",
           CallNonGenericSelfhostedMethod<Is<StarGeneratorObject>>, 2, 0),
 
     JS_FN("IsWeakSet",               intrinsic_IsWeakSet,               1,0),
 
     JS_FN("NewDenseArray",           intrinsic_NewDenseArray,           1,0),
 
     // See builtin/TypedObject.h for descriptors of the typedobj functions.
-    JS_FN("NewOpaqueTypedObject",
-          js::NewOpaqueTypedObject,
-          1, 0),
-    JS_FN("NewDerivedTypedObject",
-          js::NewDerivedTypedObject,
-          3, 0),
-    JS_FN("TypedObjectBuffer",
-          TypedObject::GetBuffer,
-          1, 0),
-    JS_FN("TypedObjectByteOffset",
-          TypedObject::GetByteOffset,
-          1, 0),
-    JS_FNINFO("AttachTypedObject",
-              JSNativeThreadSafeWrapper<js::AttachTypedObject>,
-              &js::AttachTypedObjectJitInfo, 3, 0),
-    JS_FNINFO("SetTypedObjectOffset",
-              intrinsic_SetTypedObjectOffset,
-              &js::intrinsic_SetTypedObjectOffsetJitInfo, 2, 0),
-    JS_FNINFO("ObjectIsTypeDescr",
-              intrinsic_ObjectIsTypeDescr,
-              &js::ObjectIsTypeDescrJitInfo, 1, 0),
-    JS_FNINFO("ObjectIsTypedObject",
-              intrinsic_ObjectIsTypedObject,
-              &js::ObjectIsTypedObjectJitInfo, 1, 0),
-    JS_FNINFO("ObjectIsTransparentTypedObject",
-              intrinsic_ObjectIsTransparentTypedObject,
-              &js::ObjectIsTransparentTypedObjectJitInfo, 1, 0),
-    JS_FNINFO("TypedObjectIsAttached",
-              JSNativeThreadSafeWrapper<js::TypedObjectIsAttached>,
-              &js::TypedObjectIsAttachedJitInfo, 1, 0),
-    JS_FNINFO("TypedObjectTypeDescr",
-              JSNativeThreadSafeWrapper<js::TypedObjectTypeDescr>,
-              &js::TypedObjectTypeDescrJitInfo, 1, 0),
-    JS_FNINFO("ObjectIsOpaqueTypedObject",
-              intrinsic_ObjectIsOpaqueTypedObject,
-              &js::ObjectIsOpaqueTypedObjectJitInfo, 1, 0),
-    JS_FNINFO("TypeDescrIsArrayType",
-              intrinsic_TypeDescrIsArrayType,
-              &js::TypeDescrIsArrayTypeJitInfo, 1, 0),
-    JS_FNINFO("TypeDescrIsSimpleType",
-              intrinsic_TypeDescrIsSimpleType,
-              &js::TypeDescrIsSimpleTypeJitInfo, 1, 0),
-    JS_FNINFO("ClampToUint8",
-              JSNativeThreadSafeWrapper<js::ClampToUint8>,
-              &js::ClampToUint8JitInfo, 1, 0),
-    JS_FN("GetTypedObjectModule", js::GetTypedObjectModule, 0, 0),
-    JS_FN("GetFloat32x4TypeDescr", js::GetFloat32x4TypeDescr, 0, 0),
-    JS_FN("GetInt32x4TypeDescr", js::GetInt32x4TypeDescr, 0, 0),
+    JS_FN("NewOpaqueTypedObject",           js::NewOpaqueTypedObject, 1, 0),
+    JS_FN("NewDerivedTypedObject",          js::NewDerivedTypedObject, 3, 0),
+    JS_FN("TypedObjectBuffer",              TypedObject::GetBuffer, 1, 0),
+    JS_FN("TypedObjectByteOffset",          TypedObject::GetByteOffset, 1, 0),
+    JS_FN("AttachTypedObject",              js::AttachTypedObject, 3, 0),
+    JS_FN("SetTypedObjectOffset",           js::SetTypedObjectOffset, 2, 0),
+    JS_FN("ObjectIsTypeDescr"    ,          js::ObjectIsTypeDescr, 1, 0),
+    JS_FN("ObjectIsTypedObject",            js::ObjectIsTypedObject, 1, 0),
+    JS_FN("ObjectIsTransparentTypedObject", js::ObjectIsTransparentTypedObject, 1, 0),
+    JS_FN("TypedObjectIsAttached",          js::TypedObjectIsAttached, 1, 0),
+    JS_FN("TypedObjectTypeDescr",           js::TypedObjectTypeDescr, 1, 0),
+    JS_FN("ObjectIsOpaqueTypedObject",      js::ObjectIsOpaqueTypedObject, 1, 0),
+    JS_FN("TypeDescrIsArrayType",           js::TypeDescrIsArrayType, 1, 0),
+    JS_FN("TypeDescrIsSimpleType",          js::TypeDescrIsSimpleType, 1, 0),
+    JS_FN("ClampToUint8",                   js::ClampToUint8, 1, 0),
+    JS_FN("GetTypedObjectModule",           js::GetTypedObjectModule, 0, 0),
+    JS_FN("GetFloat32x4TypeDescr",          js::GetFloat32x4TypeDescr, 0, 0),
+    JS_FN("GetInt32x4TypeDescr",            js::GetInt32x4TypeDescr, 0, 0),
 
-#define LOAD_AND_STORE_SCALAR_FN_DECLS(_constant, _type, _name)               \
-    JS_FNINFO("Store_" #_name,                                                \
-              JSNativeThreadSafeWrapper<js::StoreScalar##_type::Func>,        \
-              &js::StoreScalar##_type::JitInfo, 3, 0),                        \
-    JS_FNINFO("Load_" #_name,                                                 \
-              JSNativeThreadSafeWrapper<js::LoadScalar##_type::Func>,         \
-              &js::LoadScalar##_type::JitInfo, 3, 0),
+#define LOAD_AND_STORE_SCALAR_FN_DECLS(_constant, _type, _name)         \
+    JS_FN("Store_" #_name, js::StoreScalar##_type::Func, 3, 0),         \
+    JS_FN("Load_" #_name,  js::LoadScalar##_type::Func, 3, 0),
     JS_FOR_EACH_UNIQUE_SCALAR_TYPE_REPR_CTYPE(LOAD_AND_STORE_SCALAR_FN_DECLS)
+#undef LOAD_AND_STORE_SCALAR_FN_DECLS
 
-#define LOAD_AND_STORE_REFERENCE_FN_DECLS(_constant, _type, _name)              \
-    JS_FNINFO("Store_" #_name,                                                  \
-              JSNativeThreadSafeWrapper<js::StoreReference##_type::Func>,       \
-              &js::StoreReference##_type::JitInfo, 3, 0),                       \
-    JS_FNINFO("Load_" #_name,                                                   \
-              JSNativeThreadSafeWrapper<js::LoadReference##_type::Func>,        \
-              &js::LoadReference##_type::JitInfo, 3, 0),
+#define LOAD_AND_STORE_REFERENCE_FN_DECLS(_constant, _type, _name)      \
+    JS_FN("Store_" #_name, js::StoreReference##_type::Func, 3, 0),      \
+    JS_FN("Load_" #_name,  js::LoadReference##_type::Func, 3, 0),
     JS_FOR_EACH_REFERENCE_TYPE_REPR(LOAD_AND_STORE_REFERENCE_FN_DECLS)
+#undef LOAD_AND_STORE_REFERENCE_FN_DECLS
 
     // See builtin/Intl.h for descriptions of the intl_* functions.
     JS_FN("intl_availableCalendars", intl_availableCalendars, 1,0),
     JS_FN("intl_availableCollations", intl_availableCollations, 1,0),
     JS_FN("intl_Collator", intl_Collator, 2,0),
     JS_FN("intl_Collator_availableLocales", intl_Collator_availableLocales, 0,0),
     JS_FN("intl_CompareStrings", intl_CompareStrings, 3,0),
     JS_FN("intl_DateTimeFormat", intl_DateTimeFormat, 2,0),