Bug 1147670 - Remove duplicate IsMarked/IsAboutToBeFinalized for off-thread use; r=jonco
☠☠ backed out by 99415fbccf83 ☠ ☠
authorTerrence Cole <terrence@mozilla.com>
Thu, 26 Mar 2015 10:47:44 -0700
changeset 266637 0bd8c4ec41fa8c4df77bfafe5508f9924be3f650
parent 266636 35ad82ff9ee770505514230b39864694cd045a75
child 266638 18af605c42d219670243705655221b4b7f804854
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1147670
milestone39.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 1147670 - Remove duplicate IsMarked/IsAboutToBeFinalized for off-thread use; r=jonco
js/src/gc/Marking.cpp
js/src/gc/Marking.h
js/src/jit/JitcodeMap.cpp
js/src/jsatom.cpp
js/src/jscompartment.cpp
js/src/jscompartment.h
js/src/vm/ArrayBufferObject.cpp
js/src/vm/ObjectGroup.cpp
js/src/vm/RegExpObject.cpp
js/src/vm/SavedStacks.cpp
js/src/vm/ScopeObject.cpp
js/src/vm/Shape.cpp
js/src/vm/TypeInference.cpp
js/src/vm/TypeInference.h
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -5,16 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "gc/Marking.h"
 
 #include "mozilla/DebugOnly.h"
 #include "mozilla/IntegerRange.h"
 #include "mozilla/TypeTraits.h"
 
+#include "jsgc.h"
 #include "jsprf.h"
 
 #include "gc/GCInternals.h"
 #include "jit/IonCode.h"
 #include "js/SliceBudget.h"
 #include "vm/ArgumentsObject.h"
 #include "vm/ArrayObject.h"
 #include "vm/ScopeObject.h"
@@ -790,61 +791,54 @@ MarkRootRange(JSTracer *trc, size_t len,
         }
     }
 }
 
 namespace js {
 namespace gc {
 
 template <typename T>
-static bool
-IsMarked(T **thingp)
+static inline void
+CheckIsMarkedThing(T **thingp)
 {
+#ifdef DEBUG
+    MOZ_ASSERT(thingp);
+    MOZ_ASSERT(*thingp);
+    JSRuntime *rt = (*thingp)->runtimeFromAnyThread();
     MOZ_ASSERT_IF(!ThingIsPermanentAtomOrWellKnownSymbol(*thingp),
-                  CurrentThreadCanAccessRuntime((*thingp)->runtimeFromMainThread()));
-    return IsMarkedFromAnyThread(thingp);
+                  CurrentThreadCanAccessRuntime(rt) ||
+                  (rt->isHeapCollecting() && rt->gc.state() == SWEEP));
+#endif
 }
 
 template <typename T>
 static bool
-IsMarkedFromAnyThread(T **thingp)
+IsMarked(T **thingp)
 {
-    MOZ_ASSERT(thingp);
-    MOZ_ASSERT(*thingp);
+    CheckIsMarkedThing(thingp);
     JSRuntime* rt = (*thingp)->runtimeFromAnyThread();
 
     if (IsInsideNursery(*thingp)) {
-        Nursery &nursery = rt->gc.nursery;
-        return nursery.getForwardedPointer(thingp);
+        MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt));
+        return rt->gc.nursery.getForwardedPointer(thingp);
     }
 
     Zone *zone = (*thingp)->asTenured().zoneFromAnyThread();
     if (!zone->isCollectingFromAnyThread() || zone->isGCFinished())
         return true;
     if (zone->isGCCompacting() && IsForwarded(*thingp))
         *thingp = Forwarded(*thingp);
     return (*thingp)->asTenured().isMarked();
 }
 
 template <typename T>
 static bool
 IsAboutToBeFinalized(T **thingp)
 {
-    MOZ_ASSERT_IF(!ThingIsPermanentAtomOrWellKnownSymbol(*thingp),
-                  CurrentThreadCanAccessRuntime((*thingp)->runtimeFromMainThread()));
-    return IsAboutToBeFinalizedFromAnyThread(thingp);
-}
-
-template <typename T>
-static bool
-IsAboutToBeFinalizedFromAnyThread(T **thingp)
-{
-    MOZ_ASSERT(thingp);
-    MOZ_ASSERT(*thingp);
-
+    CheckIsMarkedThing(thingp);
     T *thing = *thingp;
     JSRuntime *rt = thing->runtimeFromAnyThread();
 
     /* Permanent atoms are never finalized by non-owning runtimes. */
     if (ThingIsPermanentAtomOrWellKnownSymbol(thing) && !TlsPerThreadData.get()->associatedWith(rt))
         return false;
 
     Nursery &nursery = rt->gc.nursery;
@@ -921,52 +915,34 @@ Mark##base##Range(JSTracer *trc, size_t 
                                                                                                   \
 void                                                                                              \
 Mark##base##RootRange(JSTracer *trc, size_t len, type **vec, const char *name)                    \
 {                                                                                                 \
     MarkRootRange<type>(trc, len, vec, name);                                                     \
 }                                                                                                 \
                                                                                                   \
 bool                                                                                              \
-Is##base##MarkedFromAnyThread(type **thingp)                                                      \
-{                                                                                                 \
-    return IsMarkedFromAnyThread<type>(thingp);                                                   \
-}                                                                                                 \
-                                                                                                  \
-bool                                                                                              \
 Is##base##Marked(type **thingp)                                                                   \
 {                                                                                                 \
     return IsMarked<type>(thingp);                                                                \
 }                                                                                                 \
                                                                                                   \
 bool                                                                                              \
-Is##base##MarkedFromAnyThread(BarrieredBase<type*> *thingp)                                       \
-{                                                                                                 \
-    return IsMarkedFromAnyThread<type>(thingp->unsafeGet());                                      \
-}                                                                                                 \
-                                                                                                  \
-bool                                                                                              \
 Is##base##Marked(BarrieredBase<type*> *thingp)                                                    \
 {                                                                                                 \
     return IsMarked<type>(thingp->unsafeGet());                                                   \
 }                                                                                                 \
                                                                                                   \
 bool                                                                                              \
 Is##base##AboutToBeFinalized(type **thingp)                                                       \
 {                                                                                                 \
     return IsAboutToBeFinalized<type>(thingp);                                                    \
 }                                                                                                 \
                                                                                                   \
 bool                                                                                              \
-Is##base##AboutToBeFinalizedFromAnyThread(type **thingp)                                          \
-{                                                                                                 \
-    return IsAboutToBeFinalizedFromAnyThread<type>(thingp);                                       \
-}                                                                                                 \
-                                                                                                  \
-bool                                                                                              \
 Is##base##AboutToBeFinalized(BarrieredBase<type*> *thingp)                                        \
 {                                                                                                 \
     return IsAboutToBeFinalized<type>(thingp->unsafeGet());                                       \
 }                                                                                                 \
                                                                                                   \
 type *                                                                                            \
 Update##base##IfRelocated(JSRuntime *rt, BarrieredBase<type*> *thingp)                            \
 {                                                                                                 \
@@ -1150,38 +1126,16 @@ gc::IsValueAboutToBeFinalized(Value *v)
         MOZ_ASSERT(v->isSymbol());
         JS::Symbol *sym = v->toSymbol();
         rv = IsAboutToBeFinalized<JS::Symbol>(&sym);
         v->setSymbol(sym);
     }
     return rv;
 }
 
-bool
-gc::IsValueAboutToBeFinalizedFromAnyThread(Value *v)
-{
-    MOZ_ASSERT(v->isMarkable());
-    bool rv;
-    if (v->isString()) {
-        JSString *str = (JSString *)v->toGCThing();
-        rv = IsAboutToBeFinalizedFromAnyThread<JSString>(&str);
-        v->setString(str);
-    } else if (v->isObject()) {
-        JSObject *obj = (JSObject *)v->toGCThing();
-        rv = IsAboutToBeFinalizedFromAnyThread<JSObject>(&obj);
-        v->setObject(*obj);
-    } else {
-        MOZ_ASSERT(v->isSymbol());
-        JS::Symbol *sym = v->toSymbol();
-        rv = IsAboutToBeFinalizedFromAnyThread<JS::Symbol>(&sym);
-        v->setSymbol(sym);
-    }
-    return rv;
-}
-
 /*** Type Marking ***/
 
 void
 TypeSet::MarkTypeRoot(JSTracer *trc, TypeSet::Type *v, const char *name)
 {
     JS_ROOT_MARKING_ASSERT(trc);
     MarkTypeUnbarriered(trc, v, name);
 }
--- a/js/src/gc/Marking.h
+++ b/js/src/gc/Marking.h
@@ -133,20 +133,17 @@ namespace gc {
 #define DeclMarker(base, type)                                                                    \
 void Mark##base(JSTracer *trc, BarrieredBase<type*> *thing, const char *name);                    \
 void Mark##base##Root(JSTracer *trc, type **thingp, const char *name);                            \
 void Mark##base##Unbarriered(JSTracer *trc, type **thingp, const char *name);                     \
 void Mark##base##Range(JSTracer *trc, size_t len, HeapPtr<type*> *thing, const char *name);       \
 void Mark##base##RootRange(JSTracer *trc, size_t len, type **thing, const char *name);            \
 bool Is##base##Marked(type **thingp);                                                             \
 bool Is##base##Marked(BarrieredBase<type*> *thingp);                                              \
-bool Is##base##MarkedFromAnyThread(type **thingp);                                                \
-bool Is##base##MarkedFromAnyThread(BarrieredBase<type*> *thingp);                                 \
 bool Is##base##AboutToBeFinalized(type **thingp);                                                 \
-bool Is##base##AboutToBeFinalizedFromAnyThread(type **thingp);                                    \
 bool Is##base##AboutToBeFinalized(BarrieredBase<type*> *thingp);                                  \
 type *Update##base##IfRelocated(JSRuntime *rt, BarrieredBase<type*> *thingp);                     \
 type *Update##base##IfRelocated(JSRuntime *rt, type **thingp);
 
 DeclMarker(BaseShape, BaseShape)
 DeclMarker(BaseShape, UnownedBaseShape)
 DeclMarker(JitCode, jit::JitCode)
 DeclMarker(Object, NativeObject)
@@ -212,19 +209,16 @@ MarkGCThingUnbarriered(JSTracer *trc, vo
 /*** Value Marking ***/
 
 bool
 IsValueMarked(Value *v);
 
 bool
 IsValueAboutToBeFinalized(Value *v);
 
-bool
-IsValueAboutToBeFinalizedFromAnyThread(Value *v);
-
 /*** Slot Marking ***/
 
 bool
 IsSlotMarked(HeapSlot *s);
 
 void
 MarkObjectSlots(JSTracer *trc, NativeObject *obj, uint32_t start, uint32_t nslots);
 
--- a/js/src/jit/JitcodeMap.cpp
+++ b/js/src/jit/JitcodeMap.cpp
@@ -801,87 +801,87 @@ JitcodeGlobalTable::sweep(JSRuntime *rt)
         else
             entry->sweep();
     }
 }
 
 bool
 JitcodeGlobalEntry::BaseEntry::markJitcodeIfUnmarked(JSTracer *trc)
 {
-    if (!IsJitCodeMarkedFromAnyThread(&jitcode_)) {
+    if (!IsJitCodeMarked(&jitcode_)) {
         MarkJitCodeUnbarriered(trc, &jitcode_, "jitcodglobaltable-baseentry-jitcode");
         return true;
     }
     return false;
 }
 
 bool
 JitcodeGlobalEntry::BaseEntry::isJitcodeMarkedFromAnyThread()
 {
-    return IsJitCodeMarkedFromAnyThread(&jitcode_) ||
+    return IsJitCodeMarked(&jitcode_) ||
            jitcode_->arenaHeader()->allocatedDuringIncremental;
 }
 
 bool
 JitcodeGlobalEntry::BaseEntry::isJitcodeAboutToBeFinalized()
 {
     return IsJitCodeAboutToBeFinalized(&jitcode_);
 }
 
 bool
 JitcodeGlobalEntry::BaselineEntry::markIfUnmarked(JSTracer *trc)
 {
-    if (!IsScriptMarkedFromAnyThread(&script_)) {
+    if (!IsScriptMarked(&script_)) {
         MarkScriptUnbarriered(trc, &script_, "jitcodeglobaltable-baselineentry-script");
         return true;
     }
     return false;
 }
 
 void
 JitcodeGlobalEntry::BaselineEntry::sweep()
 {
     MOZ_ALWAYS_FALSE(IsScriptAboutToBeFinalized(&script_));
 }
 
 bool
 JitcodeGlobalEntry::BaselineEntry::isMarkedFromAnyThread()
 {
-    return IsScriptMarkedFromAnyThread(&script_) ||
+    return IsScriptMarked(&script_) ||
            script_->arenaHeader()->allocatedDuringIncremental;
 }
 
 bool
 JitcodeGlobalEntry::IonEntry::markIfUnmarked(JSTracer *trc)
 {
     bool markedAny = false;
 
     for (unsigned i = 0; i < numScripts(); i++) {
-        if (!IsScriptMarkedFromAnyThread(&sizedScriptList()->pairs[i].script)) {
+        if (!IsScriptMarked(&sizedScriptList()->pairs[i].script)) {
             MarkScriptUnbarriered(trc, &sizedScriptList()->pairs[i].script,
                                   "jitcodeglobaltable-ionentry-script");
             markedAny = true;
         }
     }
 
     if (!optsAllTypes_)
         return markedAny;
 
     for (IonTrackedTypeWithAddendum *iter = optsAllTypes_->begin();
          iter != optsAllTypes_->end(); iter++)
     {
-        if (!TypeSet::IsTypeMarkedFromAnyThread(&iter->type)) {
+        if (!TypeSet::IsTypeMarked(&iter->type)) {
             TypeSet::MarkTypeUnbarriered(trc, &iter->type, "jitcodeglobaltable-ionentry-type");
             markedAny = true;
         }
-        if (iter->hasAllocationSite() && !IsScriptMarkedFromAnyThread(&iter->script)) {
+        if (iter->hasAllocationSite() && !IsScriptMarked(&iter->script)) {
             MarkScriptUnbarriered(trc, &iter->script,
                                   "jitcodeglobaltable-ionentry-type-addendum-script");
             markedAny = true;
-        } else if (iter->hasConstructor() && !IsObjectMarkedFromAnyThread(&iter->constructor)) {
+        } else if (iter->hasConstructor() && !IsObjectMarked(&iter->constructor)) {
             MarkObjectUnbarriered(trc, &iter->constructor,
                                   "jitcodeglobaltable-ionentry-type-addendum-constructor");
             markedAny = true;
         }
     }
 
     return markedAny;
 }
@@ -907,30 +907,30 @@ JitcodeGlobalEntry::IonEntry::sweep()
             MOZ_ALWAYS_FALSE(IsObjectAboutToBeFinalized(&iter->constructor));
     }
 }
 
 bool
 JitcodeGlobalEntry::IonEntry::isMarkedFromAnyThread()
 {
     for (unsigned i = 0; i < numScripts(); i++) {
-        if (!IsScriptMarkedFromAnyThread(&sizedScriptList()->pairs[i].script) &&
+        if (!IsScriptMarked(&sizedScriptList()->pairs[i].script) &&
             !sizedScriptList()->pairs[i].script->arenaHeader()->allocatedDuringIncremental)
         {
             return false;
         }
     }
 
     if (!optsAllTypes_)
         return true;
 
     for (IonTrackedTypeWithAddendum *iter = optsAllTypes_->begin();
          iter != optsAllTypes_->end(); iter++)
     {
-        if (!TypeSet::IsTypeMarkedFromAnyThread(&iter->type) &&
+        if (!TypeSet::IsTypeMarked(&iter->type) &&
             !TypeSet::IsTypeAllocatedDuringIncremental(iter->type))
         {
             return false;
         }
     }
 
     return true;
 }
--- a/js/src/jsatom.cpp
+++ b/js/src/jsatom.cpp
@@ -250,17 +250,17 @@ void
 JSRuntime::sweepAtoms()
 {
     if (!atoms_)
         return;
 
     for (AtomSet::Enum e(*atoms_); !e.empty(); e.popFront()) {
         AtomStateEntry entry = e.front();
         JSAtom *atom = entry.asPtr();
-        bool isDying = IsStringAboutToBeFinalizedFromAnyThread(&atom);
+        bool isDying = IsStringAboutToBeFinalized(&atom);
 
         /* Pinned or interned key cannot be finalized. */
         MOZ_ASSERT_IF(hasContexts() && entry.isTagged(), !isDying);
 
         if (isDying)
             e.removeFront();
     }
 }
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -529,28 +529,28 @@ void
 JSCompartment::sweepSavedStacks()
 {
     savedStacks_.sweep(runtimeFromAnyThread());
 }
 
 void
 JSCompartment::sweepGlobalObject(FreeOp *fop)
 {
-    if (global_.unbarrieredGet() && IsObjectAboutToBeFinalizedFromAnyThread(global_.unsafeGet())) {
+    if (global_.unbarrieredGet() && IsObjectAboutToBeFinalized(global_.unsafeGet())) {
         if (isDebuggee())
             Debugger::detachAllDebuggersFromGlobal(fop, global_);
         global_.set(nullptr);
     }
 }
 
 void
 JSCompartment::sweepSelfHostingScriptSource()
 {
     if (selfHostingScriptSource.unbarrieredGet() &&
-        IsObjectAboutToBeFinalizedFromAnyThread((JSObject **) selfHostingScriptSource.unsafeGet()))
+        IsObjectAboutToBeFinalized((JSObject **) selfHostingScriptSource.unsafeGet()))
     {
         selfHostingScriptSource.set(nullptr);
     }
 }
 
 void
 JSCompartment::sweepJitCompartment(FreeOp *fop)
 {
@@ -587,17 +587,17 @@ JSCompartment::sweepWeakMaps()
 void
 JSCompartment::sweepNativeIterators()
 {
     /* Sweep list of native iterators. */
     NativeIterator *ni = enumerators->next();
     while (ni != enumerators) {
         JSObject *iterObj = ni->iterObj();
         NativeIterator *next = ni->next();
-        if (gc::IsObjectAboutToBeFinalizedFromAnyThread(&iterObj))
+        if (gc::IsObjectAboutToBeFinalized(&iterObj))
             ni->unlink();
         ni = next;
     }
 }
 
 /*
  * Remove dead wrappers from the table. We must sweep all compartments, since
  * string entries in the crossCompartmentWrappers table are not marked during
@@ -612,34 +612,34 @@ JSCompartment::sweepCrossCompartmentWrap
         bool keyDying;
         switch (key.kind) {
           case CrossCompartmentKey::ObjectWrapper:
           case CrossCompartmentKey::DebuggerObject:
           case CrossCompartmentKey::DebuggerEnvironment:
           case CrossCompartmentKey::DebuggerSource:
               MOZ_ASSERT(IsInsideNursery(key.wrapped) ||
                          key.wrapped->asTenured().getTraceKind() == JSTRACE_OBJECT);
-              keyDying = IsObjectAboutToBeFinalizedFromAnyThread(
+              keyDying = IsObjectAboutToBeFinalized(
                   reinterpret_cast<JSObject**>(&key.wrapped));
               break;
           case CrossCompartmentKey::StringWrapper:
               MOZ_ASSERT(key.wrapped->asTenured().getTraceKind() == JSTRACE_STRING);
-              keyDying = IsStringAboutToBeFinalizedFromAnyThread(
+              keyDying = IsStringAboutToBeFinalized(
                   reinterpret_cast<JSString**>(&key.wrapped));
               break;
           case CrossCompartmentKey::DebuggerScript:
               MOZ_ASSERT(key.wrapped->asTenured().getTraceKind() == JSTRACE_SCRIPT);
-              keyDying = IsScriptAboutToBeFinalizedFromAnyThread(
+              keyDying = IsScriptAboutToBeFinalized(
                   reinterpret_cast<JSScript**>(&key.wrapped));
               break;
           default:
               MOZ_CRASH("Unknown key kind");
         }
-        bool valDying = IsValueAboutToBeFinalizedFromAnyThread(e.front().value().unsafeGet());
-        bool dbgDying = key.debugger && IsObjectAboutToBeFinalizedFromAnyThread(&key.debugger);
+        bool valDying = IsValueAboutToBeFinalized(e.front().value().unsafeGet());
+        bool dbgDying = key.debugger && IsObjectAboutToBeFinalized(&key.debugger);
         if (keyDying || valDying || dbgDying) {
             MOZ_ASSERT(key.kind != CrossCompartmentKey::StringWrapper);
             e.removeFront();
         } else if (key.wrapped != e.front().key().wrapped ||
                    key.debugger != e.front().key().debugger)
         {
             e.rekeyFront(key);
         }
--- a/js/src/jscompartment.h
+++ b/js/src/jscompartment.h
@@ -361,17 +361,17 @@ struct JSCompartment
             if (!wrap(cx, vec[i]))
                 return false;
         }
         return true;
     };
 
     bool putWrapper(JSContext *cx, const js::CrossCompartmentKey& wrapped, const js::Value& wrapper);
 
-    js::WrapperMap::Ptr lookupWrapper(const js::Value& wrapped) {
+    js::WrapperMap::Ptr lookupWrapper(const js::Value& wrapped) const {
         return crossCompartmentWrappers.lookup(js::CrossCompartmentKey(wrapped));
     }
 
     void removeWrapper(js::WrapperMap::Ptr p) {
         crossCompartmentWrappers.remove(p);
     }
 
     struct WrapperEnum : public js::WrapperMap::Enum {
--- a/js/src/vm/ArrayBufferObject.cpp
+++ b/js/src/vm/ArrayBufferObject.cpp
@@ -1085,22 +1085,22 @@ InnerViewTable::removeViews(ArrayBufferO
     MOZ_ASSERT(p);
 
     map.remove(p);
 }
 
 bool
 InnerViewTable::sweepEntry(JSObject **pkey, ViewVector &views)
 {
-    if (IsObjectAboutToBeFinalizedFromAnyThread(pkey))
+    if (IsObjectAboutToBeFinalized(pkey))
         return true;
 
     MOZ_ASSERT(!views.empty());
     for (size_t i = 0; i < views.length(); i++) {
-        if (IsObjectAboutToBeFinalizedFromAnyThread(&views[i])) {
+        if (IsObjectAboutToBeFinalized(&views[i])) {
             views[i--] = views.back();
             views.popBack();
         }
     }
 
     return views.empty();
 }
 
--- a/js/src/vm/ObjectGroup.cpp
+++ b/js/src/vm/ObjectGroup.cpp
@@ -1400,63 +1400,63 @@ ObjectGroupCompartment::sweep(FreeOp *fo
     if (arrayObjectTable) {
         for (ArrayObjectTable::Enum e(*arrayObjectTable); !e.empty(); e.popFront()) {
             ArrayObjectKey key = e.front().key();
             MOZ_ASSERT(key.type.isUnknown() || !key.type.isSingleton());
 
             bool remove = false;
             if (!key.type.isUnknown() && key.type.isGroup()) {
                 ObjectGroup *group = key.type.groupNoBarrier();
-                if (IsObjectGroupAboutToBeFinalizedFromAnyThread(&group))
+                if (IsObjectGroupAboutToBeFinalized(&group))
                     remove = true;
                 else
                     key.type = TypeSet::ObjectType(group);
             }
             if (key.proto && key.proto != TaggedProto::LazyProto &&
-                IsObjectAboutToBeFinalizedFromAnyThread(&key.proto))
+                IsObjectAboutToBeFinalized(&key.proto))
             {
                 remove = true;
             }
-            if (IsObjectGroupAboutToBeFinalizedFromAnyThread(e.front().value().unsafeGet()))
+            if (IsObjectGroupAboutToBeFinalized(e.front().value().unsafeGet()))
                 remove = true;
 
             if (remove)
                 e.removeFront();
             else if (key != e.front().key())
                 e.rekeyFront(key);
         }
     }
 
     if (plainObjectTable) {
         for (PlainObjectTable::Enum e(*plainObjectTable); !e.empty(); e.popFront()) {
             const PlainObjectKey &key = e.front().key();
             PlainObjectEntry &entry = e.front().value();
 
             bool remove = false;
-            if (IsObjectGroupAboutToBeFinalizedFromAnyThread(entry.group.unsafeGet()))
+            if (IsObjectGroupAboutToBeFinalized(entry.group.unsafeGet()))
                 remove = true;
-            if (IsShapeAboutToBeFinalizedFromAnyThread(entry.shape.unsafeGet()))
+            if (IsShapeAboutToBeFinalized(entry.shape.unsafeGet()))
                 remove = true;
             for (unsigned i = 0; !remove && i < key.nproperties; i++) {
                 if (JSID_IS_STRING(key.properties[i])) {
                     JSString *str = JSID_TO_STRING(key.properties[i]);
-                    if (IsStringAboutToBeFinalizedFromAnyThread(&str))
+                    if (IsStringAboutToBeFinalized(&str))
                         remove = true;
                     MOZ_ASSERT(AtomToId((JSAtom *)str) == key.properties[i]);
                 } else if (JSID_IS_SYMBOL(key.properties[i])) {
                     JS::Symbol *sym = JSID_TO_SYMBOL(key.properties[i]);
-                    if (IsSymbolAboutToBeFinalizedFromAnyThread(&sym))
+                    if (IsSymbolAboutToBeFinalized(&sym))
                         remove = true;
                 }
 
                 MOZ_ASSERT(!entry.types[i].isSingleton());
                 ObjectGroup *group = nullptr;
                 if (entry.types[i].isGroup()) {
                     group = entry.types[i].groupNoBarrier();
-                    if (IsObjectGroupAboutToBeFinalizedFromAnyThread(&group))
+                    if (IsObjectGroupAboutToBeFinalized(&group))
                         remove = true;
                     else if (group != entry.types[i].groupNoBarrier())
                         entry.types[i] = TypeSet::ObjectType(group);
                 }
             }
 
             if (remove) {
                 js_free(key.properties);
@@ -1464,18 +1464,18 @@ ObjectGroupCompartment::sweep(FreeOp *fo
                 e.removeFront();
             }
         }
     }
 
     if (allocationSiteTable) {
         for (AllocationSiteTable::Enum e(*allocationSiteTable); !e.empty(); e.popFront()) {
             AllocationSiteKey key = e.front().key();
-            bool keyDying = IsScriptAboutToBeFinalizedFromAnyThread(&key.script);
-            bool valDying = IsObjectGroupAboutToBeFinalizedFromAnyThread(e.front().value().unsafeGet());
+            bool keyDying = IsScriptAboutToBeFinalized(&key.script);
+            bool valDying = IsObjectGroupAboutToBeFinalized(e.front().value().unsafeGet());
             if (keyDying || valDying)
                 e.removeFront();
             else if (key.script != e.front().key().script)
                 e.rekeyFront(key);
         }
     }
 
     sweepNewTable(defaultNewTable);
@@ -1483,18 +1483,18 @@ ObjectGroupCompartment::sweep(FreeOp *fo
 }
 
 void
 ObjectGroupCompartment::sweepNewTable(NewTable *table)
 {
     if (table && table->initialized()) {
         for (NewTable::Enum e(*table); !e.empty(); e.popFront()) {
             NewEntry entry = e.front();
-            if (IsObjectGroupAboutToBeFinalizedFromAnyThread(entry.group.unsafeGet()) ||
-                (entry.associated && IsObjectAboutToBeFinalizedFromAnyThread(&entry.associated)))
+            if (IsObjectGroupAboutToBeFinalized(entry.group.unsafeGet()) ||
+                (entry.associated && IsObjectAboutToBeFinalized(&entry.associated)))
             {
                 e.removeFront();
             } else {
                 /* Any rekeying necessary is handled by fixupNewObjectGroupTable() below. */
                 MOZ_ASSERT(entry.group.unbarrieredGet() == e.front().group.unbarrieredGet());
                 MOZ_ASSERT(entry.associated == e.front().associated);
             }
         }
--- a/js/src/vm/RegExpObject.cpp
+++ b/js/src/vm/RegExpObject.cpp
@@ -907,35 +907,35 @@ RegExpCompartment::sweep(JSRuntime *rt)
         // restarted while in progress (i.e. performing a full GC in the
         // middle of an incremental GC) or if a RegExpShared referenced via the
         // stack is traced but is not in a zone being collected.
         //
         // Because of this we only treat the marked_ bit as a hint, and destroy
         // the RegExpShared if it was accidentally marked earlier but wasn't
         // marked by the current trace.
         bool keep = shared->marked() &&
-                    IsStringMarkedFromAnyThread(&shared->source);
+                    IsStringMarked(&shared->source);
         for (size_t i = 0; i < ArrayLength(shared->compilationArray); i++) {
             RegExpShared::RegExpCompilation &compilation = shared->compilationArray[i];
             if (compilation.jitCode &&
-                IsJitCodeAboutToBeFinalizedFromAnyThread(compilation.jitCode.unsafeGet()))
+                IsJitCodeAboutToBeFinalized(compilation.jitCode.unsafeGet()))
             {
                 keep = false;
             }
         }
         if (keep || rt->isHeapCompacting()) {
             shared->clearMarked();
         } else {
             js_delete(shared);
             e.removeFront();
         }
     }
 
     if (matchResultTemplateObject_ &&
-        IsObjectAboutToBeFinalizedFromAnyThread(matchResultTemplateObject_.unsafeGet()))
+        IsObjectAboutToBeFinalized(matchResultTemplateObject_.unsafeGet()))
     {
         matchResultTemplateObject_.set(nullptr);
     }
 }
 
 bool
 RegExpCompartment::get(JSContext *cx, JSAtom *source, RegExpFlag flags, RegExpGuard *g)
 {
--- a/js/src/vm/SavedStacks.cpp
+++ b/js/src/vm/SavedStacks.cpp
@@ -812,17 +812,17 @@ SavedStacks::saveCurrentStack(JSContext 
 void
 SavedStacks::sweep(JSRuntime *rt)
 {
     if (frames.initialized()) {
         for (SavedFrame::Set::Enum e(frames); !e.empty(); e.popFront()) {
             JSObject *obj = e.front().unbarrieredGet();
             JSObject *temp = obj;
 
-            if (IsObjectAboutToBeFinalizedFromAnyThread(&obj)) {
+            if (IsObjectAboutToBeFinalized(&obj)) {
                 e.removeFront();
             } else {
                 SavedFrame *frame = &obj->as<SavedFrame>();
                 bool parentMoved = frame->parentMoved();
 
                 if (parentMoved) {
                     frame->updatePrivateParent();
                 }
@@ -1080,17 +1080,17 @@ SavedStacks::createFrameFromLookup(JSCon
  * Remove entries from the table whose JSScript is being collected.
  */
 void
 SavedStacks::sweepPCLocationMap()
 {
     for (PCLocationMap::Enum e(pcLocationMap); !e.empty(); e.popFront()) {
         PCKey key = e.front().key();
         JSScript *script = key.script.get();
-        if (IsScriptAboutToBeFinalizedFromAnyThread(&script)) {
+        if (IsScriptAboutToBeFinalized(&script)) {
             e.removeFront();
         } else if (script != key.script.get()) {
             key.script = script;
             e.rekeyFront(key);
         }
     }
 }
 
--- a/js/src/vm/ScopeObject.cpp
+++ b/js/src/vm/ScopeObject.cpp
@@ -1180,17 +1180,17 @@ MissingScopeKey::match(MissingScopeKey s
 {
     return sk1.frame_ == sk2.frame_ && sk1.staticScope_ == sk2.staticScope_;
 }
 
 void
 LiveScopeVal::sweep()
 {
     if (staticScope_)
-        MOZ_ALWAYS_FALSE(IsObjectAboutToBeFinalizedFromAnyThread(staticScope_.unsafeGet()));
+        MOZ_ALWAYS_FALSE(IsObjectAboutToBeFinalized(staticScope_.unsafeGet()));
 }
 
 // Live ScopeIter values may be added to DebugScopes::liveScopes, as
 // LiveScopeVal instances.  They need to have write barriers when they are added
 // to the hash table, but no barriers when rehashing inside GC.  It's a nasty
 // hack, but the important thing is that LiveScopeVal and MissingScopeKey need to
 // alias each other.
 void
@@ -1878,17 +1878,17 @@ void
 DebugScopes::sweep(JSRuntime *rt)
 {
     /*
      * missingScopes points to debug scopes weakly so that debug scopes can be
      * released more eagerly.
      */
     for (MissingScopeMap::Enum e(missingScopes); !e.empty(); e.popFront()) {
         DebugScopeObject **debugScope = e.front().value().unsafeGet();
-        if (IsObjectAboutToBeFinalizedFromAnyThread(debugScope)) {
+        if (IsObjectAboutToBeFinalized(debugScope)) {
             /*
              * Note that onPopCall and onPopBlock rely on missingScopes to find
              * scope objects that we synthesized for the debugger's sake, and
              * clean up the synthetic scope objects' entries in liveScopes. So
              * if we remove an entry frcom missingScopes here, we must also
              * remove the corresponding liveScopes entry.
              *
              * Since the DebugScopeObject is the only thing using its scope
@@ -1916,17 +1916,17 @@ DebugScopes::sweep(JSRuntime *rt)
         ScopeObject *scope = e.front().key();
 
         e.front().value().sweep();
 
         /*
          * Scopes can be finalized when a debugger-synthesized ScopeObject is
          * no longer reachable via its DebugScopeObject.
          */
-        if (IsObjectAboutToBeFinalizedFromAnyThread(&scope))
+        if (IsObjectAboutToBeFinalized(&scope))
             e.removeFront();
         else if (scope != e.front().key())
             e.rekeyFront(scope);
     }
 }
 
 #ifdef JSGC_HASH_TABLE_CHECKS
 void
--- a/js/src/vm/Shape.cpp
+++ b/js/src/vm/Shape.cpp
@@ -1246,17 +1246,17 @@ BaseShape::assertConsistency()
 void
 JSCompartment::sweepBaseShapeTable()
 {
     if (!baseShapes.initialized())
         return;
 
     for (BaseShapeSet::Enum e(baseShapes); !e.empty(); e.popFront()) {
         UnownedBaseShape *base = e.front().unbarrieredGet();
-        if (IsBaseShapeAboutToBeFinalizedFromAnyThread(&base)) {
+        if (IsBaseShapeAboutToBeFinalized(&base)) {
             e.removeFront();
         } else if (base != e.front().unbarrieredGet()) {
             ReadBarriered<UnownedBaseShape *> b(base);
             e.rekeyFront(base, b);
         }
     }
 }
 
@@ -1531,18 +1531,18 @@ EmptyShape::insertInitialShape(Exclusive
 void
 JSCompartment::sweepInitialShapeTable()
 {
     if (initialShapes.initialized()) {
         for (InitialShapeSet::Enum e(initialShapes); !e.empty(); e.popFront()) {
             const InitialShapeEntry &entry = e.front();
             Shape *shape = entry.shape.unbarrieredGet();
             JSObject *proto = entry.proto.raw();
-            if (IsShapeAboutToBeFinalizedFromAnyThread(&shape) ||
-                (entry.proto.isObject() && IsObjectAboutToBeFinalizedFromAnyThread(&proto)))
+            if (IsShapeAboutToBeFinalized(&shape) ||
+                (entry.proto.isObject() && IsObjectAboutToBeFinalized(&proto)))
             {
                 e.removeFront();
             } else {
                 if (shape != entry.shape.unbarrieredGet() || proto != entry.proto.raw()) {
                     ReadBarrieredShape readBarrieredShape(shape);
                     InitialShapeEntry newKey(readBarrieredShape, TaggedProto(proto));
                     e.rekeyFront(newKey.getLookup(), newKey);
                 }
--- a/js/src/vm/TypeInference.cpp
+++ b/js/src/vm/TypeInference.cpp
@@ -704,26 +704,26 @@ TypeSet::readBarrier(const TypeSet *type
                 (void) key->singleton();
             else
                 (void) key->group();
         }
     }
 }
 
 /* static */ bool
-TypeSet::IsTypeMarkedFromAnyThread(TypeSet::Type *v)
+TypeSet::IsTypeMarked(TypeSet::Type *v)
 {
     bool rv;
     if (v->isSingletonUnchecked()) {
         JSObject *obj = v->singletonNoBarrier();
-        rv = IsObjectMarkedFromAnyThread(&obj);
+        rv = IsObjectMarked(&obj);
         *v = TypeSet::ObjectType(obj);
     } else if (v->isGroupUnchecked()) {
         ObjectGroup *group = v->groupNoBarrier();
-        rv = IsObjectGroupMarkedFromAnyThread(&group);
+        rv = IsObjectGroupMarked(&group);
         *v = TypeSet::ObjectType(group);
     } else {
         rv = true;
     }
     return rv;
 }
 
 /* static */ bool
--- a/js/src/vm/TypeInference.h
+++ b/js/src/vm/TypeInference.h
@@ -525,17 +525,17 @@ class TypeSet
 
     // Get the type of a possibly optimized out or uninitialized let value.
     // This generally only happens on unconditional type monitors on bailing
     // out of Ion, such as for argument and local types.
     static inline Type GetMaybeUntrackedValueType(const Value &val);
 
     static void MarkTypeRoot(JSTracer *trc, Type *v, const char *name);
     static void MarkTypeUnbarriered(JSTracer *trc, Type *v, const char *name);
-    static bool IsTypeMarkedFromAnyThread(Type *v);
+    static bool IsTypeMarked(Type *v);
     static bool IsTypeAllocatedDuringIncremental(Type v);
     static bool IsTypeAboutToBeFinalized(Type *v);
 };
 
 /*
  * A constraint which listens to additions to a type set and propagates those
  * changes to other type sets.
  */