зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1713567: Rename allowDouble to forceDouble r=jandem
We started out calling this `allowDouble`, then we incrementally rewrote all the uses to force the use of doubles instead. Renaming for clarity. Depends on D116881 Differential Revision: https://phabricator.services.mozilla.com/D116882
This commit is contained in:
Родитель
de51c86e90
Коммит
9afd29f8b3
|
@ -2498,9 +2498,9 @@ AttachDecision GetPropIRGenerator::tryAttachSparseElement(
|
|||
return AttachDecision::Attach;
|
||||
}
|
||||
|
||||
// For Uint32Array we let the stub return a double only if the current result is
|
||||
// a double, to allow better codegen in Warp.
|
||||
static bool AllowDoubleForUint32Array(TypedArrayObject* tarr, uint64_t index) {
|
||||
// For Uint32Array we let the stub return an Int32 if we have not seen a
|
||||
// double, to allow better codegen in Warp while avoiding bailout loops.
|
||||
static bool ForceDoubleForUint32Array(TypedArrayObject* tarr, uint64_t index) {
|
||||
MOZ_ASSERT(index < tarr->length());
|
||||
|
||||
if (tarr->type() != Scalar::Type::Uint32) {
|
||||
|
@ -2534,11 +2534,11 @@ AttachDecision GetPropIRGenerator::tryAttachTypedArrayElement(
|
|||
}
|
||||
|
||||
// If the number is not representable as an integer the result will be
|
||||
// |undefined| so we leave |allowDoubleForUint32| as false.
|
||||
bool allowDoubleForUint32 = false;
|
||||
// |undefined| so we leave |forceDoubleForUint32| as false.
|
||||
bool forceDoubleForUint32 = false;
|
||||
if (!handleOOB) {
|
||||
uint64_t index = uint64_t(indexInt64);
|
||||
allowDoubleForUint32 = AllowDoubleForUint32Array(tarr, index);
|
||||
forceDoubleForUint32 = ForceDoubleForUint32Array(tarr, index);
|
||||
}
|
||||
|
||||
writer.guardShapeForClass(objId, tarr->shape());
|
||||
|
@ -2547,7 +2547,7 @@ AttachDecision GetPropIRGenerator::tryAttachTypedArrayElement(
|
|||
IntPtrOperandId intPtrIndexId = guardToIntPtrIndex(idVal_, keyId, handleOOB);
|
||||
|
||||
writer.loadTypedArrayElementResult(objId, intPtrIndexId, tarr->type(),
|
||||
handleOOB, allowDoubleForUint32);
|
||||
handleOOB, forceDoubleForUint32);
|
||||
writer.returnFromIC();
|
||||
|
||||
trackAttached("TypedElement");
|
||||
|
@ -5327,13 +5327,13 @@ AttachDecision CallIRGenerator::tryAttachDataViewGet(HandleFunction callee,
|
|||
return AttachDecision::NoAction;
|
||||
}
|
||||
|
||||
// For getUint32 we let the stub return a double only if the current result is
|
||||
// a double, to allow better codegen in Warp.
|
||||
bool allowDoubleForUint32 = false;
|
||||
// For getUint32 we let the stub return an Int32 if we have not seen a
|
||||
// double, to allow better codegen in Warp while avoiding bailout loops.
|
||||
bool forceDoubleForUint32 = false;
|
||||
if (type == Scalar::Uint32) {
|
||||
bool isLittleEndian = argc_ > 1 && args_[1].toBoolean();
|
||||
uint32_t res = dv->read<uint32_t>(offsetInt64, isLittleEndian);
|
||||
allowDoubleForUint32 = res >= INT32_MAX;
|
||||
forceDoubleForUint32 = res >= INT32_MAX;
|
||||
}
|
||||
|
||||
// Initialize the input operand.
|
||||
|
@ -5364,7 +5364,7 @@ AttachDecision CallIRGenerator::tryAttachDataViewGet(HandleFunction callee,
|
|||
}
|
||||
|
||||
writer.loadDataViewValueResult(objId, intPtrOffsetId, boolLittleEndianId,
|
||||
type, allowDoubleForUint32);
|
||||
type, forceDoubleForUint32);
|
||||
writer.returnFromIC();
|
||||
|
||||
trackAttached("DataViewGet");
|
||||
|
|
|
@ -2877,7 +2877,7 @@ bool CacheIRCompiler::emitInt32RightShiftResult(Int32OperandId lhsId,
|
|||
|
||||
bool CacheIRCompiler::emitInt32URightShiftResult(Int32OperandId lhsId,
|
||||
Int32OperandId rhsId,
|
||||
bool allowDouble) {
|
||||
bool forceDouble) {
|
||||
JitSpew(JitSpew_Codegen, "%s", __FUNCTION__);
|
||||
AutoOutputRegister output(*this);
|
||||
|
||||
|
@ -2892,7 +2892,7 @@ bool CacheIRCompiler::emitInt32URightShiftResult(Int32OperandId lhsId,
|
|||
|
||||
masm.mov(lhs, scratch);
|
||||
masm.flexibleRshift32(rhs, scratch);
|
||||
if (allowDouble) {
|
||||
if (forceDouble) {
|
||||
ScratchDoubleScope fpscratch(masm);
|
||||
masm.convertUInt32ToDouble(scratch, fpscratch);
|
||||
masm.boxDouble(fpscratch, output.valueReg(), fpscratch);
|
||||
|
@ -5253,7 +5253,7 @@ static void EmitAllocateBigInt(MacroAssembler& masm, Register result,
|
|||
|
||||
bool CacheIRCompiler::emitLoadTypedArrayElementResult(
|
||||
ObjOperandId objId, IntPtrOperandId indexId, Scalar::Type elementType,
|
||||
bool handleOOB, bool allowDoubleForUint32) {
|
||||
bool handleOOB, bool forceDoubleForUint32) {
|
||||
JitSpew(JitSpew_Codegen, "%s", __FUNCTION__);
|
||||
AutoOutputRegister output(*this);
|
||||
Register obj = allocator.useRegister(masm, objId);
|
||||
|
@ -5321,7 +5321,7 @@ bool CacheIRCompiler::emitLoadTypedArrayElementResult(
|
|||
masm.tagValue(JSVAL_TYPE_BIGINT, *bigInt, output.valueReg());
|
||||
} else {
|
||||
MacroAssembler::Uint32Mode uint32Mode =
|
||||
allowDoubleForUint32 ? MacroAssembler::Uint32Mode::ForceDouble
|
||||
forceDoubleForUint32 ? MacroAssembler::Uint32Mode::ForceDouble
|
||||
: MacroAssembler::Uint32Mode::FailOnDouble;
|
||||
masm.loadFromTypedArray(elementType, source, output.valueReg(), uint32Mode,
|
||||
scratch1, failure->label());
|
||||
|
@ -5359,7 +5359,7 @@ static void EmitDataViewBoundsCheck(MacroAssembler& masm, size_t byteSize,
|
|||
bool CacheIRCompiler::emitLoadDataViewValueResult(
|
||||
ObjOperandId objId, IntPtrOperandId offsetId,
|
||||
BooleanOperandId littleEndianId, Scalar::Type elementType,
|
||||
bool allowDoubleForUint32) {
|
||||
bool forceDoubleForUint32) {
|
||||
JitSpew(JitSpew_Codegen, "%s", __FUNCTION__);
|
||||
|
||||
AutoOutputRegister output(*this);
|
||||
|
@ -5458,7 +5458,7 @@ bool CacheIRCompiler::emitLoadDataViewValueResult(
|
|||
break;
|
||||
case Scalar::Uint32: {
|
||||
MacroAssembler::Uint32Mode uint32Mode =
|
||||
allowDoubleForUint32 ? MacroAssembler::Uint32Mode::ForceDouble
|
||||
forceDoubleForUint32 ? MacroAssembler::Uint32Mode::ForceDouble
|
||||
: MacroAssembler::Uint32Mode::FailOnDouble;
|
||||
masm.boxUint32(outputScratch, output.valueReg(), uint32Mode,
|
||||
failure->label());
|
||||
|
|
|
@ -1727,7 +1727,7 @@
|
|||
index: IntPtrId
|
||||
elementType: ScalarTypeImm
|
||||
handleOOB: BoolImm
|
||||
allowDoubleForUint32: BoolImm
|
||||
forceDoubleForUint32: BoolImm
|
||||
|
||||
- name: LoadDataViewValueResult
|
||||
shared: true
|
||||
|
@ -1738,7 +1738,7 @@
|
|||
offset: IntPtrId
|
||||
littleEndian: BooleanId
|
||||
elementType: ScalarTypeImm
|
||||
allowDoubleForUint32: BoolImm
|
||||
forceDoubleForUint32: BoolImm
|
||||
|
||||
- name: StoreDataViewValueResult
|
||||
shared: true
|
||||
|
@ -2259,7 +2259,7 @@
|
|||
args:
|
||||
lhs: Int32Id
|
||||
rhs: Int32Id
|
||||
allowDouble: BoolImm
|
||||
forceDouble: BoolImm
|
||||
|
||||
- name: Int32NotResult
|
||||
shared: true
|
||||
|
|
|
@ -12880,7 +12880,7 @@ void CodeGenerator::visitLoadTypedArrayElementHole(
|
|||
Label fail;
|
||||
BaseIndex source(scratch, index, ScaleFromScalarType(arrayType));
|
||||
MacroAssembler::Uint32Mode uint32Mode =
|
||||
lir->mir()->allowDouble() ? MacroAssembler::Uint32Mode::ForceDouble
|
||||
lir->mir()->forceDouble() ? MacroAssembler::Uint32Mode::ForceDouble
|
||||
: MacroAssembler::Uint32Mode::FailOnDouble;
|
||||
masm.loadFromTypedArray(arrayType, source, out, uint32Mode, out.scratchReg(),
|
||||
&fail);
|
||||
|
|
|
@ -7230,13 +7230,13 @@ class MLoadDataViewElement : public MTernaryInstruction,
|
|||
class MLoadTypedArrayElementHole : public MBinaryInstruction,
|
||||
public SingleObjectPolicy::Data {
|
||||
Scalar::Type arrayType_;
|
||||
bool allowDouble_;
|
||||
bool forceDouble_;
|
||||
|
||||
MLoadTypedArrayElementHole(MDefinition* object, MDefinition* index,
|
||||
Scalar::Type arrayType, bool allowDouble)
|
||||
Scalar::Type arrayType, bool forceDouble)
|
||||
: MBinaryInstruction(classOpcode, object, index),
|
||||
arrayType_(arrayType),
|
||||
allowDouble_(allowDouble) {
|
||||
forceDouble_(forceDouble) {
|
||||
setResultType(MIRType::Value);
|
||||
setMovable();
|
||||
MOZ_ASSERT(index->type() == MIRType::IntPtr);
|
||||
|
@ -7249,9 +7249,9 @@ class MLoadTypedArrayElementHole : public MBinaryInstruction,
|
|||
NAMED_OPERANDS((0, object), (1, index))
|
||||
|
||||
Scalar::Type arrayType() const { return arrayType_; }
|
||||
bool allowDouble() const { return allowDouble_; }
|
||||
bool forceDouble() const { return forceDouble_; }
|
||||
bool fallible() const {
|
||||
return arrayType_ == Scalar::Uint32 && !allowDouble_;
|
||||
return arrayType_ == Scalar::Uint32 && !forceDouble_;
|
||||
}
|
||||
bool congruentTo(const MDefinition* ins) const override {
|
||||
if (!ins->isLoadTypedArrayElementHole()) {
|
||||
|
@ -7262,7 +7262,7 @@ class MLoadTypedArrayElementHole : public MBinaryInstruction,
|
|||
if (arrayType() != other->arrayType()) {
|
||||
return false;
|
||||
}
|
||||
if (allowDouble() != other->allowDouble()) {
|
||||
if (forceDouble() != other->forceDouble()) {
|
||||
return false;
|
||||
}
|
||||
return congruentIfOperandsEqual(other);
|
||||
|
|
|
@ -1812,13 +1812,13 @@ bool WarpCacheIRTranspiler::emitLoadTypedArrayElementExistsResult(
|
|||
|
||||
bool WarpCacheIRTranspiler::emitLoadTypedArrayElementResult(
|
||||
ObjOperandId objId, IntPtrOperandId indexId, Scalar::Type elementType,
|
||||
bool handleOOB, bool allowDoubleForUint32) {
|
||||
bool handleOOB, bool forceDoubleForUint32) {
|
||||
MDefinition* obj = getOperand(objId);
|
||||
MDefinition* index = getOperand(indexId);
|
||||
|
||||
if (handleOOB) {
|
||||
auto* load = MLoadTypedArrayElementHole::New(
|
||||
alloc(), obj, index, elementType, allowDoubleForUint32);
|
||||
alloc(), obj, index, elementType, forceDoubleForUint32);
|
||||
add(load);
|
||||
|
||||
pushResult(load);
|
||||
|
@ -1835,7 +1835,7 @@ bool WarpCacheIRTranspiler::emitLoadTypedArrayElementResult(
|
|||
|
||||
auto* load = MLoadUnboxedScalar::New(alloc(), elements, index, elementType);
|
||||
load->setResultType(
|
||||
MIRTypeForArrayBufferViewRead(elementType, allowDoubleForUint32));
|
||||
MIRTypeForArrayBufferViewRead(elementType, forceDoubleForUint32));
|
||||
add(load);
|
||||
|
||||
pushResult(load);
|
||||
|
@ -2167,7 +2167,7 @@ void WarpCacheIRTranspiler::addDataViewData(MDefinition* obj, Scalar::Type type,
|
|||
bool WarpCacheIRTranspiler::emitLoadDataViewValueResult(
|
||||
ObjOperandId objId, IntPtrOperandId offsetId,
|
||||
BooleanOperandId littleEndianId, Scalar::Type elementType,
|
||||
bool allowDoubleForUint32) {
|
||||
bool forceDoubleForUint32) {
|
||||
MDefinition* obj = getOperand(objId);
|
||||
MDefinition* offset = getOperand(offsetId);
|
||||
MDefinition* littleEndian = getOperand(littleEndianId);
|
||||
|
@ -2187,7 +2187,7 @@ bool WarpCacheIRTranspiler::emitLoadDataViewValueResult(
|
|||
add(load);
|
||||
|
||||
MIRType knownType =
|
||||
MIRTypeForArrayBufferViewRead(elementType, allowDoubleForUint32);
|
||||
MIRTypeForArrayBufferViewRead(elementType, forceDoubleForUint32);
|
||||
load->setResultType(knownType);
|
||||
|
||||
pushResult(load);
|
||||
|
@ -2423,11 +2423,11 @@ bool WarpCacheIRTranspiler::emitInt32RightShiftResult(Int32OperandId lhsId,
|
|||
|
||||
bool WarpCacheIRTranspiler::emitInt32URightShiftResult(Int32OperandId lhsId,
|
||||
Int32OperandId rhsId,
|
||||
bool allowDouble) {
|
||||
bool forceDouble) {
|
||||
MDefinition* lhs = getOperand(lhsId);
|
||||
MDefinition* rhs = getOperand(rhsId);
|
||||
|
||||
MIRType specialization = allowDouble ? MIRType::Double : MIRType::Int32;
|
||||
MIRType specialization = forceDouble ? MIRType::Double : MIRType::Int32;
|
||||
auto* ins = MUrsh::New(alloc(), lhs, rhs, specialization);
|
||||
add(ins);
|
||||
|
||||
|
@ -3660,9 +3660,9 @@ bool WarpCacheIRTranspiler::emitAtomicsCompareExchangeResult(
|
|||
auto* elements = MArrayBufferViewElements::New(alloc(), obj);
|
||||
add(elements);
|
||||
|
||||
bool allowDoubleForUint32 = true;
|
||||
bool forceDoubleForUint32 = true;
|
||||
MIRType knownType =
|
||||
MIRTypeForArrayBufferViewRead(elementType, allowDoubleForUint32);
|
||||
MIRTypeForArrayBufferViewRead(elementType, forceDoubleForUint32);
|
||||
|
||||
auto* cas = MCompareExchangeTypedArrayElement::New(
|
||||
alloc(), elements, index, elementType, expected, replacement);
|
||||
|
@ -3688,9 +3688,9 @@ bool WarpCacheIRTranspiler::emitAtomicsExchangeResult(
|
|||
auto* elements = MArrayBufferViewElements::New(alloc(), obj);
|
||||
add(elements);
|
||||
|
||||
bool allowDoubleForUint32 = true;
|
||||
bool forceDoubleForUint32 = true;
|
||||
MIRType knownType =
|
||||
MIRTypeForArrayBufferViewRead(elementType, allowDoubleForUint32);
|
||||
MIRTypeForArrayBufferViewRead(elementType, forceDoubleForUint32);
|
||||
|
||||
auto* exchange = MAtomicExchangeTypedArrayElement::New(
|
||||
alloc(), elements, index, value, elementType);
|
||||
|
@ -3718,9 +3718,9 @@ bool WarpCacheIRTranspiler::emitAtomicsBinaryOp(ObjOperandId objId,
|
|||
auto* elements = MArrayBufferViewElements::New(alloc(), obj);
|
||||
add(elements);
|
||||
|
||||
bool allowDoubleForUint32 = true;
|
||||
bool forceDoubleForUint32 = true;
|
||||
MIRType knownType =
|
||||
MIRTypeForArrayBufferViewRead(elementType, allowDoubleForUint32);
|
||||
MIRTypeForArrayBufferViewRead(elementType, forceDoubleForUint32);
|
||||
|
||||
auto* binop = MAtomicTypedArrayElementBinop::New(
|
||||
alloc(), op, elements, index, elementType, value, forEffect);
|
||||
|
@ -3796,9 +3796,9 @@ bool WarpCacheIRTranspiler::emitAtomicsLoadResult(ObjOperandId objId,
|
|||
auto* elements = MArrayBufferViewElements::New(alloc(), obj);
|
||||
add(elements);
|
||||
|
||||
bool allowDoubleForUint32 = true;
|
||||
bool forceDoubleForUint32 = true;
|
||||
MIRType knownType =
|
||||
MIRTypeForArrayBufferViewRead(elementType, allowDoubleForUint32);
|
||||
MIRTypeForArrayBufferViewRead(elementType, forceDoubleForUint32);
|
||||
|
||||
auto* load = MLoadUnboxedScalar::New(alloc(), elements, index, elementType,
|
||||
DoesRequireMemoryBarrier);
|
||||
|
|
Загрузка…
Ссылка в новой задаче