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.
This commit is contained in:
Andreas Kling 2024-11-12 15:21:02 +01:00 committed by Andreas Kling
parent faf6fd1189
commit 2fb3b6c542
Notes: github-actions[bot] 2024-11-12 16:39:36 +00:00

View file

@ -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),
};
}
};