mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1027866 - SpiderMonkey: Assert that an element isn't inserted into a InlineList twice. r=jandem
This commit is contained in:
parent
915f4f4e50
commit
502cce6ef5
@ -86,11 +86,11 @@ class InlineForwardList : protected InlineForwardListNode<T>
|
|||||||
insertAfter(this, t);
|
insertAfter(this, t);
|
||||||
}
|
}
|
||||||
void pushBack(Node *t) {
|
void pushBack(Node *t) {
|
||||||
|
JS_ASSERT(t->next == nullptr);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
modifyCount_++;
|
modifyCount_++;
|
||||||
#endif
|
#endif
|
||||||
tail_->next = t;
|
tail_->next = t;
|
||||||
t->next = nullptr;
|
|
||||||
tail_ = t;
|
tail_ = t;
|
||||||
}
|
}
|
||||||
T *popFront() {
|
T *popFront() {
|
||||||
@ -104,6 +104,7 @@ class InlineForwardList : protected InlineForwardListNode<T>
|
|||||||
return static_cast<T *>(tail_);
|
return static_cast<T *>(tail_);
|
||||||
}
|
}
|
||||||
void insertAfter(Node *at, Node *item) {
|
void insertAfter(Node *at, Node *item) {
|
||||||
|
JS_ASSERT(item->next == nullptr);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
modifyCount_++;
|
modifyCount_++;
|
||||||
#endif
|
#endif
|
||||||
@ -120,6 +121,7 @@ class InlineForwardList : protected InlineForwardListNode<T>
|
|||||||
tail_ = at;
|
tail_ = at;
|
||||||
JS_ASSERT(at->next == item);
|
JS_ASSERT(at->next == item);
|
||||||
at->next = item->next;
|
at->next = item->next;
|
||||||
|
item->next = nullptr;
|
||||||
}
|
}
|
||||||
void splitAfter(Node *at, InlineForwardList<T> *to) {
|
void splitAfter(Node *at, InlineForwardList<T> *to) {
|
||||||
JS_ASSERT(to->empty());
|
JS_ASSERT(to->empty());
|
||||||
@ -273,9 +275,15 @@ class InlineList : protected InlineListNode<T>
|
|||||||
void pushFront(Node *t) {
|
void pushFront(Node *t) {
|
||||||
insertAfter(this, t);
|
insertAfter(this, t);
|
||||||
}
|
}
|
||||||
|
void pushFrontUnchecked(Node *t) {
|
||||||
|
insertAfterUnchecked(this, t);
|
||||||
|
}
|
||||||
void pushBack(Node *t) {
|
void pushBack(Node *t) {
|
||||||
insertBefore(this, t);
|
insertBefore(this, t);
|
||||||
}
|
}
|
||||||
|
void pushBackUnchecked(Node *t) {
|
||||||
|
insertBeforeUnchecked(this, t);
|
||||||
|
}
|
||||||
T *popFront() {
|
T *popFront() {
|
||||||
JS_ASSERT(!empty());
|
JS_ASSERT(!empty());
|
||||||
T *t = static_cast<T *>(this->next);
|
T *t = static_cast<T *>(this->next);
|
||||||
@ -294,12 +302,22 @@ class InlineList : protected InlineListNode<T>
|
|||||||
return *iter;
|
return *iter;
|
||||||
}
|
}
|
||||||
void insertBefore(Node *at, Node *item) {
|
void insertBefore(Node *at, Node *item) {
|
||||||
|
JS_ASSERT(item->prev == nullptr);
|
||||||
|
JS_ASSERT(item->next == nullptr);
|
||||||
|
insertBeforeUnchecked(at, item);
|
||||||
|
}
|
||||||
|
void insertBeforeUnchecked(Node *at, Node *item) {
|
||||||
item->next = at;
|
item->next = at;
|
||||||
item->prev = at->prev;
|
item->prev = at->prev;
|
||||||
at->prev->next = item;
|
at->prev->next = item;
|
||||||
at->prev = item;
|
at->prev = item;
|
||||||
}
|
}
|
||||||
void insertAfter(Node *at, Node *item) {
|
void insertAfter(Node *at, Node *item) {
|
||||||
|
JS_ASSERT(item->prev == nullptr);
|
||||||
|
JS_ASSERT(item->next == nullptr);
|
||||||
|
insertAfterUnchecked(at, item);
|
||||||
|
}
|
||||||
|
void insertAfterUnchecked(Node *at, Node *item) {
|
||||||
item->next = at->next;
|
item->next = at->next;
|
||||||
item->prev = at;
|
item->prev = at;
|
||||||
static_cast<Node *>(at->next)->prev = item;
|
static_cast<Node *>(at->next)->prev = item;
|
||||||
|
@ -635,11 +635,11 @@ class MDefinition : public MNode
|
|||||||
}
|
}
|
||||||
|
|
||||||
void addUse(MUse *use) {
|
void addUse(MUse *use) {
|
||||||
// The use can't be in the list at all, but we only check the first
|
|
||||||
// element for now, as that's where it's most likely to be.
|
|
||||||
MOZ_ASSERT(uses_.empty() || use != *uses_.begin());
|
|
||||||
uses_.pushFront(use);
|
uses_.pushFront(use);
|
||||||
}
|
}
|
||||||
|
void addUseUnchecked(MUse *use) {
|
||||||
|
uses_.pushFrontUnchecked(use);
|
||||||
|
}
|
||||||
void replaceAllUsesWith(MDefinition *dom);
|
void replaceAllUsesWith(MDefinition *dom);
|
||||||
|
|
||||||
// Mark this instruction as having replaced all uses of ins, as during GVN,
|
// Mark this instruction as having replaced all uses of ins, as during GVN,
|
||||||
@ -10536,7 +10536,7 @@ void MUse::initUnchecked(MDefinition *producer, MNode *consumer)
|
|||||||
MOZ_ASSERT(consumer, "Initializing to null consumer");
|
MOZ_ASSERT(consumer, "Initializing to null consumer");
|
||||||
consumer_ = consumer;
|
consumer_ = consumer;
|
||||||
producer_ = producer;
|
producer_ = producer;
|
||||||
producer_->addUse(this);
|
producer_->addUseUnchecked(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MUse::initUncheckedWithoutProducer(MNode *consumer)
|
void MUse::initUncheckedWithoutProducer(MNode *consumer)
|
||||||
|
Loading…
Reference in New Issue
Block a user