diff --git a/js/src/jit/IonAnalysis.cpp b/js/src/jit/IonAnalysis.cpp index 92d9ad97dd97..4175e4043725 100644 --- a/js/src/jit/IonAnalysis.cpp +++ b/js/src/jit/IonAnalysis.cpp @@ -1893,6 +1893,15 @@ LinearSum::print(Sprinter &sp) const sp.printf("%d", constant_); } +void +LinearSum::dump(FILE *fp) const +{ + Sprinter sp(GetIonContext()->cx); + sp.init(); + print(sp); + fprintf(fp, "%s\n", sp.string()); +} + static bool AnalyzePoppedThis(JSContext *cx, types::TypeObject *type, MDefinition *thisValue, MInstruction *ins, bool definitelyExecuted, diff --git a/js/src/jit/IonAnalysis.h b/js/src/jit/IonAnalysis.h index 1a05ffc8c94b..93121f66fdae 100644 --- a/js/src/jit/IonAnalysis.h +++ b/js/src/jit/IonAnalysis.h @@ -118,6 +118,7 @@ class LinearSum LinearTerm term(size_t i) const { return terms_[i]; } void print(Sprinter &sp) const; + void dump(FILE *) const; private: Vector terms_; diff --git a/js/src/jit/RangeAnalysis.cpp b/js/src/jit/RangeAnalysis.cpp index fe08fb0ab127..172d183f0919 100644 --- a/js/src/jit/RangeAnalysis.cpp +++ b/js/src/jit/RangeAnalysis.cpp @@ -106,10 +106,10 @@ SpewRange(MDefinition *def) { #ifdef DEBUG if (IonSpewEnabled(IonSpew_Range) && def->type() != MIRType_None && def->range()) { - Sprinter sp(GetIonContext()->cx); - sp.init(); - def->range()->print(sp); - IonSpew(IonSpew_Range, "%d has range %s", def->id(), sp.string()); + IonSpewHeader(IonSpew_Range); + def->printName(IonSpewFile); + fprintf(IonSpewFile, " has range "); + def->range()->dump(IonSpewFile); } #endif } @@ -235,7 +235,12 @@ RangeAnalysis::addBetaNodes() // [-\inf, bound-1] U [bound+1, \inf] but we only use contiguous ranges. } - IonSpew(IonSpew_Range, "Adding beta node for %d", val->id()); + if (IonSpewEnabled(IonSpew_Range)) { + IonSpewHeader(IonSpew_Range); + fprintf(IonSpewFile, "Adding beta node for %d with range ", val->id()); + comp.dump(IonSpewFile); + } + MBeta *beta = MBeta::New(val, new Range(comp)); block->insertBefore(*block->begin(), beta); replaceDominatedUsesWith(val, beta, block); @@ -322,6 +327,15 @@ Range::print(Sprinter &sp) const sp.printf(" (< pow(2, %d+1))", max_exponent_); } +void +Range::dump(FILE *fp) const +{ + Sprinter sp(GetIonContext()->cx); + sp.init(); + print(sp); + fprintf(fp, "%s\n", sp.string()); +} + Range * Range::intersect(const Range *lhs, const Range *rhs, bool *emptyRange) { diff --git a/js/src/jit/RangeAnalysis.h b/js/src/jit/RangeAnalysis.h index b348b798cce7..bf6446df8752 100644 --- a/js/src/jit/RangeAnalysis.h +++ b/js/src/jit/RangeAnalysis.h @@ -328,6 +328,7 @@ class Range : public TempObject { } void print(Sprinter &sp) const; + void dump(FILE *fp) const; bool update(const Range *other); // Unlike the other operations, unionWith is an in-place