WTF::SentinelLinkedList::iterator should have operator++ for range-for loop
https://bugs.webkit.org/show_bug.cgi?id=237265
Reviewed by Yusuke Suzuki.
Source/JavaScriptCore:
SentinelLinkedList::iterator isn't a pointer of node now, it
should be deferenced before comparing with a pointer.
(JSC::WatchpointSet::fireAllWatchpoints):
(JSC::HandleSet::visitStrongHandles):
(JSC::HandleSet::protectedGlobalObjectCount):
(JSC::HandleSet::forEachStrongHandle):
(JSC::IsoSubspace::tryAllocateFromLowerTier):
(JSC::Subspace::forEachPreciseAllocation):
(Workers::broadcast):
Source/WTF:
SentinelLinkedList had three problems.
- Even though it has begin() and end(), using SentinelLinkedList
with range-for loop resulted in a broken node because
iterator::operator++ didn't work as expected.
- If I used a SentinelLinkedList in a movable type, the sentinel
pointer gets stale after moving the object. move-ctor should be deleted.
- It didn't have const_iterator.
(WTF::OrderMaker::iterator::iterator):
(WTF::OrderMaker::iterator::operator*):
(WTF::OrderMaker::iterator::operator++):
(WTF::OrderMaker::iterator::operator== const):
- wtf/SentinelLinkedList.h:
(WTF::BasicRawSentinelNode::prev const):
(WTF::BasicRawSentinelNode::next const):
(WTF::SentinelLinkedList::BaseIterator::BaseIterator):
(WTF::SentinelLinkedList::BaseIterator::operator* const):
(WTF::SentinelLinkedList::BaseIterator::operator-> const):
(WTF::SentinelLinkedList::BaseIterator::operator++):
(WTF::SentinelLinkedList::BaseIterator::operator--):
(WTF::SentinelLinkedList::BaseIterator::operator== const):
(WTF::SentinelLinkedList::BaseIterator::operator!= const):
(WTF::SentinelLinkedList::forEach):
(WTF::RawNode>::begin):
(WTF::RawNode>::end):
(WTF::RawNode>::begin const):
(WTF::RawNode>::end const):
(WTF::BasicRawSentinelNode::prev): Deleted.
(WTF::BasicRawSentinelNode::next): Deleted.
Tools:
- TestWebKitAPI/Tests/WTF/SentinelLinkedList.cpp:
(TestWebKitAPI::TEST):