Bug 1184388 - Don't try to reallocate inline elements buffer of unboxed arrays, r=jandem.

This commit is contained in:
Brian Hackett 2015-08-25 08:41:50 -06:00
parent 6073d46e10
commit 9c51bf3b2f

View File

@ -1040,9 +1040,14 @@ UnboxedArrayObject::convertInt32ToDouble(ExclusiveContext* cx, ObjectGroup* grou
for (size_t i = 0; i < initializedLength(); i++)
values.infallibleAppend(getElementSpecific<JSVAL_TYPE_INT32>(i).toInt32());
uint8_t* newElements = ReallocateObjectBuffer<uint8_t>(cx, this, elements(),
uint8_t* newElements;
if (hasInlineElements()) {
newElements = AllocateObjectBuffer<uint8_t>(cx, this, capacity() * sizeof(double));
} else {
newElements = ReallocateObjectBuffer<uint8_t>(cx, this, elements(),
capacity() * sizeof(int32_t),
capacity() * sizeof(double));
}
if (!newElements)
return false;