mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-18 02:13:08 +09:00
Issue #1382 - Remove invalid assertion.
There is flexibility in exactly the value the initialized length must hold, i.e. if an array is completely empty, it is valid for the initialized length to be any value between zero and the length of the array, as long as the in-memory values below the initialized length have been initialized with a hole value. In the case of 0, the array is packed and the move operation would be a nop, so simply convert the assert to a condition to save some cycles.
This commit is contained in:
parent
012bac1934
commit
af47c6fb4d
1 changed files with 9 additions and 8 deletions
|
|
@ -2105,14 +2105,15 @@ js::ArrayShiftMoveElements(NativeObject* obj)
|
|||
MOZ_ASSERT_IF(obj->is<ArrayObject>(), obj->as<ArrayObject>().lengthIsWritable());
|
||||
|
||||
size_t initlen = obj->getDenseInitializedLength();
|
||||
MOZ_ASSERT(initlen > 0);
|
||||
|
||||
/*
|
||||
* At this point the length and initialized length have already been
|
||||
* decremented and the result fetched, so just shift the array elements
|
||||
* themselves.
|
||||
*/
|
||||
obj->moveDenseElementsNoPreBarrier(0, 1, initlen);
|
||||
|
||||
if (initlen > 0) {
|
||||
/*
|
||||
* At this point the length and initialized length have already been
|
||||
* decremented and the result fetched, so just shift the array elements
|
||||
* themselves.
|
||||
*/
|
||||
obj->moveDenseElementsNoPreBarrier(0, 1, initlen);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue