Bug 1004363 - IonMonkey: Add a toControlInstruction helper function. r=mjrosenb

This commit is contained in:
Dan Gohman 2014-05-14 21:51:56 -07:00
parent d4e734cb37
commit 6adeaa8fb4
2 changed files with 13 additions and 6 deletions

View File

@ -105,6 +105,7 @@ class MNode;
class MUse;
class MIRGraph;
class MResumePoint;
class MControlInstruction;
// Represents a use of a node.
class MUse : public TempObject, public InlineListNode<MUse>
@ -619,10 +620,6 @@ class MDefinition : public MNode
return !uses_.empty();
}
virtual bool isControlInstruction() const {
return false;
}
void addUse(MUse *use) {
uses_.pushFront(use);
}
@ -663,6 +660,11 @@ class MDefinition : public MNode
return !isPhi();
}
virtual bool isControlInstruction() const {
return false;
}
inline MControlInstruction *toControlInstruction();
void setResultType(MIRType type) {
resultType_ = type;
}
@ -10240,6 +10242,11 @@ const MInstruction *MDefinition::toInstruction() const
return (const MInstruction *)this;
}
MControlInstruction *MDefinition::toControlInstruction() {
JS_ASSERT(isControlInstruction());
return (MControlInstruction *)this;
}
typedef Vector<MDefinition *, 8, IonAllocPolicy> MDefinitionVector;
// Helper functions used to decide how to build MIR.

View File

@ -101,8 +101,8 @@ ValueNumberer::simplifyControlInstruction(MControlInstruction *def)
repl->setInWorklist();
block->discardLastIns();
block->end((MControlInstruction *)repl);
return (MControlInstruction *)repl;
block->end(repl->toControlInstruction());
return repl->toControlInstruction();
}
void