Bug 924649 - IonMonkey: Include the function name in MathFunction debug output. r=jandem
authorDan Gohman <sunfish@google.com>
Wed, 09 Oct 2013 08:28:08 -0700
changeset 164070 66369a6578f7b2e9952c8b15af702279920d3bc8
parent 164069 06a14dd3092480dcc83d597db2287f2e8d8ae3a7
child 164071 17411d6192e4a13a7b9e5fb8cabb1e1584aaff1a
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs924649
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 924649 - IonMonkey: Include the function name in MathFunction debug output. r=jandem
js/src/jit/LIR-Common.h
js/src/jit/MIR.cpp
js/src/jit/MIR.h
--- a/js/src/jit/LIR-Common.h
+++ b/js/src/jit/LIR-Common.h
@@ -2330,16 +2330,19 @@ class LMathFunctionD : public LCallInstr
     }
 
     const LDefinition *temp() {
         return getTemp(0);
     }
     MMathFunction *mir() const {
         return mir_->toMathFunction();
     }
+    const char *extraName() const {
+        return MMathFunction::FunctionName(mir()->function());
+    }
 };
 
 // Adds two integers, returning an integer value.
 class LAddI : public LBinaryMath<0>
 {
     bool recoversInput_;
 
   public:
--- a/js/src/jit/MIR.cpp
+++ b/js/src/jit/MIR.cpp
@@ -549,16 +549,55 @@ MAssertRange::printOpcode(FILE *fp) cons
 {
     MDefinition::printOpcode(fp);
     Sprinter sp(GetIonContext()->cx);
     sp.init();
     assertedRange()->print(sp);
     fprintf(fp, " %s", sp.string());
 }
 
+const char *
+MMathFunction::FunctionName(Function function)
+{
+    switch (function) {
+      case Log:    return "Log";
+      case Sin:    return "Sin";
+      case Cos:    return "Cos";
+      case Exp:    return "Exp";
+      case Tan:    return "Tan";
+      case ACos:   return "ACos";
+      case ASin:   return "ASin";
+      case ATan:   return "ATan";
+      case Log10:  return "Log10";
+      case Log2:   return "Log2";
+      case Log1P:  return "Log1P";
+      case ExpM1:  return "ExpM1";
+      case CosH:   return "CosH";
+      case SinH:   return "SinH";
+      case TanH:   return "TanH";
+      case ACosH:  return "ACosH";
+      case ASinH:  return "ASinH";
+      case ATanH:  return "ATanH";
+      case Sign:   return "Sign";
+      case Trunc:  return "Trunc";
+      case Cbrt:   return "Cbrt";
+      case Floor:  return "Floor";
+      case Round:  return "Round";
+      default:
+        MOZ_ASSUME_UNREACHABLE("Unknown math function");
+    }
+}
+
+void
+MMathFunction::printOpcode(FILE *fp) const
+{
+    MDefinition::printOpcode(fp);
+    fprintf(fp, " %s", FunctionName(function()));
+}
+
 MParameter *
 MParameter::New(int32_t index, types::TemporaryTypeSet *types)
 {
     return new MParameter(index, types);
 }
 
 void
 MParameter::printOpcode(FILE *fp) const
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -3653,16 +3653,20 @@ class MMathFunction
 
     AliasSet getAliasSet() const {
         return AliasSet::None();
     }
 
     bool possiblyCalls() const {
         return true;
     }
+
+    void printOpcode(FILE *fp) const;
+
+    static const char *FunctionName(Function function);
 };
 
 class MAdd : public MBinaryArithInstruction
 {
     // Is this instruction really an int at heart?
     MAdd(MDefinition *left, MDefinition *right)
       : MBinaryArithInstruction(left, right)
     {