bool MMul::writeRecoverData(CompactBufferWriter &writer) const { MOZ_ASSERT(canRecoverOnBailout()); writer.writeUnsigned(uint32_t(RInstruction::Recover_Mul)); writer.writeByte(specialization_ == MIRType_Float32); return true; }
bool MSqrt::writeRecoverData(CompactBufferWriter& writer) const { MOZ_ASSERT(canRecoverOnBailout()); writer.writeUnsigned(uint32_t(RInstruction::Recover_Sqrt)); writer.writeByte(type() == MIRType_Float32); return true; }
bool MMathFunction::writeRecoverData(CompactBufferWriter& writer) const { MOZ_ASSERT(canRecoverOnBailout()); switch (function_) { case Round: writer.writeUnsigned(uint32_t(RInstruction::Recover_Round)); return true; case Sin: case Log: writer.writeUnsigned(uint32_t(RInstruction::Recover_MathFunction)); writer.writeByte(function_); return true; default: MOZ_CRASH("Unknown math function."); } }
bool MMinMax::writeRecoverData(CompactBufferWriter& writer) const { MOZ_ASSERT(canRecoverOnBailout()); writer.writeUnsigned(uint32_t(RInstruction::Recover_MinMax)); writer.writeByte(isMax_); return true; }
bool MStringReplace::writeRecoverData(CompactBufferWriter& writer) const { MOZ_ASSERT(canRecoverOnBailout()); writer.writeUnsigned(uint32_t(RInstruction::Recover_StringReplace)); writer.writeByte(isFlatReplacement_); return true; }
bool MNewObject::writeRecoverData(CompactBufferWriter &writer) const { MOZ_ASSERT(canRecoverOnBailout()); writer.writeUnsigned(uint32_t(RInstruction::Recover_NewObject)); writer.writeByte(templateObjectIsClassPrototype_); return true; }
bool MCreateThisWithTemplate::writeRecoverData(CompactBufferWriter &writer) const { MOZ_ASSERT(canRecoverOnBailout()); writer.writeUnsigned(uint32_t(RInstruction::Recover_CreateThisWithTemplate)); writer.writeByte(bool(initialHeap() == gc::TenuredHeap)); return true; }
bool MAssertRecoveredOnBailout::writeRecoverData(CompactBufferWriter& writer) const { MOZ_ASSERT(canRecoverOnBailout()); MOZ_RELEASE_ASSERT(input()->isRecoveredOnBailout() == mustBeRecovered_, "assertRecoveredOnBailout failed during compilation"); writer.writeUnsigned(uint32_t(RInstruction::Recover_AssertRecoveredOnBailout)); return true; }
bool MNewObject::writeRecoverData(CompactBufferWriter& writer) const { MOZ_ASSERT(canRecoverOnBailout()); writer.writeUnsigned(uint32_t(RInstruction::Recover_NewObject)); MOZ_ASSERT(Mode(uint8_t(mode_)) == mode_); writer.writeByte(uint8_t(mode_)); return true; }
bool MSimdBox::writeRecoverData(CompactBufferWriter& writer) const { MOZ_ASSERT(canRecoverOnBailout()); writer.writeUnsigned(uint32_t(RInstruction::Recover_SimdBox)); static_assert(unsigned(SimdType::Count) < 0x100, "assuming SimdType fits in 8 bits"); writer.writeByte(uint8_t(simdType())); return true; }
bool MSimdBox::writeRecoverData(CompactBufferWriter& writer) const { MOZ_ASSERT(canRecoverOnBailout()); writer.writeUnsigned(uint32_t(RInstruction::Recover_SimdBox)); static_assert(sizeof(SimdType) == sizeof(uint8_t), "assuming uint8 storage class for SimdType"); writer.writeByte(uint8_t(simdType())); return true; }
bool MSimdBox::writeRecoverData(CompactBufferWriter& writer) const { MOZ_ASSERT(canRecoverOnBailout()); writer.writeUnsigned(uint32_t(RInstruction::Recover_SimdBox)); SimdTypeDescr& simdTypeDescr = templateObject()->typeDescr().as<SimdTypeDescr>(); SimdTypeDescr::Type type = simdTypeDescr.type(); writer.writeByte(uint8_t(type)); return true; }
bool MMathFunction::writeRecoverData(CompactBufferWriter &writer) const { MOZ_ASSERT(canRecoverOnBailout()); switch (function_) { case Round: writer.writeUnsigned(uint32_t(RInstruction::Recover_Round)); return true; default: MOZ_ASSUME_UNREACHABLE("Unknown math function."); return false; } }
bool MRegExpExec::writeRecoverData(CompactBufferWriter &writer) const { MOZ_ASSERT(canRecoverOnBailout()); writer.writeUnsigned(uint32_t(RInstruction::Recover_RegExpExec)); return true; }
bool MResumePoint::writeRecoverData(CompactBufferWriter &writer) const { writer.writeUnsigned(uint32_t(RInstruction::Recover_ResumePoint)); MBasicBlock *bb = block(); JSFunction *fun = bb->info().funMaybeLazy(); JSScript *script = bb->info().script(); uint32_t exprStack = stackDepth() - bb->info().ninvoke(); #ifdef DEBUG // Ensure that all snapshot which are encoded can safely be used for // bailouts. if (GetIonContext()->cx) { uint32_t stackDepth; bool reachablePC; jsbytecode *bailPC = pc(); if (mode() == MResumePoint::ResumeAfter) bailPC = GetNextPc(pc()); if (!ReconstructStackDepth(GetIonContext()->cx, script, bailPC, &stackDepth, &reachablePC)) { return false; } if (reachablePC) { if (JSOp(*bailPC) == JSOP_FUNCALL) { // For fun.call(this, ...); the reconstructStackDepth will // include the this. When inlining that is not included. So the // exprStackSlots will be one less. MOZ_ASSERT(stackDepth - exprStack <= 1); } else if (JSOp(*bailPC) != JSOP_FUNAPPLY && !IsGetPropPC(bailPC) && !IsSetPropPC(bailPC)) { // For fun.apply({}, arguments) the reconstructStackDepth will // have stackdepth 4, but it could be that we inlined the // funapply. In that case exprStackSlots, will have the real // arguments in the slots and not be 4. // With accessors, we have different stack depths depending on // whether or not we inlined the accessor, as the inlined stack // contains a callee function that should never have been there // and we might just be capturing an uneventful property site, // in which case there won't have been any violence. MOZ_ASSERT(exprStack == stackDepth); } } } #endif // Test if we honor the maximum of arguments at all times. This is a sanity // check and not an algorithm limit. So check might be a bit too loose. +4 // to account for scope chain, return value, this value and maybe // arguments_object. MOZ_ASSERT(CountArgSlots(script, fun) < SNAPSHOT_MAX_NARGS + 4); uint32_t implicit = StartArgSlot(script); uint32_t formalArgs = CountArgSlots(script, fun); uint32_t nallocs = formalArgs + script->nfixed() + exprStack; JitSpew(JitSpew_IonSnapshots, "Starting frame; implicit %u, formals %u, fixed %u, exprs %u", implicit, formalArgs - implicit, script->nfixed(), exprStack); uint32_t pcoff = script->pcToOffset(pc()); JitSpew(JitSpew_IonSnapshots, "Writing pc offset %u, nslots %u", pcoff, nallocs); writer.writeUnsigned(pcoff); writer.writeUnsigned(nallocs); return true; }