From c65b0b9a0019d58eace3fb6d0a93f0990de8f58b Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Fri, 22 Aug 2014 09:29:05 +0100 Subject: [PATCH] Backed out changeset 21bc84614aa2 (bug 1036781) for crashes on Windows; CLOSED TREE --- js/src/jit/BaselineBailouts.cpp | 2 +- js/src/jit/BaselineCompiler.cpp | 2 +- js/src/jit/BaselineDebugModeOSR.cpp | 6 +++--- js/src/jit/BaselineFrameInfo.cpp | 8 ++++---- js/src/jit/BaselineIC.cpp | 32 ++++++++++++++--------------- js/src/jit/BaselineIC.h | 7 ++++--- js/src/jit/BaselineJIT.cpp | 6 +++++- js/src/jit/VMFunctions.cpp | 6 +++--- 8 files changed, 37 insertions(+), 32 deletions(-) diff --git a/js/src/jit/BaselineBailouts.cpp b/js/src/jit/BaselineBailouts.cpp index 377cc48ec5c..917206706c7 100644 --- a/js/src/jit/BaselineBailouts.cpp +++ b/js/src/jit/BaselineBailouts.cpp @@ -1726,7 +1726,7 @@ jit::FinishBailoutToBaseline(BaselineBailoutInfo *bailoutInfo) // baseline frame. return false; default: - MOZ_CRASH("Unknown bailout kind!"); + MOZ_ASSUME_UNREACHABLE("Unknown bailout kind!"); } if (!CheckFrequentBailouts(cx, outerScript)) diff --git a/js/src/jit/BaselineCompiler.cpp b/js/src/jit/BaselineCompiler.cpp index 146370445e0..6dbe9e08156 100644 --- a/js/src/jit/BaselineCompiler.cpp +++ b/js/src/jit/BaselineCompiler.cpp @@ -1394,7 +1394,7 @@ BaselineCompiler::storeValue(const StackValue *source, const Address &dest, masm.storeValue(scratch, dest); break; default: - MOZ_CRASH("Invalid kind"); + MOZ_ASSUME_UNREACHABLE("Invalid kind"); } } diff --git a/js/src/jit/BaselineDebugModeOSR.cpp b/js/src/jit/BaselineDebugModeOSR.cpp index 3091963b2f9..c69c6087e11 100644 --- a/js/src/jit/BaselineDebugModeOSR.cpp +++ b/js/src/jit/BaselineDebugModeOSR.cpp @@ -253,7 +253,7 @@ ICEntryKindToString(ICEntry::Kind kind) case ICEntry::Kind_DebugEpilogue: return "debug epilogue"; default: - MOZ_CRASH("bad ICEntry kind"); + MOZ_ASSUME_UNREACHABLE("bad ICEntry kind"); } } @@ -612,7 +612,7 @@ CloneOldBaselineStub(JSContext *cx, DebugModeOSREntryVector &entries, size_t ent #undef CASE_KIND default: - MOZ_CRASH("Bad stub kind"); + MOZ_ASSUME_UNREACHABLE("Bad stub kind"); } if (!entry.newStub) @@ -714,7 +714,7 @@ BaselineDebugModeOSRInfo::popValueInto(PCMappingSlotInfo::SlotLocation loc, Valu case PCMappingSlotInfo::SlotIgnore: break; default: - MOZ_CRASH("Bad slot location"); + MOZ_ASSUME_UNREACHABLE("Bad slot location"); } stackAdjust++; diff --git a/js/src/jit/BaselineFrameInfo.cpp b/js/src/jit/BaselineFrameInfo.cpp index c00ff7d5681..ee2918e4813 100644 --- a/js/src/jit/BaselineFrameInfo.cpp +++ b/js/src/jit/BaselineFrameInfo.cpp @@ -46,7 +46,7 @@ FrameInfo::sync(StackValue *val) masm.pushValue(val->constant()); break; default: - MOZ_CRASH("Invalid kind"); + MOZ_ASSUME_UNREACHABLE("Invalid kind"); } val->setStack(); @@ -102,7 +102,7 @@ FrameInfo::popValue(ValueOperand dest) masm.moveValue(val->reg(), dest); break; default: - MOZ_CRASH("Invalid kind"); + MOZ_ASSUME_UNREACHABLE("Invalid kind"); } // masm.popValue already adjusted the stack pointer, don't do it twice. @@ -138,7 +138,7 @@ FrameInfo::popRegsAndSync(uint32_t uses) break; } default: - MOZ_CRASH("Invalid uses"); + MOZ_ASSUME_UNREACHABLE("Invalid uses"); } } @@ -175,7 +175,7 @@ FrameInfo::assertValidState(const BytecodeInfo &info) JS_ASSERT(!usedR1); usedR1 = true; } else { - MOZ_CRASH("Invalid register"); + MOZ_ASSUME_UNREACHABLE("Invalid register"); } } } diff --git a/js/src/jit/BaselineIC.cpp b/js/src/jit/BaselineIC.cpp index 80078f7ad38..d2d2adb7e56 100644 --- a/js/src/jit/BaselineIC.cpp +++ b/js/src/jit/BaselineIC.cpp @@ -253,7 +253,7 @@ ICStub::trace(JSTracer *trc) case 2: setElemStub->toImpl<2>()->traceShapes(trc); break; case 3: setElemStub->toImpl<3>()->traceShapes(trc); break; case 4: setElemStub->toImpl<4>()->traceShapes(trc); break; - default: MOZ_CRASH("Invalid proto stub."); + default: MOZ_ASSUME_UNREACHABLE("Invalid proto stub."); } break; } @@ -348,7 +348,7 @@ ICStub::trace(JSTracer *trc) case 6: propStub->toImpl<6>()->traceShapes(trc); break; case 7: propStub->toImpl<7>()->traceShapes(trc); break; case 8: propStub->toImpl<8>()->traceShapes(trc); break; - default: MOZ_CRASH("Invalid proto stub."); + default: MOZ_ASSUME_UNREACHABLE("Invalid proto stub."); } break; } @@ -415,7 +415,7 @@ ICStub::trace(JSTracer *trc) case 2: propStub->toImpl<2>()->traceShapes(trc); break; case 3: propStub->toImpl<3>()->traceShapes(trc); break; case 4: propStub->toImpl<4>()->traceShapes(trc); break; - default: MOZ_CRASH("Invalid proto stub."); + default: MOZ_ASSUME_UNREACHABLE("Invalid proto stub."); } break; } @@ -827,7 +827,7 @@ EnsureCanEnterIon(JSContext *cx, ICUseCount_Fallback *stub, BaselineFrame *frame else if (stat == Method_Compiled) IonSpew(IonSpew_BaselineOSR, " Compiled with Ion!"); else - MOZ_CRASH("Invalid MethodStatus!"); + MOZ_ASSUME_UNREACHABLE("Invalid MethodStatus!"); // Failed to compile. Reset use count and return. if (stat != Method_Compiled) { @@ -1544,7 +1544,7 @@ DoTypeUpdateFallback(JSContext *cx, BaselineFrame *frame, ICUpdatedStub *stub, H break; } default: - MOZ_CRASH("Invalid stub"); + MOZ_ASSUME_UNREACHABLE("Invalid stub"); } return stub->addUpdateStubForValue(cx, script, obj, id, value); @@ -2590,7 +2590,7 @@ DoBinaryArithFallback(JSContext *cx, BaselineFrame *frame, ICBinaryArith_Fallbac break; } default: - MOZ_CRASH("Unhandled baseline arith op"); + MOZ_ASSUME_UNREACHABLE("Unhandled baseline arith op"); } // Check if debug mode toggling made the stub invalid. @@ -2914,7 +2914,7 @@ ICBinaryArith_Double::Compiler::generateStubCode(MacroAssembler &masm) JS_ASSERT(ReturnDoubleReg == FloatReg0); break; default: - MOZ_CRASH("Unexpected op"); + MOZ_ASSUME_UNREACHABLE("Unexpected op"); } masm.boxDouble(FloatReg0, R0); @@ -2992,7 +2992,7 @@ ICBinaryArith_BooleanWithInt32::Compiler::generateStubCode(MacroAssembler &masm) break; } default: - MOZ_CRASH("Unhandled op for BinaryArith_BooleanWithInt32."); + MOZ_ASSUME_UNREACHABLE("Unhandled op for BinaryArith_BooleanWithInt32."); } // Failure case - jump to next stub @@ -3054,7 +3054,7 @@ ICBinaryArith_DoubleWithInt32::Compiler::generateStubCode(MacroAssembler &masm) masm.andPtr(intReg, intReg2); break; default: - MOZ_CRASH("Unhandled op for BinaryArith_DoubleWithInt32."); + MOZ_ASSUME_UNREACHABLE("Unhandled op for BinaryArith_DoubleWithInt32."); } masm.tagValue(JSVAL_TYPE_INT32, intReg2, R0); EmitReturnFromIC(masm); @@ -3098,7 +3098,7 @@ DoUnaryArithFallback(JSContext *cx, BaselineFrame *frame, ICUnaryArith_Fallback return false; break; default: - MOZ_CRASH("Unexpected op"); + MOZ_ASSUME_UNREACHABLE("Unexpected op"); } // Check if debug mode toggling made the stub invalid. @@ -3738,7 +3738,7 @@ RemoveExistingGetElemNativeStubs(JSContext *cx, ICGetElem_Fallback *stub, Handle // Should never get here, because this means a matching stub exists, and if // a matching stub exists, this procedure should never have been called. - MOZ_CRASH("Procedure should never have been called."); + MOZ_ASSUME_UNREACHABLE("Procedure should never have been called."); } } @@ -5354,7 +5354,7 @@ ICSetElemDenseAddCompiler::getStub(ICStubSpace *space) case 2: stub = getStubSpecific<2>(space, &shapes); break; case 3: stub = getStubSpecific<3>(space, &shapes); break; case 4: stub = getStubSpecific<4>(space, &shapes); break; - default: MOZ_CRASH("ProtoChainDepth too high."); + default: MOZ_ASSUME_UNREACHABLE("ProtoChainDepth too high."); } if (!stub || !stub->initUpdatingChain(cx, space)) return nullptr; @@ -6714,7 +6714,7 @@ ICGetProp_Primitive::Compiler::generateStubCode(MacroAssembler &masm) masm.branchTestBoolean(Assembler::NotEqual, R0, &failure); break; default: - MOZ_CRASH("unexpected type"); + MOZ_ASSUME_UNREACHABLE("unexpected type"); } GeneralRegisterSet regs(availableGeneralRegs(1)); @@ -6869,7 +6869,7 @@ ICGetPropNativeDoesNotExistCompiler::getStub(ICStubSpace *space) case 6: stub = getStubSpecific<6>(space, &shapes); break; case 7: stub = getStubSpecific<7>(space, &shapes); break; case 8: stub = getStubSpecific<8>(space, &shapes); break; - default: MOZ_CRASH("ProtoChainDepth too high."); + default: MOZ_ASSUME_UNREACHABLE("ProtoChainDepth too high."); } if (!stub) return nullptr; @@ -7748,7 +7748,7 @@ ICSetPropNativeAddCompiler::getStub(ICStubSpace *space) case 2: stub = getStubSpecific<2>(space, &shapes); break; case 3: stub = getStubSpecific<3>(space, &shapes); break; case 4: stub = getStubSpecific<4>(space, &shapes); break; - default: MOZ_CRASH("ProtoChainDepth too high."); + default: MOZ_ASSUME_UNREACHABLE("ProtoChainDepth too high."); } if (!stub || !stub->initUpdatingChain(cx, space)) return nullptr; @@ -10051,7 +10051,7 @@ ICTypeOf_Typed::Compiler::generateStubCode(MacroAssembler &masm) break; default: - MOZ_CRASH("Unexpected type"); + MOZ_ASSUME_UNREACHABLE("Unexpected type"); } masm.movePtr(ImmGCPtr(typeString_), R0.scratchReg()); diff --git a/js/src/jit/BaselineIC.h b/js/src/jit/BaselineIC.h index 3997c1061d9..a95143421f7 100644 --- a/js/src/jit/BaselineIC.h +++ b/js/src/jit/BaselineIC.h @@ -595,7 +595,7 @@ class ICStub IC_STUB_KIND_LIST(DEF_KIND_STR) #undef DEF_KIND_STR default: - MOZ_CRASH("Invalid kind."); + MOZ_ASSUME_UNREACHABLE("Invalid kind."); } } @@ -1130,7 +1130,7 @@ class ICStubCompiler regs.take(R1); break; default: - MOZ_CRASH("Invalid numInputs"); + MOZ_ASSUME_UNREACHABLE("Invalid numInputs"); } return regs; @@ -3306,7 +3306,8 @@ class ICGetElemNativeCompiler : public ICStubCompiler getter_, pcOffset_, holder_, holderShape); } - MOZ_CRASH("Invalid kind."); + MOZ_ASSUME_UNREACHABLE("Invalid kind."); + return nullptr; } }; diff --git a/js/src/jit/BaselineJIT.cpp b/js/src/jit/BaselineJIT.cpp index 5843a988947..64ec53ae6d7 100644 --- a/js/src/jit/BaselineJIT.cpp +++ b/js/src/jit/BaselineJIT.cpp @@ -539,7 +539,7 @@ BaselineScript::icEntryFromPCOffset(uint32_t pcOffset) if (icEntry(i).isForOp()) return icEntry(i); } - MOZ_CRASH("Invalid PC offset for IC entry."); + MOZ_ASSUME_UNREACHABLE("Invalid PC offset for IC entry."); } ICEntry & @@ -681,6 +681,8 @@ BaselineScript::nativeCodeForPC(JSScript *script, jsbytecode *pc, PCMappingSlotI curPC += GetBytecodeLength(curPC); } + + MOZ_ASSUME_UNREACHABLE("Invalid pc"); } jsbytecode * @@ -755,6 +757,8 @@ BaselineScript::pcForNativeOffset(JSScript *script, uint32_t nativeOffset, bool curPC += GetBytecodeLength(curPC); } + + MOZ_ASSUME_UNREACHABLE("Bad baseline jitcode address"); } jsbytecode * diff --git a/js/src/jit/VMFunctions.cpp b/js/src/jit/VMFunctions.cpp index 2939868c601..8bc62592d0b 100644 --- a/js/src/jit/VMFunctions.cpp +++ b/js/src/jit/VMFunctions.cpp @@ -813,7 +813,7 @@ DebugPrologue(JSContext *cx, BaselineFrame *frame, jsbytecode *pc, bool *mustRet return false; default: - MOZ_CRASH("Invalid trap status"); + MOZ_ASSUME_UNREACHABLE("Invalid trap status"); } } @@ -965,7 +965,7 @@ HandleDebugTrap(JSContext *cx, BaselineFrame *frame, uint8_t *retAddr, bool *mus return false; default: - MOZ_CRASH("Invalid trap status"); + MOZ_ASSUME_UNREACHABLE("Invalid trap status"); } return true; @@ -996,7 +996,7 @@ OnDebuggerStatement(JSContext *cx, BaselineFrame *frame, jsbytecode *pc, bool *m return false; default: - MOZ_CRASH("Invalid trap status"); + MOZ_ASSUME_UNREACHABLE("Invalid trap status"); } }