bool MBasicBlock::linkOsrValues(MStart* start) { MResumePoint* res = start->resumePoint(); for (uint32_t i = 0; i < stackDepth(); i++) { MDefinition* def = slots_[i]; MInstruction* cloneRp = nullptr; if (i == info().environmentChainSlot()) { if (def->isOsrEnvironmentChain()) cloneRp = def->toOsrEnvironmentChain(); } else if (i == info().returnValueSlot()) { if (def->isOsrReturnValue()) cloneRp = def->toOsrReturnValue(); } else if (info().hasArguments() && i == info().argsObjSlot()) { MOZ_ASSERT(def->isConstant() || def->isOsrArgumentsObject()); MOZ_ASSERT_IF(def->isConstant(), def->toConstant()->type() == MIRType::Undefined); if (def->isOsrArgumentsObject()) cloneRp = def->toOsrArgumentsObject(); } else { MOZ_ASSERT(def->isOsrValue() || def->isGetArgumentsObjectArg() || def->isConstant() || def->isParameter()); // A constant Undefined can show up here for an argument slot when // the function has an arguments object, but the argument in // question is stored on the scope chain. MOZ_ASSERT_IF(def->isConstant(), def->toConstant()->type() == MIRType::Undefined); if (def->isOsrValue()) cloneRp = def->toOsrValue(); else if (def->isGetArgumentsObjectArg()) cloneRp = def->toGetArgumentsObjectArg(); else if (def->isParameter()) cloneRp = def->toParameter(); } if (cloneRp) { MResumePoint* clone = MResumePoint::Copy(graph().alloc(), res); if (!clone) return false; cloneRp->setResumePoint(clone); } } return true; }