Bug 1004220 - IonMonkey: Add a dump() for MResumePoint r=nbp

This commit is contained in:
Dan Gohman 2014-05-08 09:56:38 -07:00
parent 9650756698
commit 019ea170c8
3 changed files with 57 additions and 1 deletions

View File

@ -292,6 +292,11 @@ MDefinition::dump(FILE *fp) const
fprintf(fp, " = ");
printOpcode(fp);
fprintf(fp, "\n");
if (isInstruction()) {
if (MResumePoint *resume = toInstruction()->resumePoint())
resume->dump(fp);
}
}
void
@ -2306,6 +2311,41 @@ MResumePoint::inherit(MBasicBlock *block)
}
}
void MResumePoint::dump(FILE *fp) const
{
fprintf(fp, "resumepoint mode=");
switch (mode()) {
case MResumePoint::ResumeAt:
fprintf(fp, "At");
break;
case MResumePoint::ResumeAfter:
fprintf(fp, "After");
break;
case MResumePoint::Outer:
fprintf(fp, "Outer");
break;
}
if (MResumePoint *c = caller())
fprintf(fp, " (caller in block%u)", c->block()->id());
for (size_t i = 0; i < numOperands(); i++) {
fprintf(fp, " ");
if (operands_[i].hasProducer())
getOperand(i)->printName(fp);
else
fprintf(fp, "(null)");
}
fprintf(fp, "\n");
}
void
MResumePoint::dump() const
{
dump(stderr);
}
MDefinition *
MToInt32::foldsTo(TempAllocator &alloc, bool useValueNumbers)
{

View File

@ -217,6 +217,9 @@ class MNode : public TempObject
virtual bool writeRecoverData(CompactBufferWriter &writer) const;
virtual void dump(FILE *fp) const = 0;
virtual void dump() const = 0;
protected:
// Sets an unset operand, updating use information.
virtual void setOperand(size_t index, MDefinition *operand) = 0;
@ -613,6 +616,7 @@ class MDefinition : public MNode
# undef OPCODE_CASTS
inline MInstruction *toInstruction();
inline const MInstruction *toInstruction() const;
bool isInstruction() const {
return !isPhi();
}
@ -9669,7 +9673,7 @@ class MResumePoint MOZ_FINAL : public MNode, public InlineForwardListNode<MResum
uint32_t stackDepth() const {
return stackDepth_;
}
MResumePoint *caller() {
MResumePoint *caller() const {
return caller_;
}
void setCaller(MResumePoint *caller) {
@ -9699,6 +9703,9 @@ class MResumePoint MOZ_FINAL : public MNode, public InlineForwardListNode<MResum
}
bool writeRecoverData(CompactBufferWriter &writer) const;
virtual void dump(FILE *fp) const;
virtual void dump() const;
};
class MIsCallable
@ -10206,6 +10213,12 @@ MInstruction *MDefinition::toInstruction()
return (MInstruction *)this;
}
const MInstruction *MDefinition::toInstruction() const
{
JS_ASSERT(!isPhi());
return (const MInstruction *)this;
}
typedef Vector<MDefinition *, 8, IonAllocPolicy> MDefinitionVector;
// Helper functions used to decide how to build MIR.

View File

@ -1278,6 +1278,9 @@ void
MBasicBlock::dump(FILE *fp)
{
#ifdef DEBUG
if (MResumePoint *resume = entryResumePoint()) {
resume->dump();
}
for (MPhiIterator iter(phisBegin()); iter != phisEnd(); iter++) {
iter->dump(fp);
}