Bug 1316230 - Update LIR type names for debugging output. r=bbouvier
authorRobin Templeton <robin@igalia.com>
Tue, 08 Nov 2016 21:11:00 -0500
changeset 351972 592187676a06cb47da66e56de1975ec9351c15a6
parent 351971 f0b9e37236b5fc5df582b72942916241f1ece3de
child 351973 d93778ee9f5864056798b29ee6924c28027cd23d
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1316230
milestone52.0a1
Bug 1316230 - Update LIR type names for debugging output. r=bbouvier
js/src/jit/LIR.cpp
--- a/js/src/jit/LIR.cpp
+++ b/js/src/jit/LIR.cpp
@@ -343,46 +343,49 @@ LNode::printName(GenericPrinter& out)
 bool
 LAllocation::aliases(const LAllocation& other) const
 {
     if (isFloatReg() && other.isFloatReg())
         return toFloatReg()->reg().aliases(other.toFloatReg()->reg());
     return *this == other;
 }
 
-static const char * const TypeChars[] =
+static const char*
+typeName(LDefinition::Type type)
 {
-    "g",            // GENERAL
-    "i",            // INT32
-    "i64",          // INT64
-    "o",            // OBJECT
-    "s",            // SLOTS
-    "f",            // FLOAT32
-    "d",            // DOUBLE
-    "simd128int",   // SIMD128INT
-    "simd128float", // SIMD128FLOAT
-    "sincos",       // SINCOS
+    switch (type) {
+      case LDefinition::GENERAL: return "g";
+      case LDefinition::INT32: return "i";
+      case LDefinition::OBJECT: return "o";
+      case LDefinition::SLOTS: return "s";
+      case LDefinition::FLOAT32: return "f";
+      case LDefinition::DOUBLE: return "d";
+      case LDefinition::SIMD128INT: return "simd128int";
+      case LDefinition::SIMD128FLOAT: return "simd128float";
+      case LDefinition::SINCOS: return "sincos";
 #ifdef JS_NUNBOX32
-    "t",            // TYPE
-    "p"             // PAYLOAD
-#elif JS_PUNBOX64
-    "x"             // BOX
+      case LDefinition::TYPE: return "t";
+      case LDefinition::PAYLOAD: return "p";
+#else
+      case LDefinition::BOX: return "x";
 #endif
-};
+    }
+    MOZ_CRASH("Invalid type");
+}
 
 UniqueChars
 LDefinition::toString() const
 {
     AutoEnterOOMUnsafeRegion oomUnsafe;
 
     char* buf;
     if (isBogusTemp()) {
         buf = JS_smprintf("bogus");
     } else {
-        buf = JS_smprintf("v%u<%s>", virtualRegister(), TypeChars[type()]);
+        buf = JS_smprintf("v%u<%s>", virtualRegister(), typeName(type()));
         if (buf) {
             if (policy() == LDefinition::FIXED)
                 buf = JS_sprintf_append(buf, ":%s", output()->toString().get());
             else if (policy() == LDefinition::MUST_REUSE_INPUT)
                 buf = JS_sprintf_append(buf, ":tied(%u)", getReusedInput());
         }
     }
 
@@ -604,15 +607,15 @@ LMoveGroup::addAfter(LAllocation from, L
 
 void
 LMoveGroup::printOperands(GenericPrinter& out)
 {
     for (size_t i = 0; i < numMoves(); i++) {
         const LMove& move = getMove(i);
         out.printf(" [%s -> %s", move.from().toString().get(), move.to().toString().get());
 #ifdef DEBUG
-        out.printf(", %s", TypeChars[move.type()]);
+        out.printf(", %s", typeName(move.type()));
 #endif
         out.printf("]");
         if (i != numMoves() - 1)
             out.printf(",");
     }
 }