Bug 1210596 - Mark array groups as not packed when initializing individual elements with holes, r=jandem.

This commit is contained in:
Brian Hackett 2015-10-05 10:18:05 -06:00
parent 7152b64191
commit 71956a7643
2 changed files with 8 additions and 1 deletions

View File

@ -0,0 +1,4 @@
var count = 0;
var a = Array.prototype.concat.call([], [, []], []);
a.forEach(function() { count++; });
assertEq(count, 1);

View File

@ -79,7 +79,10 @@ inline void
NativeObject::initDenseElementWithType(ExclusiveContext* cx, uint32_t index, const Value& val)
{
MOZ_ASSERT(!shouldConvertDoubleElements());
AddTypePropertyId(cx, this, JSID_VOID, val);
if (val.isMagic(JS_ELEMENTS_HOLE))
markDenseElementsNotPacked(cx);
else
AddTypePropertyId(cx, this, JSID_VOID, val);
initDenseElement(index, val);
}