Skip to content

Instantly share code, notes, and snippets.

@hotsphink
Created March 28, 2025 19:35
Show Gist options
  • Save hotsphink/b2d67be54dad7d7258ac47870928cafd to your computer and use it in GitHub Desktop.
Save hotsphink/b2d67be54dad7d7258ac47870928cafd to your computer and use it in GitHub Desktop.
mkgist-created gist
diff --git a/js/public/HeapAPI.h b/js/public/HeapAPI.h
index 0f0a15119a..77be945f8b 100644
--- a/js/public/HeapAPI.h
+++ b/js/public/HeapAPI.h
@@ -489,6 +489,9 @@
return asCell();
}
+ bool operator==(const GCCellPtr other) const { return ptr == other.ptr; }
+ bool operator!=(const GCCellPtr other) const { return ptr != other.ptr; }
+
// Simplify checks to the kind.
template <typename T, typename = std::enable_if_t<JS::IsBaseTraceType_v<T>>>
bool is() const {
@@ -579,17 +582,6 @@
} /* namespace JS */
-// These are defined in the toplevel namespace instead of within JS so that
-// they won't shadow other operator== overloads (see bug 1456512.)
-
-inline bool operator==(JS::GCCellPtr ptr1, JS::GCCellPtr ptr2) {
- return ptr1.asCell() == ptr2.asCell();
-}
-
-inline bool operator!=(JS::GCCellPtr ptr1, JS::GCCellPtr ptr2) {
- return !(ptr1 == ptr2);
-}
-
namespace js {
namespace gc {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment