summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-05-25 18:33:46 +0000
committerMoonchild <moonchild@palemoon.org>2022-05-25 18:33:46 +0000
commitcd55d0fbe4e5dddfc7e0bcc97ffa8a5a9febaff2 (patch)
tree6ac4b39944482f62a472488792b9345e43b28148 /js
parent46c9f72fc0b85a800d003774d3298c66e56de913 (diff)
downloaduxp-cd55d0fbe4e5dddfc7e0bcc97ffa8a5a9febaff2.tar.gz
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.
Diffstat (limited to 'js')
-rw-r--r--js/src/gc/Barrier.h4
-rw-r--r--js/src/gc/Heap.h7
-rw-r--r--js/src/gc/Marking.cpp2
-rw-r--r--js/src/gc/Marking.h8
-rw-r--r--js/src/jsobj.h5
-rw-r--r--js/src/vm/String.h2
-rw-r--r--js/src/vm/TaggedProto.h4
7 files changed, 3 insertions, 29 deletions
diff --git a/js/src/gc/Barrier.h b/js/src/gc/Barrier.h
index d10fb4321c..25f153207f 100644
--- a/js/src/gc/Barrier.h
+++ b/js/src/gc/Barrier.h
@@ -261,8 +261,6 @@ struct InternalBarrierMethods<T*>
{
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 postBarrier(T** vp, T* prev, T* next) { T::writeBarrierPost(vp, prev, next); }
@@ -282,7 +280,6 @@ template <>
struct InternalBarrierMethods<Value>
{
static bool isMarkable(const Value& v) { return v.isGCThing(); }
- static bool isMarkableTaggedPointer(const Value& v) { return isMarkable(v); }
static void preBarrier(const Value& v) {
DispatchTyped(PreBarrierFunctor<Value>(), v);
@@ -318,7 +315,6 @@ template <>
struct InternalBarrierMethods<jsid>
{
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 postBarrier(jsid* idp, jsid prev, jsid next) {}
diff --git a/js/src/gc/Heap.h b/js/src/gc/Heap.h
index 2a10420943..e97aec7469 100644
--- a/js/src/gc/Heap.h
+++ b/js/src/gc/Heap.h
@@ -315,10 +315,6 @@ class TenuredCell : public Cell
MOZ_ALWAYS_INLINE void unmark(uint32_t color) const;
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.
inline Arena* arena() const;
inline AllocKind getAllocKind() const;
@@ -1300,7 +1296,7 @@ TenuredCell::isInsideZone(JS::Zone* zone) const
TenuredCell::readBarrier(TenuredCell* thing)
{
MOZ_ASSERT(!CurrentThreadIsIonCompiling());
- MOZ_ASSERT(!isNullLike(thing));
+ MOZ_ASSERT(thing);
// It would be good if barriers were never triggered during collection, but
// at the moment this can happen e.g. when rekeying tables containing
@@ -1333,7 +1329,6 @@ AssertSafeToSkipBarrier(TenuredCell* thing);
TenuredCell::writeBarrierPre(TenuredCell* thing)
{
MOZ_ASSERT(!CurrentThreadIsIonCompiling());
- MOZ_ASSERT_IF(thing, !isNullLike(thing));
if (!thing)
return;
diff --git a/js/src/gc/Marking.cpp b/js/src/gc/Marking.cpp
index 241a1df20d..da8da5c6b5 100644
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -501,7 +501,7 @@ void
js::TraceNullableRoot(JSTracer* trc, T* thingp, const char* name)
{
AssertRootMarkingPhase(trc);
- if (InternalBarrierMethods<T>::isMarkableTaggedPointer(*thingp))
+ if (InternalBarrierMethods<T>::isMarkable(*thingp))
DispatchToTracer(trc, ConvertToBase(thingp), name);
}
diff --git a/js/src/gc/Marking.h b/js/src/gc/Marking.h
index 2b9e7ace1f..40b331b311 100644
--- a/js/src/gc/Marking.h
+++ b/js/src/gc/Marking.h
@@ -414,14 +414,6 @@ ToMarkable(Cell* 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
// that the thing pointer is a wrappable type.
template <typename S, typename T>
diff --git a/js/src/jsobj.h b/js/src/jsobj.h
index 68491a1aa9..5e0cc347f9 100644
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -299,7 +299,6 @@ class JSObject : public js::gc::Cell
static const JS::TraceKind TraceKind = JS::TraceKind::Object;
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 {
return group_->zone();
@@ -635,7 +634,6 @@ struct JSObject_Slots16 : JSObject { void* data[3]; js::Value fslots[16]; };
/* static */ MOZ_ALWAYS_INLINE void
JSObject::readBarrier(JSObject* obj)
{
- MOZ_ASSERT_IF(obj, !isNullLike(obj));
if (obj && obj->isTenured())
obj->asTenured().readBarrier(&obj->asTenured());
}
@@ -643,7 +641,6 @@ JSObject::readBarrier(JSObject* obj)
/* static */ MOZ_ALWAYS_INLINE void
JSObject::writeBarrierPre(JSObject* obj)
{
- MOZ_ASSERT_IF(obj, !isNullLike(obj));
if (obj && obj->isTenured())
obj->asTenured().writeBarrierPre(&obj->asTenured());
}
@@ -652,8 +649,6 @@ JSObject::writeBarrierPre(JSObject* obj)
JSObject::writeBarrierPost(void* cellp, JSObject* prev, JSObject* next)
{
MOZ_ASSERT(cellp);
- MOZ_ASSERT_IF(next, !IsNullTaggedPointer(next));
- MOZ_ASSERT_IF(prev, !IsNullTaggedPointer(prev));
// If the target needs an entry, add it.
js::gc::StoreBuffer* buffer;
diff --git a/js/src/vm/String.h b/js/src/vm/String.h
index 0937ac24d2..4c43439cd9 100644
--- a/js/src/vm/String.h
+++ b/js/src/vm/String.h
@@ -521,7 +521,7 @@ class JSString : public js::gc::TenuredCell
}
static MOZ_ALWAYS_INLINE void writeBarrierPre(JSString* thing) {
- if (isNullLike(thing) || thing->isPermanentAtom())
+ if (!thing || thing->isPermanentAtom())
return;
TenuredCell::writeBarrierPre(thing);
diff --git a/js/src/vm/TaggedProto.h b/js/src/vm/TaggedProto.h
index 5b9fe5c7e8..10b8c1171b 100644
--- a/js/src/vm/TaggedProto.h
+++ b/js/src/vm/TaggedProto.h
@@ -68,10 +68,6 @@ struct InternalBarrierMethods<TaggedProto>
static void readBarrier(const TaggedProto& proto);
- static bool isMarkableTaggedPointer(TaggedProto proto) {
- return proto.isObject();
- }
-
static bool isMarkable(TaggedProto proto) {
return proto.isObject();
}