summaryrefslogtreecommitdiff
path: root/js/src/vm/SharedArrayObject.cpp
diff options
context:
space:
mode:
authorBrian Smith <brian@dbsoft.org>2023-09-27 09:36:44 -0500
committerBrian Smith <brian@dbsoft.org>2023-09-27 09:36:44 -0500
commitf31471e6898db346ea1529d11756e9788215993d (patch)
treedf1e4f5027db2c5924e22aaca6db39f34a0bb4c1 /js/src/vm/SharedArrayObject.cpp
parentde91800956e6393d436a261cb91ba2dbc470e19a (diff)
downloaduxp-f31471e6898db346ea1529d11756e9788215993d.tar.gz
Issue #1442 - Part 1: Change ArrayBufferCopyData self-hosting intrinsic to take a start offset for the destination.
This will be needed to manage stream chunks. https://bugzilla.mozilla.org/show_bug.cgi?id=1272697
Diffstat (limited to 'js/src/vm/SharedArrayObject.cpp')
-rw-r--r--js/src/vm/SharedArrayObject.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/js/src/vm/SharedArrayObject.cpp b/js/src/vm/SharedArrayObject.cpp
index 8e55001d13..44fe3b790d 100644
--- a/js/src/vm/SharedArrayObject.cpp
+++ b/js/src/vm/SharedArrayObject.cpp
@@ -331,15 +331,16 @@ SharedArrayBufferObject::addSizeOfExcludingThis(JSObject* obj, mozilla::MallocSi
}
/* static */ void
-SharedArrayBufferObject::copyData(Handle<SharedArrayBufferObject*> toBuffer,
- Handle<SharedArrayBufferObject*> fromBuffer,
- uint32_t fromIndex, uint32_t count)
+SharedArrayBufferObject::copyData(Handle<SharedArrayBufferObject*> toBuffer, uint32_t toIndex,
+ Handle<SharedArrayBufferObject*> fromBuffer, uint32_t fromIndex,
+ uint32_t count)
{
MOZ_ASSERT(toBuffer->byteLength() >= count);
+ MOZ_ASSERT(toBuffer->byteLength() >= toIndex + count);
MOZ_ASSERT(fromBuffer->byteLength() >= fromIndex);
MOZ_ASSERT(fromBuffer->byteLength() >= fromIndex + count);
- jit::AtomicOperations::memcpySafeWhenRacy(toBuffer->dataPointerShared(),
+ jit::AtomicOperations::memcpySafeWhenRacy(toBuffer->dataPointerShared() + toIndex,
fromBuffer->dataPointerShared() + fromIndex,
count);
}