Bug 1036781 - Part 10: Replace MOZ_ASSUME_UNREACHABLE with MOZ_CRASH in js/src/jit MIR code. r=jandem
authorChris Peterson <cpeterson@mozilla.com>
Mon, 01 Sep 2014 14:33:42 -0700
changeset 202893 8106c19ed3b064bb99bef163a4b7b91c262cfeaa
parent 202892 820c379866126e404c8bbf7b906a92e4e4d2e655
child 202894 e8298383cfe75bd03bb6f4102e81e9df976471fa
push id27413
push userphilringnalda@gmail.com
push dateTue, 02 Sep 2014 05:46:30 +0000
treeherdermozilla-central@c360f3d1c00d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1036781
milestone34.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 1036781 - Part 10: Replace MOZ_ASSUME_UNREACHABLE with MOZ_CRASH in js/src/jit MIR code. r=jandem
js/src/jit/MCallOptimize.cpp
js/src/jit/MIR.cpp
js/src/jit/MIR.h
js/src/jit/MIRGraph.cpp
js/src/jit/MOpcodes.h
--- a/js/src/jit/MCallOptimize.cpp
+++ b/js/src/jit/MCallOptimize.cpp
@@ -1525,17 +1525,17 @@ IonBuilder::inlineUnsafePutElements(Call
         }
 
         if (elementAccessIsTypedObjectArrayOfScalarType(obj, id, &arrayType)) {
             if (!inlineUnsafeSetTypedObjectArrayElement(callInfo, base, arrayType))
                 return InliningStatus_Error;
             continue;
         }
 
-        MOZ_ASSUME_UNREACHABLE("Element access not dense array nor typed array");
+        MOZ_CRASH("Element access not dense array nor typed array");
     }
 
     return InliningStatus_Inlined;
 }
 
 bool
 IonBuilder::elementAccessIsTypedObjectArrayOfScalarType(MDefinition* obj, MDefinition* id,
                                                         Scalar::Type *arrayType)
@@ -1640,17 +1640,17 @@ IonBuilder::inlineForceSequentialOrInPar
       }
 
       default:
         // In sequential mode, leave as is, because we'd have to
         // access the "in warmup" flag of the runtime.
         return InliningStatus_NotInlined;
     }
 
-    MOZ_ASSUME_UNREACHABLE("Invalid execution mode");
+    MOZ_CRASH("Invalid execution mode");
 }
 
 IonBuilder::InliningStatus
 IonBuilder::inlineForkJoinGetSlice(CallInfo &callInfo)
 {
     if (info().executionMode() != ParallelExecution)
         return InliningStatus_NotInlined;
 
@@ -1678,17 +1678,17 @@ IonBuilder::inlineForkJoinGetSlice(CallI
         return InliningStatus_NotInlined;
 
       default:
         // ForkJoinGetSlice acts as identity for sequential execution.
         current->push(callInfo.getArg(0));
         return InliningStatus_Inlined;
     }
 
-    MOZ_ASSUME_UNREACHABLE("Invalid execution mode");
+    MOZ_CRASH("Invalid execution mode");
 }
 
 IonBuilder::InliningStatus
 IonBuilder::inlineNewDenseArray(CallInfo &callInfo)
 {
     if (callInfo.constructing() || callInfo.argc() != 1)
         return InliningStatus_NotInlined;
 
@@ -1697,17 +1697,17 @@ IonBuilder::inlineNewDenseArray(CallInfo
     ExecutionMode executionMode = info().executionMode();
     switch (executionMode) {
       case ParallelExecution:
         return inlineNewDenseArrayForParallelExecution(callInfo);
       default:
         return inlineNewDenseArrayForSequentialExecution(callInfo);
     }
 
-    MOZ_ASSUME_UNREACHABLE("unknown ExecutionMode");
+    MOZ_CRASH("unknown ExecutionMode");
 }
 
 IonBuilder::InliningStatus
 IonBuilder::inlineNewDenseArrayForSequentialExecution(CallInfo &callInfo)
 {
     // not yet implemented; in seq. mode the C function is not so bad
     return InliningStatus_NotInlined;
 }
--- a/js/src/jit/MIR.cpp
+++ b/js/src/jit/MIR.cpp
@@ -114,17 +114,17 @@ EvaluateConstantOperands(TempAllocator &
         break;
       case MDefinition::Op_Div:
         ret.setNumber(NumberDiv(lhs.toNumber(), rhs.toNumber()));
         break;
       case MDefinition::Op_Mod:
         ret.setNumber(NumberMod(lhs.toNumber(), rhs.toNumber()));
         break;
       default:
-        MOZ_ASSUME_UNREACHABLE("NYI");
+        MOZ_CRASH("NYI");
     }
 
     // setNumber eagerly transforms a number to int32.
     // Transform back to double, if the output type is double.
     if (ins->type() == MIRType_Double && ret.isInt32())
         ret.setDouble(ret.toNumber());
 
     if (ins->type() != MIRTypeFromValue(ret)) {
@@ -617,17 +617,17 @@ MConstant::printOpcode(FILE *fp) const
         break;
       case MIRType_MagicIsConstructing:
         fprintf(fp, "magic is-constructing");
         break;
       case MIRType_MagicOptimizedOut:
         fprintf(fp, "magic optimized-out");
         break;
       default:
-        MOZ_ASSUME_UNREACHABLE("unexpected type");
+        MOZ_CRASH("unexpected type");
     }
 }
 
 bool
 MConstant::canProduceFloat32() const
 {
     if (!IsNumberType(type()))
         return false;
@@ -661,17 +661,17 @@ MSimdValueX4::foldsTo(TempAllocator &all
       }
       case MIRType_Float32x4: {
         float a[4];
         for (size_t i = 0; i < 4; ++i)
             a[i] = getOperand(i)->toConstant()->value().toNumber();
         cst = SimdConstant::CreateX4(a);
         break;
       }
-      default: MOZ_ASSUME_UNREACHABLE("unexpected type in MSimdValueX4::foldsTo");
+      default: MOZ_CRASH("unexpected type in MSimdValueX4::foldsTo");
     }
 
     return MSimdConstant::New(alloc, cst, type());
 }
 
 MDefinition*
 MSimdSplatX4::foldsTo(TempAllocator &alloc)
 {
@@ -694,17 +694,17 @@ MSimdSplatX4::foldsTo(TempAllocator &all
       case MIRType_Float32x4: {
         float a[4];
         float v = getOperand(0)->toConstant()->value().toNumber();
         for (size_t i = 0; i < 4; ++i)
             a[i] = v;
         cst = SimdConstant::CreateX4(a);
         break;
       }
-      default: MOZ_ASSUME_UNREACHABLE("unexpected type in MSimdSplatX4::foldsTo");
+      default: MOZ_CRASH("unexpected type in MSimdSplatX4::foldsTo");
     }
 
     return MSimdConstant::New(alloc, cst, type());
 }
 
 MCloneLiteral *
 MCloneLiteral::New(TempAllocator &alloc, MDefinition *obj)
 {
@@ -774,17 +774,17 @@ MMathFunction::FunctionName(Function fun
       case ATanH:  return "ATanH";
       case Sign:   return "Sign";
       case Trunc:  return "Trunc";
       case Cbrt:   return "Cbrt";
       case Floor:  return "Floor";
       case Ceil:   return "Ceil";
       case Round:  return "Round";
       default:
-        MOZ_ASSUME_UNREACHABLE("Unknown math function");
+        MOZ_CRASH("Unknown math function");
     }
 }
 
 void
 MMathFunction::printOpcode(FILE *fp) const
 {
     MDefinition::printOpcode(fp);
     fprintf(fp, " %s", FunctionName(function()));
@@ -2086,17 +2086,17 @@ MCompare::inputType()
       case Compare_StrictString:
         return MIRType_String;
       case Compare_Object:
         return MIRType_Object;
       case Compare_Unknown:
       case Compare_Value:
         return MIRType_Value;
       default:
-        MOZ_ASSUME_UNREACHABLE("No known conversion");
+        MOZ_CRASH("No known conversion");
     }
 }
 
 static inline bool
 MustBeUInt32(MDefinition *def, MDefinition **pwrapped)
 {
     if (def->isUrsh()) {
         *pwrapped = def->toUrsh()->getOperand(0);
@@ -2683,17 +2683,17 @@ MCompare::tryFold(bool *result)
           case MIRType_Double:
           case MIRType_Float32:
           case MIRType_String:
           case MIRType_Symbol:
           case MIRType_Boolean:
             *result = (op == JSOP_NE || op == JSOP_STRICTNE);
             return true;
           default:
-            MOZ_ASSUME_UNREACHABLE("Unexpected type");
+            MOZ_CRASH("Unexpected type");
         }
     }
 
     if (compareType_ == Compare_Boolean) {
         JS_ASSERT(op == JSOP_STRICTEQ || op == JSOP_STRICTNE);
         JS_ASSERT(rhs()->type() == MIRType_Boolean);
 
         switch (lhs()->type()) {
@@ -2706,19 +2706,19 @@ MCompare::tryFold(bool *result)
           case MIRType_Symbol:
           case MIRType_Object:
           case MIRType_Null:
           case MIRType_Undefined:
             *result = (op == JSOP_STRICTNE);
             return true;
           case MIRType_Boolean:
             // Int32 specialization should handle this.
-            MOZ_ASSUME_UNREACHABLE("Wrong specialization");
+            MOZ_CRASH("Wrong specialization");
           default:
-            MOZ_ASSUME_UNREACHABLE("Unexpected type");
+            MOZ_CRASH("Unexpected type");
         }
     }
 
     if (compareType_ == Compare_StrictString) {
         JS_ASSERT(op == JSOP_STRICTEQ || op == JSOP_STRICTNE);
         JS_ASSERT(rhs()->type() == MIRType_String);
 
         switch (lhs()->type()) {
@@ -2731,19 +2731,19 @@ MCompare::tryFold(bool *result)
           case MIRType_Symbol:
           case MIRType_Object:
           case MIRType_Null:
           case MIRType_Undefined:
             *result = (op == JSOP_STRICTNE);
             return true;
           case MIRType_String:
             // Compare_String specialization should handle this.
-            MOZ_ASSUME_UNREACHABLE("Wrong specialization");
+            MOZ_CRASH("Wrong specialization");
           default:
-            MOZ_ASSUME_UNREACHABLE("Unexpected type");
+            MOZ_CRASH("Unexpected type");
         }
     }
 
     return false;
 }
 
 bool
 MCompare::evaluateConstantOperands(bool *result)
@@ -2783,17 +2783,17 @@ MCompare::evaluateConstantOperands(bool 
           case JSOP_EQ:
             *result = (comp == 0);
             break;
           case JSOP_STRICTNE: // Fall through.
           case JSOP_NE:
             *result = (comp != 0);
             break;
           default:
-            MOZ_ASSUME_UNREACHABLE("Unexpected op.");
+            MOZ_CRASH("Unexpected op.");
         }
 
         return true;
     }
 
     if (compareType_ == Compare_UInt32) {
         uint32_t lhsUint = uint32_t(lhs.toInt32());
         uint32_t rhsUint = uint32_t(rhs.toInt32());
@@ -2815,17 +2815,17 @@ MCompare::evaluateConstantOperands(bool 
           case JSOP_STRICTEQ:
             *result = (lhsUint == rhsUint);
             break;
           case JSOP_NE:
           case JSOP_STRICTNE:
             *result = (lhsUint != rhsUint);
             break;
           default:
-            MOZ_ASSUME_UNREACHABLE("Unexpected op.");
+            MOZ_CRASH("Unexpected op.");
         }
 
         return true;
     }
 
     if (!lhs.isNumber() || !rhs.isNumber())
         return false;
 
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -1498,17 +1498,17 @@ class MSimdBinaryArith : public MBinaryI
 
     static const char* OperationName(Operation op) {
         switch (op) {
           case Add: return "Add";
           case Sub: return "Sub";
           case Mul: return "Mul";
           case Div: return "Div";
         }
-        MOZ_ASSUME_UNREACHABLE("unexpected operation");
+        MOZ_CRASH("unexpected operation");
     }
 
   private:
     Operation operation_;
 
     MSimdBinaryArith(MDefinition *left, MDefinition *right, Operation op, MIRType type)
       : MBinaryInstruction(left, right), operation_(op)
     {
@@ -3398,17 +3398,17 @@ class MUnbox : public MUnaryInstruction,
             break;
           case MIRType_Symbol:
             kind = Bailout_NonSymbolInput;
             break;
           case MIRType_Object:
             kind = Bailout_NonObjectInput;
             break;
           default:
-            MOZ_ASSUME_UNREACHABLE("Given MIRType cannot be unboxed.");
+            MOZ_CRASH("Given MIRType cannot be unboxed.");
         }
 
         return new(alloc) MUnbox(ins, type, mode, kind);
     }
 
     static MUnbox *New(TempAllocator &alloc, MDefinition *ins, MIRType type, Mode mode,
                        BailoutKind kind)
     {
@@ -5334,17 +5334,17 @@ class MDiv : public MBinaryArithInstruct
         return div;
     }
 
     MDefinition *foldsTo(TempAllocator &alloc);
     void analyzeEdgeCasesForward();
     void analyzeEdgeCasesBackward();
 
     double getIdentity() {
-        MOZ_ASSUME_UNREACHABLE("not used");
+        MOZ_CRASH("not used");
     }
 
     bool canBeNegativeZero() const {
         return canBeNegativeZero_;
     }
     void setCanBeNegativeZero(bool negativeZero) {
         canBeNegativeZero_ = negativeZero;
     }
@@ -5430,17 +5430,17 @@ class MMod : public MBinaryArithInstruct
         if (type == MIRType_Int32)
             mod->setTruncateKind(Truncate);
         return mod;
     }
 
     MDefinition *foldsTo(TempAllocator &alloc);
 
     double getIdentity() {
-        MOZ_ASSUME_UNREACHABLE("not used");
+        MOZ_CRASH("not used");
     }
 
     bool canBeNegativeDividend() const {
         JS_ASSERT(specialization_ == MIRType_Int32);
         return canBeNegativeDividend_;
     }
 
     bool canBeDivideByZero() const {
--- a/js/src/jit/MIRGraph.cpp
+++ b/js/src/jit/MIRGraph.cpp
@@ -1200,17 +1200,17 @@ MBasicBlock::getSuccessor(size_t index) 
 size_t
 MBasicBlock::getSuccessorIndex(MBasicBlock *block) const
 {
     JS_ASSERT(lastIns());
     for (size_t i = 0; i < numSuccessors(); i++) {
         if (getSuccessor(i) == block)
             return i;
     }
-    MOZ_ASSUME_UNREACHABLE("Invalid successor");
+    MOZ_CRASH("Invalid successor");
 }
 
 void
 MBasicBlock::replaceSuccessor(size_t pos, MBasicBlock *split)
 {
     JS_ASSERT(lastIns());
 
     // Note, during split-critical-edges, successors-with-phis is not yet set.
@@ -1232,17 +1232,17 @@ MBasicBlock::replacePredecessor(MBasicBl
             for (size_t j = i; j < numPredecessors(); j++)
                 JS_ASSERT(predecessors_[j] != old);
 #endif
 
             return;
         }
     }
 
-    MOZ_ASSUME_UNREACHABLE("predecessor was not found");
+    MOZ_CRASH("predecessor was not found");
 }
 
 void
 MBasicBlock::clearDominatorInfo()
 {
     setImmediateDominator(nullptr);
     immediatelyDominated_.clear();
     numDominated_ = 0;
@@ -1275,17 +1275,17 @@ MBasicBlock::removePredecessor(MBasicBlo
         }
 
         // Remove from pred list.
         MBasicBlock **ptr = predecessors_.begin() + i;
         predecessors_.erase(ptr);
         return;
     }
 
-    MOZ_ASSUME_UNREACHABLE("predecessor was not found");
+    MOZ_CRASH("predecessor was not found");
 }
 
 void
 MBasicBlock::inheritPhis(MBasicBlock *header)
 {
     MResumePoint *headerRp = header->entryResumePoint();
     size_t stackDepth = headerRp->numOperands();
     for (size_t slot = 0; slot < stackDepth; slot++) {
--- a/js/src/jit/MOpcodes.h
+++ b/js/src/jit/MOpcodes.h
@@ -255,17 +255,17 @@ class MDefinitionVisitor // interface i.
 #undef VISIT_INS
 };
 
 // MDefinition visitor which raises a Not Yet Implemented error for
 // non-overloaded visit functions.
 class MDefinitionVisitorDefaultNYI : public MDefinitionVisitor
 {
   public:
-#define VISIT_INS(op) virtual bool visit##op(M##op *) { MOZ_ASSUME_UNREACHABLE("NYI: " #op); }
+#define VISIT_INS(op) virtual bool visit##op(M##op *) { MOZ_CRASH("NYI: " #op); }
     MIR_OPCODE_LIST(VISIT_INS)
 #undef VISIT_INS
 };
 
 // MDefinition visitor which ignores non-overloaded visit functions.
 class MDefinitionVisitorDefaultNoop : public MDefinitionVisitor
 {
   public: