Bug 1240055: IonMonkey: When spewing info about range analysis, also spew truncation info, r=nbp

This commit is contained in:
Hannes Verschore 2016-01-15 11:19:03 -05:00
parent 4f66b1c12b
commit 522562cc1f
2 changed files with 34 additions and 0 deletions

View File

@ -565,6 +565,21 @@ class MDefinition : public MNode
Truncate = 3
};
static const char * TruncateKindString(TruncateKind kind) {
switch(kind) {
case NoTruncate:
return "NoTruncate";
case TruncateAfterBailouts:
return "TruncateAfterBailouts";
case IndirectTruncate:
return "IndirectTruncate";
case Truncate:
return "Truncate";
default:
MOZ_CRASH("Unknown truncate kind.");
}
}
// |needTruncation| records the truncation kind of the results, such that it
// can be used to truncate the operands of this instruction. If
// |needTruncation| function returns true, then the |truncate| function is

View File

@ -123,6 +123,20 @@ SpewRange(MDefinition* def)
#endif
}
static inline void
SpewTruncate(MDefinition* def, MDefinition::TruncateKind kind, bool shouldClone)
{
#ifdef JS_JITSPEW
if (JitSpewEnabled(JitSpew_Range)) {
JitSpewHeader(JitSpew_Range);
Fprinter& out = JitSpewPrinter();
out.printf("truncating ");
def->printName(out);
out.printf(" (kind: %s, clone: %d)\n", MDefinition::TruncateKindString(kind), shouldClone);
}
#endif
}
TempAllocator&
RangeAnalysis::alloc() const
{
@ -3033,6 +3047,8 @@ RangeAnalysis::truncate()
if (!iter->needTruncation(kind))
continue;
SpewTruncate(*iter, kind, shouldClone);
// If needed, clone the current instruction for keeping it for the
// bailout path. This give us the ability to truncate instructions
// even after the removal of branches.
@ -3056,6 +3072,9 @@ RangeAnalysis::truncate()
// Truncate this phi if possible.
if (shouldClone || !iter->needTruncation(kind))
continue;
SpewTruncate(*iter, kind, shouldClone);
iter->truncate();
// Delay updates of inputs/outputs to avoid creating node which