Bug 1211100 - Add Vector::infallibleEmplaceBack and use it in JSScript::initScriptCounts() r=nbp

This commit is contained in:
Jon Coppeard 2015-10-06 14:50:49 +01:00
parent 20f13d194b
commit 07915f2ecf
2 changed files with 7 additions and 1 deletions

View File

@ -1334,7 +1334,7 @@ JSScript::initScriptCounts(JSContext* cx)
return false;
for (size_t i = 0; i < jumpTargets.length(); i++)
MOZ_ALWAYS_TRUE(base.emplaceBack(pcToOffset(jumpTargets[i])));
base.infallibleEmplaceBack(pcToOffset(jumpTargets[i]));
// Create compartment's scriptCountsMap if necessary.
ScriptCountsMap* map = compartment()->scriptCountsMap;

View File

@ -603,6 +603,12 @@ public:
{
internalAppend(aBegin, aLength);
}
template<typename... Args>
void infallibleEmplaceBack(Args&&... aArgs)
{
infallibleGrowByUninitialized(1);
new (&back()) T(Forward<Args>(aArgs)...);
}
void popBack();