Issue #2026 - Part 4 - Fill in missing dense elements case and fix a comment. https://bugzilla.mozilla.org/show_bug.cgi?id=1456569 Skipped this during the initial implementation, not sure when or if this code path is used, but I figure it should be there just in case. Also fix debug builgs by removing an no longer valid MOZ_ASSERT.

This commit is contained in:
Brian Smith 2023-07-28 19:54:06 -05:00 committed by roytam1
commit b7e487bdf1
2 changed files with 9 additions and 1 deletions

View file

@ -725,7 +725,6 @@ class MemoryAccessDesc
trapOffset_(trapOffset)
{
MOZ_ASSERT(Scalar::isSimdType(type) == (numSimdElems > 0));
MOZ_ASSERT(numSimdElems <= jit::ScalarTypeToLength(type));
MOZ_ASSERT(mozilla::IsPowerOfTwo(align));
MOZ_ASSERT_IF(isSimd(), hasTrap());
MOZ_ASSERT_IF(isAtomic(), hasTrap());

View file

@ -2392,6 +2392,15 @@ SetExistingProperty(JSContext* cx, HandleNativeObject obj, HandleId id, HandleVa
Rooted<TypedArrayObject*> tobj(cx, &pobj->as<TypedArrayObject>());
return SetTypedArrayElement(cx, tobj, index, v, result);
}
if (WouldDefinePastNonwritableLength(pobj, index))
return result.fail(JSMSG_CANT_DEFINE_PAST_ARRAY_LENGTH);
if (!pobj->maybeCopyElementsForWrite(cx))
return false;
pobj->setDenseElementWithType(cx, index, v);
return result.succeed();
}
// Steps 5.b-f.