Bug 1264948 - MBasicBlock::addPredecessor, check for OOMs when allocating Phi nodes. r=h4writer

This commit is contained in:
Nicolas B. Pierron 2016-06-15 16:27:18 +00:00
Родитель 6bf999e76d
Коммит c1242e255e
2 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -7548,6 +7548,9 @@ class MPhi final
static MPhi* New(TempAllocator& alloc, MIRType resultType = MIRType::Value) { static MPhi* New(TempAllocator& alloc, MIRType resultType = MIRType::Value) {
return new(alloc) MPhi(alloc, resultType); return new(alloc) MPhi(alloc, resultType);
} }
static MPhi* New(TempAllocator::Fallible alloc, MIRType resultType = MIRType::Value) {
return new(alloc) MPhi(alloc.alloc, resultType);
}
void removeOperand(size_t index); void removeOperand(size_t index);
void removeAllOperands(); void removeAllOperands();

Просмотреть файл

@ -1193,9 +1193,11 @@ MBasicBlock::addPredecessorPopN(TempAllocator& alloc, MBasicBlock* pred, uint32_
// Otherwise, create a new phi node. // Otherwise, create a new phi node.
MPhi* phi; MPhi* phi;
if (mine->type() == other->type()) if (mine->type() == other->type())
phi = MPhi::New(alloc, mine->type()); phi = MPhi::New(alloc.fallible(), mine->type());
else else
phi = MPhi::New(alloc); phi = MPhi::New(alloc.fallible());
if (!phi)
return false;
addPhi(phi); addPhi(phi);
// Prime the phi for each predecessor, so input(x) comes from // Prime the phi for each predecessor, so input(x) comes from