Bug 1687441 part 21 - Change Atomics VM functions to take index as size_t instead of int32_t. r=anba

Differential Revision: https://phabricator.services.mozilla.com/D102738
This commit is contained in:
Jan de Mooij 2021-01-27 10:47:00 +00:00
Родитель 906ee87946
Коммит b843bb5900
3 изменённых файлов: 18 добавлений и 25 удалений

Просмотреть файл

@ -806,7 +806,7 @@ class MOZ_RAII CacheIRCompiler {
bool emitDoubleIncDecResult(bool isInc, NumberOperandId inputId);
using AtomicsReadWriteModifyFn = int32_t (*)(TypedArrayObject*, int32_t,
using AtomicsReadWriteModifyFn = int32_t (*)(TypedArrayObject*, size_t,
int32_t);
[[nodiscard]] bool emitAtomicsReadModifyWriteResult(

Просмотреть файл

@ -2446,13 +2446,12 @@ BigInt* BigIntAsUintN(JSContext* cx, HandleBigInt x, int32_t bits) {
template <typename T>
static int32_t AtomicsCompareExchange(TypedArrayObject* typedArray,
int32_t index, int32_t expected,
size_t index, int32_t expected,
int32_t replacement) {
AutoUnsafeCallWithABI unsafe;
MOZ_ASSERT(!typedArray->hasDetachedBuffer());
MOZ_ASSERT(index >= 0 &&
uint32_t(index) < typedArray->length().deprecatedGetUint32());
MOZ_ASSERT(index < typedArray->length().get());
SharedMem<T*> addr = typedArray->dataPointerEither().cast<T*>();
return jit::AtomicOperations::compareExchangeSeqCst(addr + index, T(expected),
@ -2479,13 +2478,12 @@ AtomicsCompareExchangeFn AtomicsCompareExchange(Scalar::Type elementType) {
}
template <typename T>
static int32_t AtomicsExchange(TypedArrayObject* typedArray, int32_t index,
static int32_t AtomicsExchange(TypedArrayObject* typedArray, size_t index,
int32_t value) {
AutoUnsafeCallWithABI unsafe;
MOZ_ASSERT(!typedArray->hasDetachedBuffer());
MOZ_ASSERT(index >= 0 &&
uint32_t(index) < typedArray->length().deprecatedGetUint32());
MOZ_ASSERT(index < typedArray->length().get());
SharedMem<T*> addr = typedArray->dataPointerEither().cast<T*>();
return jit::AtomicOperations::exchangeSeqCst(addr + index, T(value));
@ -2511,13 +2509,12 @@ AtomicsReadWriteModifyFn AtomicsExchange(Scalar::Type elementType) {
}
template <typename T>
static int32_t AtomicsAdd(TypedArrayObject* typedArray, int32_t index,
static int32_t AtomicsAdd(TypedArrayObject* typedArray, size_t index,
int32_t value) {
AutoUnsafeCallWithABI unsafe;
MOZ_ASSERT(!typedArray->hasDetachedBuffer());
MOZ_ASSERT(index >= 0 &&
uint32_t(index) < typedArray->length().deprecatedGetUint32());
MOZ_ASSERT(index < typedArray->length().get());
SharedMem<T*> addr = typedArray->dataPointerEither().cast<T*>();
return jit::AtomicOperations::fetchAddSeqCst(addr + index, T(value));
@ -2543,13 +2540,12 @@ AtomicsReadWriteModifyFn AtomicsAdd(Scalar::Type elementType) {
}
template <typename T>
static int32_t AtomicsSub(TypedArrayObject* typedArray, int32_t index,
static int32_t AtomicsSub(TypedArrayObject* typedArray, size_t index,
int32_t value) {
AutoUnsafeCallWithABI unsafe;
MOZ_ASSERT(!typedArray->hasDetachedBuffer());
MOZ_ASSERT(index >= 0 &&
uint32_t(index) < typedArray->length().deprecatedGetUint32());
MOZ_ASSERT(index < typedArray->length().get());
SharedMem<T*> addr = typedArray->dataPointerEither().cast<T*>();
return jit::AtomicOperations::fetchSubSeqCst(addr + index, T(value));
@ -2575,13 +2571,12 @@ AtomicsReadWriteModifyFn AtomicsSub(Scalar::Type elementType) {
}
template <typename T>
static int32_t AtomicsAnd(TypedArrayObject* typedArray, int32_t index,
static int32_t AtomicsAnd(TypedArrayObject* typedArray, size_t index,
int32_t value) {
AutoUnsafeCallWithABI unsafe;
MOZ_ASSERT(!typedArray->hasDetachedBuffer());
MOZ_ASSERT(index >= 0 &&
uint32_t(index) < typedArray->length().deprecatedGetUint32());
MOZ_ASSERT(index < typedArray->length().get());
SharedMem<T*> addr = typedArray->dataPointerEither().cast<T*>();
return jit::AtomicOperations::fetchAndSeqCst(addr + index, T(value));
@ -2607,13 +2602,12 @@ AtomicsReadWriteModifyFn AtomicsAnd(Scalar::Type elementType) {
}
template <typename T>
static int32_t AtomicsOr(TypedArrayObject* typedArray, int32_t index,
static int32_t AtomicsOr(TypedArrayObject* typedArray, size_t index,
int32_t value) {
AutoUnsafeCallWithABI unsafe;
MOZ_ASSERT(!typedArray->hasDetachedBuffer());
MOZ_ASSERT(index >= 0 &&
uint32_t(index) < typedArray->length().deprecatedGetUint32());
MOZ_ASSERT(index < typedArray->length().get());
SharedMem<T*> addr = typedArray->dataPointerEither().cast<T*>();
return jit::AtomicOperations::fetchOrSeqCst(addr + index, T(value));
@ -2639,13 +2633,12 @@ AtomicsReadWriteModifyFn AtomicsOr(Scalar::Type elementType) {
}
template <typename T>
static int32_t AtomicsXor(TypedArrayObject* typedArray, int32_t index,
static int32_t AtomicsXor(TypedArrayObject* typedArray, size_t index,
int32_t value) {
AutoUnsafeCallWithABI unsafe;
MOZ_ASSERT(!typedArray->hasDetachedBuffer());
MOZ_ASSERT(index >= 0 &&
uint32_t(index) < typedArray->length().deprecatedGetUint32());
MOZ_ASSERT(index < typedArray->length().get());
SharedMem<T*> addr = typedArray->dataPointerEither().cast<T*>();
return jit::AtomicOperations::fetchXorSeqCst(addr + index, T(value));

Просмотреть файл

@ -627,10 +627,10 @@ bool StringBigIntCompare(JSContext* cx, HandleString x, HandleBigInt y,
BigInt* BigIntAsIntN(JSContext* cx, HandleBigInt x, int32_t bits);
BigInt* BigIntAsUintN(JSContext* cx, HandleBigInt x, int32_t bits);
using AtomicsCompareExchangeFn = int32_t (*)(TypedArrayObject*, int32_t,
int32_t, int32_t);
using AtomicsCompareExchangeFn = int32_t (*)(TypedArrayObject*, size_t, int32_t,
int32_t);
using AtomicsReadWriteModifyFn = int32_t (*)(TypedArrayObject*, int32_t,
using AtomicsReadWriteModifyFn = int32_t (*)(TypedArrayObject*, size_t,
int32_t);
AtomicsCompareExchangeFn AtomicsCompareExchange(Scalar::Type elementType);