mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-11-01 12:07:34 +09:00
Convert CopyBoxedOrUnboxedDenseElements to something that doesn't crash.
This commit is contained in:
parent
a7d7332c7b
commit
ec0e78d127
3 changed files with 33 additions and 23 deletions
|
|
@ -226,24 +226,6 @@ MoveBoxedOrUnboxedDenseElements(JSContext* cx, JSObject* obj, uint32_t dstStart,
|
|||
return DenseElementResult::Success;
|
||||
}
|
||||
|
||||
static inline DenseElementResult
|
||||
CopyBoxedOrUnboxedDenseElements(JSContext* cx, JSObject* dst, JSObject* src,
|
||||
uint32_t dstStart, uint32_t srcStart, uint32_t length)
|
||||
{
|
||||
MOZ_ASSERT(src->isNative());
|
||||
MOZ_ASSERT(dst->isNative());
|
||||
MOZ_ASSERT(dst->as<NativeObject>().getDenseInitializedLength() == dstStart);
|
||||
MOZ_ASSERT(src->as<NativeObject>().getDenseInitializedLength() >= srcStart + length);
|
||||
MOZ_ASSERT(dst->as<NativeObject>().getDenseCapacity() >= dstStart + length);
|
||||
|
||||
dst->as<NativeObject>().setDenseInitializedLength(dstStart + length);
|
||||
|
||||
const Value* vp = src->as<NativeObject>().getDenseElements() + srcStart;
|
||||
dst->as<NativeObject>().initDenseElements(dstStart, vp, length);
|
||||
|
||||
return DenseElementResult::Success;
|
||||
}
|
||||
|
||||
} // namespace js
|
||||
|
||||
#endif // vm_UnboxedObject_inl_h
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue