LibJS: Make ConservativeVector<T> visit all possible values

We were miscalculating the length of the buffer in pointer-sized chunks,
which is what the conservative root scan cares about.

This could cause some values to be prematurely garbage-collected.

(cherry picked from commit 2fb3b6c542db3a86cbd1aa7e34d470e34c485372)
This commit is contained in:
Andreas Kling authored and Nico Weber committed 2024-11-12 19:57:55 -05:00
1 parent da16c169ae
commit 1c7e69a5b5
1 file changed
+5 -1
@@ -66,7 +66,11 @@ public:
virtual ReadonlySpan<FlatPtr> possible_values() const override
{
return ReadonlySpan<FlatPtr> { reinterpret_cast<FlatPtr const*>(this->data()), this->size() };
static_assert(sizeof(T) >= sizeof(FlatPtr));
return ReadonlySpan<FlatPtr> {
reinterpret_cast<FlatPtr const*>(this->data()),
this->size() * sizeof(T) / sizeof(FlatPtr),
};
}
};