diff --git a/Meta/Lagom/Tools/LibJSGCVerifier/src/CellsHandler.cpp b/Meta/Lagom/Tools/LibJSGCVerifier/src/CellsHandler.cpp index 711c516d1c1..4820add7257 100644 --- a/Meta/Lagom/Tools/LibJSGCVerifier/src/CellsHandler.cpp +++ b/Meta/Lagom/Tools/LibJSGCVerifier/src/CellsHandler.cpp @@ -87,7 +87,7 @@ std::vector get_all_qualified_types(clang::QualType const& type if (auto const* template_specialization = type->getAs()) { auto specialization_name = template_specialization->getTemplateName().getAsTemplateDecl()->getQualifiedNameAsString(); // Do not unwrap GCPtr/NonnullGCPtr - if (specialization_name == "JS::GCPtr" || specialization_name == "JS::NonnullGCPtr") { + if (specialization_name == "JS::GCPtr" || specialization_name == "JS::NonnullGCPtr" || specialization_name == "JS::RawGCPtr") { qualified_types.push_back(type); } else { auto const template_arguments = template_specialization->template_arguments(); @@ -141,7 +141,7 @@ FieldValidationResult validate_field(clang::FieldDecl const* field_decl) } } else if (auto const* specialization = qualified_type->getAs()) { auto template_type_name = specialization->getTemplateName().getAsTemplateDecl()->getName(); - if (template_type_name != "GCPtr" && template_type_name != "NonnullGCPtr") + if (template_type_name != "GCPtr" && template_type_name != "NonnullGCPtr" && template_type_name != "RawGCPtr") return result; auto const template_args = specialization->template_arguments(); @@ -159,7 +159,7 @@ FieldValidationResult validate_field(clang::FieldDecl const* field_decl) result.is_wrapped_in_gcptr = true; result.is_valid = record_inherits_from_cell(*record_decl); - result.needs_visiting = true; + result.needs_visiting = template_type_name != "RawGCPtr"; } } diff --git a/Userland/Libraries/LibJS/Heap/GCPtr.h b/Userland/Libraries/LibJS/Heap/GCPtr.h index 16edf12b808..9a53ee7de53 100644 --- a/Userland/Libraries/LibJS/Heap/GCPtr.h +++ b/Userland/Libraries/LibJS/Heap/GCPtr.h @@ -186,6 +186,10 @@ private: T* m_ptr { nullptr }; }; +// Non-Owning GCPtr +template +using RawGCPtr = GCPtr; + template inline bool operator==(GCPtr const& a, GCPtr const& b) { diff --git a/Userland/Libraries/LibJS/Heap/HeapBlock.h b/Userland/Libraries/LibJS/Heap/HeapBlock.h index b0644dc3f60..a6f121db1cc 100644 --- a/Userland/Libraries/LibJS/Heap/HeapBlock.h +++ b/Userland/Libraries/LibJS/Heap/HeapBlock.h @@ -100,7 +100,7 @@ private: struct FreelistEntry final : public Cell { JS_CELL(FreelistEntry, Cell); - GCPtr next; + RawGCPtr next; }; Cell* cell(size_t index) diff --git a/Userland/Libraries/LibJS/Runtime/WeakSet.h b/Userland/Libraries/LibJS/Runtime/WeakSet.h index a562b6a3a5c..1dd80833146 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakSet.h +++ b/Userland/Libraries/LibJS/Runtime/WeakSet.h @@ -32,7 +32,7 @@ public: private: explicit WeakSet(Object& prototype); - HashTable> m_values; // This stores Cell pointers instead of Object pointers to aide with sweeping + HashTable> m_values; // This stores Cell pointers instead of Object pointers to aide with sweeping }; }