Bug 865889 - Include higher level information about ops in -D output, r=jandem.

This commit is contained in:
Brian Hackett 2013-04-26 16:39:12 -06:00
Родитель 158ef118bc
Коммит 88eb36c56b
4 изменённых файлов: 100 добавлений и 5 удалений

Просмотреть файл

@ -2177,8 +2177,12 @@ struct ScriptCountBlockState
lastLength = masm.size();
last = ins->isMoveGroup() ? &spillBytes : &instructionBytes;
// Prefix stream of assembly instructions with their LIR instruction name.
printer.printf("[%s]\n", ins->opName());
// Prefix stream of assembly instructions with their LIR instruction
// name and any associated high level info.
if (const char *extra = ins->extraName())
printer.printf("[%s:%s]\n", ins->opName(), extra);
else
printer.printf("[%s]\n", ins->opName());
}
~ScriptCountBlockState()

Просмотреть файл

@ -263,6 +263,10 @@ class LNewArray : public LInstructionHelper<1, 0, 0>
public:
LIR_HEADER(NewArray)
const char *extraName() const {
return mir()->shouldUseVM() ? "VMCall" : NULL;
}
MNewArray *mir() const {
return mir_->toNewArray();
}
@ -273,6 +277,10 @@ class LNewObject : public LInstructionHelper<1, 0, 0>
public:
LIR_HEADER(NewObject)
const char *extraName() const {
return mir()->shouldUseVM() ? "VMCall" : NULL;
}
MNewObject *mir() const {
return mir_->toNewObject();
}
@ -1296,6 +1304,10 @@ class LTestVAndBranch : public LInstructionHelper<0, BOX_PIECES, 3>
setTemp(2, temp2);
}
const char *extraName() const {
return mir()->operandMightEmulateUndefined() ? "MightEmulateUndefined" : NULL;
}
static const size_t Input = 0;
const LAllocation *tempFloat() {
@ -1317,7 +1329,7 @@ class LTestVAndBranch : public LInstructionHelper<0, BOX_PIECES, 3>
return ifFalsy_->lir()->label();
}
MTest *mir() {
MTest *mir() const {
return mir_->toTest();
}
};
@ -1871,7 +1883,13 @@ class LBitOpI : public LInstructionHelper<1, 2, 0>
: op_(op)
{ }
JSOp bitop() {
const char *extraName() const {
if (bitop() == JSOP_URSH && mir_->toUrsh()->canOverflow())
return "UrshCanOverflow";
return NULL;
}
JSOp bitop() const {
return op_;
}
};
@ -2137,6 +2155,10 @@ class LAddI : public LBinaryMath<0>
: recoversInput_(false)
{ }
const char *extraName() const {
return snapshot() ? "OverflowCheck" : NULL;
}
virtual bool recoversInput() const {
return recoversInput_;
}
@ -2157,6 +2179,10 @@ class LSubI : public LBinaryMath<0>
: recoversInput_(false)
{ }
const char *extraName() const {
return snapshot() ? "OverflowCheck" : NULL;
}
virtual bool recoversInput() const {
return recoversInput_;
}
@ -2324,6 +2350,10 @@ class LValueToInt32 : public LInstructionHelper<1, BOX_PIECES, 1>
setTemp(0, temp);
}
const char *extraName() const {
return mode() == NORMAL ? "Normal" : "Truncate";
}
static const size_t Input = 0;
Mode mode() const {
@ -2775,6 +2805,11 @@ class LLoadElementV : public LInstructionHelper<BOX_PIECES, 2, 0>
setOperand(0, elements);
setOperand(1, index);
}
const char *extraName() const {
return mir()->needsHoleCheck() ? "HoleCheck" : NULL;
}
const MLoadElement *mir() const {
return mir_->toLoadElement();
}
@ -2829,6 +2864,11 @@ class LLoadElementHole : public LInstructionHelper<BOX_PIECES, 3, 0>
setOperand(1, index);
setOperand(2, initLength);
}
const char *extraName() const {
return mir()->needsHoleCheck() ? "HoleCheck" : NULL;
}
const MLoadElementHole *mir() const {
return mir_->toLoadElementHole();
}
@ -2856,6 +2896,11 @@ class LLoadElementT : public LInstructionHelper<1, 2, 0>
setOperand(0, elements);
setOperand(1, index);
}
const char *extraName() const {
return mir()->needsHoleCheck() ? "HoleCheck" : (mir()->loadDoubles() ? "Doubles" : NULL);
}
const MLoadElement *mir() const {
return mir_->toLoadElement();
}
@ -2878,6 +2923,10 @@ class LStoreElementV : public LInstructionHelper<0, 2 + BOX_PIECES, 0>
setOperand(1, index);
}
const char *extraName() const {
return mir()->needsHoleCheck() ? "HoleCheck" : NULL;
}
static const size_t Value = 2;
const MStoreElement *mir() const {
@ -2906,6 +2955,10 @@ class LStoreElementT : public LInstructionHelper<0, 3, 0>
setOperand(2, value);
}
const char *extraName() const {
return mir()->needsHoleCheck() ? "HoleCheck" : NULL;
}
const MStoreElement *mir() const {
return mir_->toStoreElement();
}
@ -2991,6 +3044,10 @@ class LArrayPopShiftV : public LInstructionHelper<BOX_PIECES, 1, 2>
setTemp(1, temp1);
}
const char *extraName() const {
return mir()->mode() == MArrayPopShift::Pop ? "Pop" : "Shift";
}
const MArrayPopShift *mir() const {
return mir_->toArrayPopShift();
}
@ -3016,6 +3073,10 @@ class LArrayPopShiftT : public LInstructionHelper<1, 1, 2>
setTemp(1, temp1);
}
const char *extraName() const {
return mir()->mode() == MArrayPopShift::Pop ? "Pop" : "Shift";
}
const MArrayPopShift *mir() const {
return mir_->toArrayPopShift();
}

Просмотреть файл

@ -609,6 +609,12 @@ class LInstruction
}
}
// Hook for opcodes to add extra high level detail about what code will be
// emitted for the op.
virtual const char *extraName() const {
return NULL;
}
public:
virtual Opcode op() const = 0;

Просмотреть файл

@ -21,6 +21,20 @@ class LDivI : public LBinaryMath<1>
setTemp(0, temp);
}
const char *extraName() const {
if (mir()->isTruncated()) {
if (mir()->canBeNegativeZero()) {
return mir()->canBeNegativeOverflow()
? "Truncate_NegativeZero_NegativeOverflow"
: "Truncate_NegativeZero";
}
return mir()->canBeNegativeOverflow() ? "Truncate_NegativeOverflow" : "Truncate";
}
if (mir()->canBeNegativeZero())
return mir()->canBeNegativeOverflow() ? "NegativeZero_NegativeOverflow" : "NegativeZero";
return mir()->canBeNegativeOverflow() ? "NegativeOverflow" : NULL;
}
const LDefinition *remainder() {
return getTemp(0);
}
@ -40,6 +54,10 @@ class LModI : public LBinaryMath<1>
setTemp(0, temp);
}
const char *extraName() const {
return mir()->isTruncated() ? "Truncated" : NULL;
}
const LDefinition *remainder() {
return getDef(0);
}
@ -216,7 +234,13 @@ class LMulI : public LBinaryMath<0, 1>
setOperand(2, lhsCopy);
}
MMul *mir() {
const char *extraName() const {
return (mir()->mode() == MMul::Integer)
? "Integer"
: (mir()->canBeNegativeZero() ? "CanBeNegativeZero" : NULL);
}
MMul *mir() const {
return mir_->toMul();
}
const LAllocation *lhsCopy() {