Commit a5a0eb8b authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[base] Check ThreadedList integrity after Add

If the same VariableProxy is added to a ThreadedList twice, it will
introduce a cycle which would cause a DCHECK failure on the next Add.
This makes it DCHECK as soon as an element is added that already has a
"next" value set.

Change-Id: I720ff6100d8d43e264726039ddaf97c205a5062f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1872391
Auto-Submit: Dan Elphick <delphick@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64452}
parent 392a1217
......@@ -34,6 +34,8 @@ class ThreadedListBase final : public BaseClass {
DCHECK_NULL(*TLTraits::next(v));
*tail_ = v;
tail_ = TLTraits::next(v);
// Check that only one element was added (and that hasn't created a cycle).
DCHECK_NULL(*tail_);
}
void AddFront(T* v) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment