mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-30 20:37:31 +09:00
Issue #1742 - Remove the ambiguous portions of gc that dealt with tagged pointers for shapes.
Nobody likes "isNullLike(obj)" when trying to garbage collect. It either is or is not. Master Yoda would be pleased with this change.
This commit is contained in:
parent
574b295d15
commit
30a3ec27a2
7 changed files with 3 additions and 29 deletions
|
|
@ -261,8 +261,6 @@ struct InternalBarrierMethods<T*>
|
||||||
{
|
{
|
||||||
static bool isMarkable(T* v) { return v != nullptr; }
|
static bool isMarkable(T* v) { return v != nullptr; }
|
||||||
|
|
||||||
static bool isMarkableTaggedPointer(T* v) { return !IsNullTaggedPointer(v); }
|
|
||||||
|
|
||||||
static void preBarrier(T* v) { T::writeBarrierPre(v); }
|
static void preBarrier(T* v) { T::writeBarrierPre(v); }
|
||||||
|
|
||||||
static void postBarrier(T** vp, T* prev, T* next) { T::writeBarrierPost(vp, prev, next); }
|
static void postBarrier(T** vp, T* prev, T* next) { T::writeBarrierPost(vp, prev, next); }
|
||||||
|
|
@ -282,7 +280,6 @@ template <>
|
||||||
struct InternalBarrierMethods<Value>
|
struct InternalBarrierMethods<Value>
|
||||||
{
|
{
|
||||||
static bool isMarkable(const Value& v) { return v.isGCThing(); }
|
static bool isMarkable(const Value& v) { return v.isGCThing(); }
|
||||||
static bool isMarkableTaggedPointer(const Value& v) { return isMarkable(v); }
|
|
||||||
|
|
||||||
static void preBarrier(const Value& v) {
|
static void preBarrier(const Value& v) {
|
||||||
DispatchTyped(PreBarrierFunctor<Value>(), v);
|
DispatchTyped(PreBarrierFunctor<Value>(), v);
|
||||||
|
|
@ -318,7 +315,6 @@ template <>
|
||||||
struct InternalBarrierMethods<jsid>
|
struct InternalBarrierMethods<jsid>
|
||||||
{
|
{
|
||||||
static bool isMarkable(jsid id) { return JSID_IS_GCTHING(id); }
|
static bool isMarkable(jsid id) { return JSID_IS_GCTHING(id); }
|
||||||
static bool isMarkableTaggedPointer(jsid id) { return isMarkable(id); }
|
|
||||||
|
|
||||||
static void preBarrier(jsid id) { DispatchTyped(PreBarrierFunctor<jsid>(), id); }
|
static void preBarrier(jsid id) { DispatchTyped(PreBarrierFunctor<jsid>(), id); }
|
||||||
static void postBarrier(jsid* idp, jsid prev, jsid next) {}
|
static void postBarrier(jsid* idp, jsid prev, jsid next) {}
|
||||||
|
|
|
||||||
|
|
@ -317,10 +317,6 @@ class TenuredCell : public Cell
|
||||||
MOZ_ALWAYS_INLINE void unmark(uint32_t color) const;
|
MOZ_ALWAYS_INLINE void unmark(uint32_t color) const;
|
||||||
MOZ_ALWAYS_INLINE void copyMarkBitsFrom(const TenuredCell* src);
|
MOZ_ALWAYS_INLINE void copyMarkBitsFrom(const TenuredCell* src);
|
||||||
|
|
||||||
// Note: this is in TenuredCell because JSObject subclasses are sometimes
|
|
||||||
// used tagged.
|
|
||||||
static MOZ_ALWAYS_INLINE bool isNullLike(const Cell* thing) { return !thing; }
|
|
||||||
|
|
||||||
// Access to the arena.
|
// Access to the arena.
|
||||||
inline Arena* arena() const;
|
inline Arena* arena() const;
|
||||||
inline AllocKind getAllocKind() const;
|
inline AllocKind getAllocKind() const;
|
||||||
|
|
@ -1302,7 +1298,7 @@ TenuredCell::isInsideZone(JS::Zone* zone) const
|
||||||
TenuredCell::readBarrier(TenuredCell* thing)
|
TenuredCell::readBarrier(TenuredCell* thing)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!CurrentThreadIsIonCompiling());
|
MOZ_ASSERT(!CurrentThreadIsIonCompiling());
|
||||||
MOZ_ASSERT(!isNullLike(thing));
|
MOZ_ASSERT(thing);
|
||||||
|
|
||||||
// It would be good if barriers were never triggered during collection, but
|
// It would be good if barriers were never triggered during collection, but
|
||||||
// at the moment this can happen e.g. when rekeying tables containing
|
// at the moment this can happen e.g. when rekeying tables containing
|
||||||
|
|
@ -1335,7 +1331,6 @@ AssertSafeToSkipBarrier(TenuredCell* thing);
|
||||||
TenuredCell::writeBarrierPre(TenuredCell* thing)
|
TenuredCell::writeBarrierPre(TenuredCell* thing)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!CurrentThreadIsIonCompiling());
|
MOZ_ASSERT(!CurrentThreadIsIonCompiling());
|
||||||
MOZ_ASSERT_IF(thing, !isNullLike(thing));
|
|
||||||
if (!thing)
|
if (!thing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -501,7 +501,7 @@ void
|
||||||
js::TraceNullableRoot(JSTracer* trc, T* thingp, const char* name)
|
js::TraceNullableRoot(JSTracer* trc, T* thingp, const char* name)
|
||||||
{
|
{
|
||||||
AssertRootMarkingPhase(trc);
|
AssertRootMarkingPhase(trc);
|
||||||
if (InternalBarrierMethods<T>::isMarkableTaggedPointer(*thingp))
|
if (InternalBarrierMethods<T>::isMarkable(*thingp))
|
||||||
DispatchToTracer(trc, ConvertToBase(thingp), name);
|
DispatchToTracer(trc, ConvertToBase(thingp), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -414,14 +414,6 @@ ToMarkable(Cell* cell)
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true if the pointer is nullptr, or if it is a tagged pointer to
|
|
||||||
// nullptr.
|
|
||||||
MOZ_ALWAYS_INLINE bool
|
|
||||||
IsNullTaggedPointer(void* p)
|
|
||||||
{
|
|
||||||
return uintptr_t(p) <= LargestTaggedNullCellPointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wrap a GC thing pointer into a new Value or jsid. The type system enforces
|
// Wrap a GC thing pointer into a new Value or jsid. The type system enforces
|
||||||
// that the thing pointer is a wrappable type.
|
// that the thing pointer is a wrappable type.
|
||||||
template <typename S, typename T>
|
template <typename S, typename T>
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,6 @@ class JSObject : public js::gc::Cell
|
||||||
|
|
||||||
static const JS::TraceKind TraceKind = JS::TraceKind::Object;
|
static const JS::TraceKind TraceKind = JS::TraceKind::Object;
|
||||||
static const size_t MaxTagBits = 3;
|
static const size_t MaxTagBits = 3;
|
||||||
static bool isNullLike(const JSObject* obj) { return uintptr_t(obj) < (1 << MaxTagBits); }
|
|
||||||
|
|
||||||
MOZ_ALWAYS_INLINE JS::Zone* zone() const {
|
MOZ_ALWAYS_INLINE JS::Zone* zone() const {
|
||||||
return group_->zone();
|
return group_->zone();
|
||||||
|
|
@ -635,7 +634,6 @@ struct JSObject_Slots16 : JSObject { void* data[3]; js::Value fslots[16]; };
|
||||||
/* static */ MOZ_ALWAYS_INLINE void
|
/* static */ MOZ_ALWAYS_INLINE void
|
||||||
JSObject::readBarrier(JSObject* obj)
|
JSObject::readBarrier(JSObject* obj)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT_IF(obj, !isNullLike(obj));
|
|
||||||
if (obj && obj->isTenured())
|
if (obj && obj->isTenured())
|
||||||
obj->asTenured().readBarrier(&obj->asTenured());
|
obj->asTenured().readBarrier(&obj->asTenured());
|
||||||
}
|
}
|
||||||
|
|
@ -643,7 +641,6 @@ JSObject::readBarrier(JSObject* obj)
|
||||||
/* static */ MOZ_ALWAYS_INLINE void
|
/* static */ MOZ_ALWAYS_INLINE void
|
||||||
JSObject::writeBarrierPre(JSObject* obj)
|
JSObject::writeBarrierPre(JSObject* obj)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT_IF(obj, !isNullLike(obj));
|
|
||||||
if (obj && obj->isTenured())
|
if (obj && obj->isTenured())
|
||||||
obj->asTenured().writeBarrierPre(&obj->asTenured());
|
obj->asTenured().writeBarrierPre(&obj->asTenured());
|
||||||
}
|
}
|
||||||
|
|
@ -652,8 +649,6 @@ JSObject::writeBarrierPre(JSObject* obj)
|
||||||
JSObject::writeBarrierPost(void* cellp, JSObject* prev, JSObject* next)
|
JSObject::writeBarrierPost(void* cellp, JSObject* prev, JSObject* next)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(cellp);
|
MOZ_ASSERT(cellp);
|
||||||
MOZ_ASSERT_IF(next, !IsNullTaggedPointer(next));
|
|
||||||
MOZ_ASSERT_IF(prev, !IsNullTaggedPointer(prev));
|
|
||||||
|
|
||||||
// If the target needs an entry, add it.
|
// If the target needs an entry, add it.
|
||||||
js::gc::StoreBuffer* buffer;
|
js::gc::StoreBuffer* buffer;
|
||||||
|
|
|
||||||
|
|
@ -521,7 +521,7 @@ class JSString : public js::gc::TenuredCell
|
||||||
}
|
}
|
||||||
|
|
||||||
static MOZ_ALWAYS_INLINE void writeBarrierPre(JSString* thing) {
|
static MOZ_ALWAYS_INLINE void writeBarrierPre(JSString* thing) {
|
||||||
if (isNullLike(thing) || thing->isPermanentAtom())
|
if (!thing || thing->isPermanentAtom())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TenuredCell::writeBarrierPre(thing);
|
TenuredCell::writeBarrierPre(thing);
|
||||||
|
|
|
||||||
|
|
@ -68,10 +68,6 @@ struct InternalBarrierMethods<TaggedProto>
|
||||||
|
|
||||||
static void readBarrier(const TaggedProto& proto);
|
static void readBarrier(const TaggedProto& proto);
|
||||||
|
|
||||||
static bool isMarkableTaggedPointer(TaggedProto proto) {
|
|
||||||
return proto.isObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool isMarkable(TaggedProto proto) {
|
static bool isMarkable(TaggedProto proto) {
|
||||||
return proto.isObject();
|
return proto.isObject();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue