5#ifndef V8_BASE_THREADED_LIST_H_
6#define V8_BASE_THREADED_LIST_H_
18 static T**
next(T* t) {
return t->next(); }
19 static T**
start(T** t) {
return t; }
20 static T*
const*
start(T*
const* t) {
return t; }
32template <
typename T,
typename BaseClass,
33 typename TLTraits = ThreadedListTraits<T>,
34 bool kSupportsUnsafeInsertion =
false>
46 tail_ = TLTraits::next(v);
54 T**
const next = TLTraits::next(v);
64 DCHECK(kSupportsUnsafeInsertion);
66 *TLTraits::next(v) = *TLTraits::next(after_this);
67 *TLTraits::next(after_this) = v;
76 *TLTraits::next(old_head) =
nullptr;
81 if (*it == v)
return true;
87 if (list.is_empty())
return;
96 if (list.head_ ==
nullptr)
return;
99 T* new_head = list.head_;
101 if (
head_ ==
nullptr) {
115 for (; it !=
end(); ++it) {
127 if (last ==
nullptr) {
132 tail_ = TLTraits::next(last);
152 :
head_(other.head_),
160 T* current =
first();
167 while (current !=
nullptr) {
168 T* next = *TLTraits::next(current);
170 *TLTraits::next(current) = *TLTraits::next(next);
171 *TLTraits::next(next) =
nullptr;
173 if (TLTraits::next(next) ==
tail_) {
174 tail_ = TLTraits::next(current);
197 return entry_ == other.entry_;
200 return entry_ != other.entry_;
205 T* next = *TLTraits::next(*
entry_);
206 *TLTraits::next(entry) = next;
214 T* old_entry_value = *
entry_;
216 entry_ = TLTraits::next(value);
217 *
entry_ = old_entry_value;
248 return entry_ == other.entry_;
251 return entry_ != other.entry_;
285 if (from_list->
end() != from_location) {
287 *
tail_ = *from_location;
289 from_list->
Rewind(from_location);
300 if (*it.entry_ ==
head_) {
303 }
else if (
tail_ == TLTraits::next(*it.entry_)) {
305 *it.entry_ =
nullptr;
308 T* old_entry = *it.entry_;
309 *it.entry_ = *TLTraits::next(*it.entry_);
310 *TLTraits::next(old_entry) =
nullptr;
333 T* last = this->
first();
334 if (last ==
nullptr) {
337 while (*TLTraits::next(last) !=
nullptr) {
338 last = *TLTraits::next(last);
346 if (!kSupportsUnsafeInsertion) {
357 if (*
tail_ ==
nullptr)
return;
359 if (last !=
nullptr) {
360 while (*TLTraits::next(last) !=
nullptr) {
361 last = *TLTraits::next(last);
363 tail_ = TLTraits::next(last);
378template <
typename T,
typename TLTraits = ThreadedListTraits<T>>
381template <
typename T,
typename TLTraits = ThreadedListTraits<T>>
ConstIterator(Iterator &iterator)
bool operator!=(const ConstIterator &other) const
ConstIterator & operator++()
std::ptrdiff_t difference_type
const T * operator*() const
std::forward_iterator_tag iterator_category
const value_type * pointer
const value_type reference
ConstIterator(T *const *entry)
bool operator==(const ConstIterator &other) const
void InsertBefore(T *value)
bool operator!=(const Iterator &other) const
bool operator==(const Iterator &other) const
Iterator & operator=(T *entry)
std::ptrdiff_t difference_type
std::forward_iterator_tag iterator_category
void TruncateAt(ThreadedListBase *rem, T *v)
ConstIterator end() const
Iterator RemoveAt(Iterator it)
ThreadedListBase & operator=(ThreadedListBase &&other) V8_NOEXCEPT
void EnsureValidTail() const
ThreadedListBase(ThreadedListBase &&other) V8_NOEXCEPT
ConstIterator begin() const
void Prepend(ThreadedListBase &&list)
ThreadedListBase(const ThreadedListBase &)=delete
ThreadedListBase & operator=(const ThreadedListBase &)=delete
void MoveTail(ThreadedListBase *from_list, Iterator from_location)
void Append(ThreadedListBase &&list)
void Rewind(Iterator reset_point)
static void AddAfter(T *after_this, T *v)
ZoneVector< RpoNumber > & result
static constexpr bool kUnsafeInsertion
#define DCHECK_NOT_NULL(val)
#define CHECK_NOT_NULL(val)
#define CHECK_EQ(lhs, rhs)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
static T *const * start(T *const *t)
std::unique_ptr< ValueMirror > value