LibJS: Don't use GC::Root unnecessarily in Error stack traces

This was causing a fair bit of root registration churn on pages that
throw lots of errors.

Since there's no need for these pointers to float around freely, we can
just visit them during the mark phase as usual.
This commit is contained in:
Andreas Kling
2025-11-30 10:21:50 +01:00
committed by Andreas Kling
parent 6ca69d9e26
commit 2d76e21cfd
Notes: github-actions[bot] 2025-11-30 10:55:07 +00:00
5 changed files with 18 additions and 10 deletions

View File

@@ -21,7 +21,7 @@ struct JS_API TracebackFrame {
Utf16String function_name;
[[nodiscard]] SourceRange const& source_range() const;
GC::Root<CachedSourceRange> cached_source_range;
GC::Ptr<CachedSourceRange> cached_source_range;
};
enum CompactTraceback {
@@ -51,6 +51,8 @@ public:
protected:
explicit Error(Object& prototype);
virtual void visit_edges(Visitor&) override;
private:
virtual bool is_error_object() const final { return true; }