|
|
@@ -1837,8 +1837,8 @@ GlobOpt::MergeCapturedValues(
|
|
|
SListBase<CapturedList> * fromList,
|
|
|
CapturedItemsAreEqual itemsAreEqual)
|
|
|
{
|
|
|
- SListBase<CapturedList>::Iterator iterTo(toList);
|
|
|
- SListBase<CapturedList>::Iterator iterFrom(fromList);
|
|
|
+ typename SListBase<CapturedList>::Iterator iterTo(toList);
|
|
|
+ typename SListBase<CapturedList>::Iterator iterFrom(fromList);
|
|
|
bool hasTo = iterTo.Next();
|
|
|
bool hasFrom = fromList == nullptr ? false : iterFrom.Next();
|
|
|
|
|
|
@@ -1849,7 +1849,7 @@ GlobOpt::MergeCapturedValues(
|
|
|
Sym * symFrom = iterFrom.Data().Key();
|
|
|
Sym * symTo = iterTo.Data().Key();
|
|
|
|
|
|
- if (symFrom->m_id < symTo->m_id)
|
|
|
+ if (symFrom->m_id < symTo->m_id)
|
|
|
{
|
|
|
toData->changedSyms->Set(symFrom->m_id);
|
|
|
hasFrom = iterFrom.Next();
|
|
|
@@ -1873,7 +1873,7 @@ GlobOpt::MergeCapturedValues(
|
|
|
bool hasRemain = hasFrom || hasTo;
|
|
|
if (hasRemain)
|
|
|
{
|
|
|
- SListBase<CapturedList>::Iterator iterRemain(hasFrom ? iterFrom : iterTo);
|
|
|
+ typename SListBase<CapturedList>::Iterator iterRemain(hasFrom ? iterFrom : iterTo);
|
|
|
do
|
|
|
{
|
|
|
Sym * symRemain = iterRemain.Data().Key();
|
|
|
@@ -2173,7 +2173,7 @@ GlobOpt::MergeBlockData(
|
|
|
if(value)
|
|
|
{
|
|
|
ValueInfo *const valueInfo = value->GetValueInfo();
|
|
|
- if(valueInfo->IsInt() || valueInfo->IsLikelyInt() && DoAggressiveIntTypeSpec())
|
|
|
+ if(valueInfo->IsInt() || (valueInfo->IsLikelyInt() && DoAggressiveIntTypeSpec()))
|
|
|
{
|
|
|
toData->liveVarSyms->Set(id);
|
|
|
}
|
|
|
@@ -4049,8 +4049,8 @@ GlobOpt::OptArguments(IR::Instr *instr)
|
|
|
if (!TrackArgumentsObject())
|
|
|
{
|
|
|
return;
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
if (instr->HasAnyLoadHeapArgsOpCode())
|
|
|
{
|
|
|
if (instr->m_func->IsStackArgsEnabled())
|
|
|
@@ -4381,7 +4381,7 @@ GlobOpt::IsAllowedForMemOpt(IR::Instr* instr, bool isMemset, IR::RegOpnd *baseOp
|
|
|
);
|
|
|
if (!hasBoundChecksRemoved)
|
|
|
{
|
|
|
- TRACE_MEMOP_VERBOSE(loop, instr, L"Missing bounds check optimization");
|
|
|
+ TRACE_MEMOP_VERBOSE(loop, instr, _u("Missing bounds check optimization"));
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
@@ -4925,7 +4925,7 @@ GlobOpt::OptInstr(IR::Instr *&instr, bool* isInstrRemoved)
|
|
|
this->OptArguments(instr);
|
|
|
|
|
|
//StackArguments Optimization - We bail out if the index is out of range of actuals.
|
|
|
- if ((instr->m_opcode == Js::OpCode::LdElemI_A || instr->m_opcode == Js::OpCode::TypeofElem) &&
|
|
|
+ if ((instr->m_opcode == Js::OpCode::LdElemI_A || instr->m_opcode == Js::OpCode::TypeofElem) &&
|
|
|
instr->DoStackArgsOpt(this->func) && !this->IsLoopPrePass())
|
|
|
{
|
|
|
GenerateBailAtOperation(&instr, IR::BailOnStackArgsOutOfActualsRange);
|
|
|
@@ -5517,8 +5517,8 @@ GlobOpt::OptDst(
|
|
|
if(!prevDst ||
|
|
|
!src->IsEqualInternal(prevDst) ||
|
|
|
!(
|
|
|
- prevInstr->GetSrc1() && dst->IsEqual(prevInstr->GetSrc1()) ||
|
|
|
- prevInstr->GetSrc2() && dst->IsEqual(prevInstr->GetSrc2())
|
|
|
+ (prevInstr->GetSrc1() && dst->IsEqual(prevInstr->GetSrc1())) ||
|
|
|
+ (prevInstr->GetSrc2() && dst->IsEqual(prevInstr->GetSrc2()))
|
|
|
))
|
|
|
{
|
|
|
break;
|
|
|
@@ -5983,7 +5983,7 @@ GlobOpt::OptSrc(IR::Opnd *opnd, IR::Instr * *pInstr, Value **indirIndexValRef, I
|
|
|
}
|
|
|
if(profiledArrayType.IsLikelyObject() &&
|
|
|
profiledArrayType.GetObjectType() == valueType.GetObjectType() &&
|
|
|
- (profiledArrayType.HasVarElements() || valueType.HasIntElements() && profiledArrayType.HasFloatElements()))
|
|
|
+ (profiledArrayType.HasVarElements() || (valueType.HasIntElements() && profiledArrayType.HasFloatElements())))
|
|
|
{
|
|
|
// Merge array type we pulled from profile with type propagated by dataflow.
|
|
|
valueType = valueType.Merge(profiledArrayType).SetHasNoMissingValues(valueType.HasNoMissingValues());
|
|
|
@@ -6344,9 +6344,9 @@ GlobOpt::CopyProp(IR::Opnd *opnd, IR::Instr *instr, Value *val, IR::IndirOpnd *p
|
|
|
|
|
|
// Don't copy-prop operand of SIMD instr with ExtendedArg operands. Each instr should have its exclusive EA sequence.
|
|
|
if (
|
|
|
- Js::IsSimd128Opcode(instr->m_opcode) &&
|
|
|
- instr->GetSrc1() != nullptr &&
|
|
|
- instr->GetSrc1()->IsRegOpnd() &&
|
|
|
+ Js::IsSimd128Opcode(instr->m_opcode) &&
|
|
|
+ instr->GetSrc1() != nullptr &&
|
|
|
+ instr->GetSrc1()->IsRegOpnd() &&
|
|
|
instr->GetSrc2() == nullptr
|
|
|
)
|
|
|
{
|
|
|
@@ -6634,7 +6634,7 @@ GlobOpt::CopyPropReplaceOpnd(IR::Instr * instr, IR::Opnd * opnd, StackSym * copy
|
|
|
if (this->currentBlock->loop && !this->IsLoopPrePass())
|
|
|
{
|
|
|
// Try hoisting this checkObjType.
|
|
|
- // But since this isn't the current instr being optimized, we need to play tricks with
|
|
|
+ // But since this isn't the current instr being optimized, we need to play tricks with
|
|
|
// the byteCodeUse fields...
|
|
|
BVSparse<JitArenaAllocator> *currentBytecodeUses = this->byteCodeUses;
|
|
|
PropertySym * currentPropertySymUse = this->propertySymUse;
|
|
|
@@ -6871,7 +6871,7 @@ GlobOpt::NewIntConstantValue(const int32 intConst, IR::Instr * instr, bool isTag
|
|
|
// This gets in the way of CSE.
|
|
|
value = HoistConstantLoadAndPropagateValueBackward(Js::TaggedInt::ToVarUnchecked(intConst), instr, value);
|
|
|
if (!value->GetValueInfo()->GetSymStore() &&
|
|
|
- instr->m_opcode == Js::OpCode::LdC_A_I4 || instr->m_opcode == Js::OpCode::Ld_I4)
|
|
|
+ (instr->m_opcode == Js::OpCode::LdC_A_I4 || instr->m_opcode == Js::OpCode::Ld_I4))
|
|
|
{
|
|
|
StackSym * sym = instr->GetDst()->GetStackSym();
|
|
|
Assert(sym);
|
|
|
@@ -7442,8 +7442,8 @@ GlobOpt::ValueNumberDst(IR::Instr **pInstr, Value *src1Val, Value *src2Val)
|
|
|
if(!(
|
|
|
profiledValueType.IsLikelyInt() &&
|
|
|
(
|
|
|
- dst->IsRegOpnd() && dst->AsRegOpnd()->m_sym->m_isNotInt ||
|
|
|
- instr->GetSrc1()->IsRegOpnd() && instr->GetSrc1()->AsRegOpnd()->m_sym->m_isNotInt
|
|
|
+ (dst->IsRegOpnd() && dst->AsRegOpnd()->m_sym->m_isNotInt) ||
|
|
|
+ (instr->GetSrc1()->IsRegOpnd() && instr->GetSrc1()->AsRegOpnd()->m_sym->m_isNotInt)
|
|
|
)
|
|
|
))
|
|
|
{
|
|
|
@@ -7669,8 +7669,8 @@ GlobOpt::ValueNumberDst(IR::Instr **pInstr, Value *src1Val, Value *src2Val)
|
|
|
min1 < 0 &&
|
|
|
IntConstantBounds(min2, max2).And_0x1f().Contains(0))
|
|
|
{
|
|
|
- // Src1 may be too large to represent as a signed int32, and src2 may be zero.
|
|
|
- // Since the result can therefore be too large to represent as a signed int32,
|
|
|
+ // Src1 may be too large to represent as a signed int32, and src2 may be zero.
|
|
|
+ // Since the result can therefore be too large to represent as a signed int32,
|
|
|
// include Number in the value type.
|
|
|
return CreateDstUntransferredValue(
|
|
|
ValueType::AnyNumber.SetCanBeTaggedValue(true), instr, src1Val, src2Val);
|
|
|
@@ -7991,7 +7991,7 @@ GlobOpt::ValueNumberLdElemDst(IR::Instr **pInstr, Value *srcVal)
|
|
|
if (instr->DoStackArgsOpt(this->func) ||
|
|
|
!(
|
|
|
baseValueType.IsLikelyOptimizedTypedArray() ||
|
|
|
- baseValueType.IsLikelyNativeArray() && instr->IsProfiledInstr() // Specialized native array lowering for LdElem requires that it is profiled.
|
|
|
+ (baseValueType.IsLikelyNativeArray() && instr->IsProfiledInstr()) // Specialized native array lowering for LdElem requires that it is profiled.
|
|
|
) ||
|
|
|
(!this->DoTypedArrayTypeSpec() && baseValueType.IsLikelyOptimizedTypedArray()) ||
|
|
|
|
|
|
@@ -8211,8 +8211,8 @@ GlobOpt::GetPrepassValueTypeForDst(
|
|
|
return desiredValueType;
|
|
|
}
|
|
|
|
|
|
- if(instr->GetSrc1() && !IsPrepassSrcValueInfoPrecise(instr->GetSrc1(), src1Value) ||
|
|
|
- instr->GetSrc2() && !IsPrepassSrcValueInfoPrecise(instr->GetSrc2(), src2Value))
|
|
|
+ if((instr->GetSrc1() && !IsPrepassSrcValueInfoPrecise(instr->GetSrc1(), src1Value)) ||
|
|
|
+ (instr->GetSrc2() && !IsPrepassSrcValueInfoPrecise(instr->GetSrc2(), src2Value)))
|
|
|
{
|
|
|
// If the desired value type is not precise, the value type of the destination is derived from the value types of the
|
|
|
// sources. Since the value type of a source sym is not definite, the destination value type also cannot be definite.
|
|
|
@@ -8453,7 +8453,7 @@ GlobOpt::ValueNumberTransferDstInPrepass(IR::Instr *const instr, Value *const sr
|
|
|
// In prepass we are going to copy the value but with a different value number
|
|
|
// for aggressive int type spec.
|
|
|
const ValueType valueType(GetPrepassValueTypeForDst(src1ValueInfo->Type(), instr, src1Val, nullptr, &isValueInfoPrecise));
|
|
|
- if(isValueInfoPrecise || valueType == src1ValueInfo->Type() && src1ValueInfo->IsGeneric())
|
|
|
+ if(isValueInfoPrecise || (valueType == src1ValueInfo->Type() && src1ValueInfo->IsGeneric()))
|
|
|
{
|
|
|
Assert(valueType == src1ValueInfo->Type());
|
|
|
dstVal = CopyValue(src1Val);
|
|
|
@@ -9660,7 +9660,7 @@ GlobOpt::IsWorthSpecializingToInt32DueToSrc(IR::Opnd *const src, Value *const va
|
|
|
!src->GetIsDead() ||
|
|
|
!src->IsRegOpnd() ||
|
|
|
this->IsInt32TypeSpecialized(src->AsRegOpnd()->m_sym, this->currentBlock) ||
|
|
|
- this->currentBlock->loop && this->IsLive(src->AsRegOpnd()->m_sym, this->currentBlock->loop->landingPad);
|
|
|
+ (this->currentBlock->loop && this->IsLive(src->AsRegOpnd()->m_sym, this->currentBlock->loop->landingPad));
|
|
|
}
|
|
|
|
|
|
bool
|
|
|
@@ -9671,7 +9671,7 @@ GlobOpt::IsWorthSpecializingToInt32DueToDst(IR::Opnd *const dst)
|
|
|
const auto sym = dst->AsRegOpnd()->m_sym;
|
|
|
return
|
|
|
this->IsInt32TypeSpecialized(sym, this->currentBlock) ||
|
|
|
- this->currentBlock->loop && this->IsLive(sym, this->currentBlock->loop->landingPad);
|
|
|
+ (this->currentBlock->loop && this->IsLive(sym, this->currentBlock->loop->landingPad));
|
|
|
}
|
|
|
|
|
|
bool
|
|
|
@@ -9685,7 +9685,7 @@ GlobOpt::IsWorthSpecializingToInt32(IR::Instr *const instr, Value *const src1Val
|
|
|
// In addition to checking each operand and the destination, if for any reason we only have to do a maximum of two
|
|
|
// conversions instead of the worst-case 3 conversions, it's probably worth specializing.
|
|
|
if (IsWorthSpecializingToInt32DueToSrc(src1, src1Val) ||
|
|
|
- src2Val && IsWorthSpecializingToInt32DueToSrc(src2, src2Val))
|
|
|
+ (src2Val && IsWorthSpecializingToInt32DueToSrc(src2, src2Val)))
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
@@ -9696,7 +9696,7 @@ GlobOpt::IsWorthSpecializingToInt32(IR::Instr *const instr, Value *const src1Val
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- if (dst->IsEqual(src1) || src2Val && (dst->IsEqual(src2) || src1->IsEqual(src2)))
|
|
|
+ if (dst->IsEqual(src1) || (src2Val && (dst->IsEqual(src2) || src1->IsEqual(src2))))
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
@@ -11370,19 +11370,19 @@ GlobOpt::TypeSpecializeBinary(IR::Instr **pInstr, Value **pSrc1Val, Value **pSrc
|
|
|
default:
|
|
|
{
|
|
|
const bool involesLargeInt32 =
|
|
|
- src1Val && src1Val->GetValueInfo()->IsLikelyUntaggedInt() ||
|
|
|
- src2Val && src2Val->GetValueInfo()->IsLikelyUntaggedInt();
|
|
|
+ (src1Val && src1Val->GetValueInfo()->IsLikelyUntaggedInt()) ||
|
|
|
+ (src2Val && src2Val->GetValueInfo()->IsLikelyUntaggedInt());
|
|
|
const auto trySpecializeToFloat =
|
|
|
[&](const bool mayOverflow) -> bool
|
|
|
{
|
|
|
// It has been determined that this instruction cannot be int-specialized. Need to determine whether to attempt
|
|
|
// to float-specialize the instruction, or leave it unspecialized.
|
|
|
- if(involesLargeInt32
|
|
|
+ if((involesLargeInt32
|
|
|
#if INT32VAR
|
|
|
&& mayOverflow
|
|
|
#endif
|
|
|
- || (instr->m_opcode == Js::OpCode::Mul_A && !this->DoAggressiveMulIntTypeSpec())
|
|
|
- )
|
|
|
+ ) || (instr->m_opcode == Js::OpCode::Mul_A && !this->DoAggressiveMulIntTypeSpec())
|
|
|
+ )
|
|
|
{
|
|
|
// An input range is completely outside the range of an int31 and the operation is likely to overflow.
|
|
|
// Additionally, on 32-bit platforms, the value is untaggable and will be a JavascriptNumber, which is
|
|
|
@@ -11416,8 +11416,8 @@ GlobOpt::TypeSpecializeBinary(IR::Instr **pInstr, Value **pSrc1Val, Value **pSrc
|
|
|
!src2Val->GetValueInfo()->IsInt()
|
|
|
)
|
|
|
) ||
|
|
|
- instr->GetSrc1()->IsRegOpnd() && instr->GetSrc1()->AsRegOpnd()->m_sym->m_isNotInt ||
|
|
|
- instr->GetSrc2()->IsRegOpnd() && instr->GetSrc2()->AsRegOpnd()->m_sym->m_isNotInt)
|
|
|
+ (instr->GetSrc1()->IsRegOpnd() && instr->GetSrc1()->AsRegOpnd()->m_sym->m_isNotInt) ||
|
|
|
+ (instr->GetSrc2()->IsRegOpnd() && instr->GetSrc2()->AsRegOpnd()->m_sym->m_isNotInt))
|
|
|
{
|
|
|
return trySpecializeToFloat(true);
|
|
|
}
|
|
|
@@ -11425,8 +11425,8 @@ GlobOpt::TypeSpecializeBinary(IR::Instr **pInstr, Value **pSrc1Val, Value **pSrc
|
|
|
|
|
|
// Try to type specialize to int32
|
|
|
|
|
|
- // If one of the values is a float constant with a value that fits in a uint32 but not an int32,
|
|
|
- // and the instruction can ignore int overflow, the source value for the purposes of int specialization
|
|
|
+ // If one of the values is a float constant with a value that fits in a uint32 but not an int32,
|
|
|
+ // and the instruction can ignore int overflow, the source value for the purposes of int specialization
|
|
|
// would have been changed to an int constant value by ignoring overflow. But, the conversion is still lossy.
|
|
|
if (!(src1OriginalVal && src1OriginalVal->GetValueInfo()->IsFloatConstant() && src1Val && src1Val->GetValueInfo()->HasIntConstantValue()))
|
|
|
{
|
|
|
@@ -11817,7 +11817,7 @@ GlobOpt::TypeSpecializeBinary(IR::Instr **pInstr, Value **pSrc1Val, Value **pSrc
|
|
|
// May result in -0
|
|
|
return trySpecializeToFloat(false);
|
|
|
}
|
|
|
- if ((min1 == 0 && max1 == 0 || min2 == 0 && max2 == 0) && (max1 < 0 || max2 < 0))
|
|
|
+ if (((min1 == 0 && max1 == 0) || (min2 == 0 && max2 == 0)) && (max1 < 0 || max2 < 0))
|
|
|
{
|
|
|
// Always results in -0
|
|
|
return trySpecializeToFloat(false);
|
|
|
@@ -14178,7 +14178,7 @@ GlobOpt::ToTypeSpecUse(IR::Instr *instr, IR::Opnd *opnd, BasicBlock *block, Valu
|
|
|
|
|
|
if (opcode == Js::OpCode::FromVar)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
if (toType == TyInt32)
|
|
|
{
|
|
|
Assert(valueInfo);
|
|
|
@@ -14595,7 +14595,7 @@ GlobOpt::ToTypeSpecUse(IR::Instr *instr, IR::Opnd *opnd, BasicBlock *block, Valu
|
|
|
// Src is always invariant, but check if the dst is, and then hoist.
|
|
|
if (block->loop &&
|
|
|
(
|
|
|
- newFloatSym && block->loop->CanHoistInvariants() ||
|
|
|
+ (newFloatSym && block->loop->CanHoistInvariants()) ||
|
|
|
this->OptIsInvariant(floatReg, block, block->loop, val, false, false)
|
|
|
))
|
|
|
{
|
|
|
@@ -15717,7 +15717,7 @@ GlobOpt::ProcessValueKills(BasicBlock *const block, GlobOptBlockData *const bloc
|
|
|
if(IsLoopPrePass() && block->loop == rootLoopPrePass)
|
|
|
{
|
|
|
AnalysisAssert(rootLoopPrePass);
|
|
|
-
|
|
|
+
|
|
|
for (Loop * loop = rootLoopPrePass; loop != nullptr; loop = loop->parent)
|
|
|
{
|
|
|
loop->jsArrayKills.SetKillsAllArrays();
|
|
|
@@ -16020,7 +16020,7 @@ GlobOpt::OptArraySrc(IR::Instr * *const instrRef)
|
|
|
baseOpnd->SetValueType(baseValueType);
|
|
|
if(!baseValueType.IsLikelyAnyOptimizedArray() ||
|
|
|
!DoArrayCheckHoist(baseValueType, currentBlock->loop, instr) ||
|
|
|
- baseOwnerIndir && !ShouldExpectConventionalArrayIndexValue(baseOwnerIndir))
|
|
|
+ (baseOwnerIndir && !ShouldExpectConventionalArrayIndexValue(baseOwnerIndir)))
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
@@ -16131,7 +16131,7 @@ GlobOpt::OptArraySrc(IR::Instr * *const instrRef)
|
|
|
const bool headSegmentLengthIsAvailable = baseArrayValueInfo && baseArrayValueInfo->HeadSegmentLengthSym();
|
|
|
const bool doHeadSegmentLengthLoad =
|
|
|
doArraySegmentLengthHoist &&
|
|
|
- (needsHeadSegmentLength || !isLikelyJsArray && needsLength) &&
|
|
|
+ (needsHeadSegmentLength || (!isLikelyJsArray && needsLength)) &&
|
|
|
!headSegmentLengthIsAvailable;
|
|
|
const bool lengthIsAvailable = baseArrayValueInfo && baseArrayValueInfo->LengthSym();
|
|
|
const bool doLengthLoad =
|
|
|
@@ -16150,7 +16150,7 @@ GlobOpt::OptArraySrc(IR::Instr * *const instrRef)
|
|
|
{
|
|
|
// SIMD_JS
|
|
|
// simd load/store never call helper
|
|
|
- canBailOutOnArrayAccessHelperCall = true;
|
|
|
+ canBailOutOnArrayAccessHelperCall = true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -16172,7 +16172,7 @@ GlobOpt::OptArraySrc(IR::Instr * *const instrRef)
|
|
|
IntConstantBounds indexConstantBounds;
|
|
|
Value *headSegmentLengthValue = nullptr;
|
|
|
IntConstantBounds headSegmentLengthConstantBounds;
|
|
|
-
|
|
|
+
|
|
|
if (baseValueType.IsLikelyOptimizedVirtualTypedArray() && !Js::IsSimd128LoadStore(instr->m_opcode) /*Always extract bounds for SIMD */)
|
|
|
{
|
|
|
if (isProfilableStElem ||
|
|
|
@@ -16328,7 +16328,7 @@ GlobOpt::OptArraySrc(IR::Instr * *const instrRef)
|
|
|
{
|
|
|
const JsArrayKills loopKills(loop->jsArrayKills);
|
|
|
Value *baseValueInLoopLandingPad;
|
|
|
- if(isLikelyJsArray && loopKills.KillsValueType(newBaseValueType) ||
|
|
|
+ if((isLikelyJsArray && loopKills.KillsValueType(newBaseValueType)) ||
|
|
|
!OptIsInvariant(baseOpnd->m_sym, currentBlock, loop, baseValue, true, true, &baseValueInLoopLandingPad) ||
|
|
|
!(doArrayChecks || baseValueInLoopLandingPad->GetValueInfo()->IsObject()))
|
|
|
{
|
|
|
@@ -17514,7 +17514,7 @@ GlobOpt::OptArraySrc(IR::Instr * *const instrRef)
|
|
|
baseArrayValueInfo->CreateOpnd(
|
|
|
baseOpnd,
|
|
|
needsHeadSegment,
|
|
|
- needsHeadSegmentLength || !isLikelyJsArray && needsLength,
|
|
|
+ needsHeadSegmentLength || (!isLikelyJsArray && needsLength),
|
|
|
needsLength,
|
|
|
eliminatedLowerBoundCheck,
|
|
|
eliminatedUpperBoundCheck,
|
|
|
@@ -17768,7 +17768,7 @@ GlobOpt::CheckJsArrayKills(IR::Instr *const instr)
|
|
|
case Js::OpCode::DeleteElemIStrict_A:
|
|
|
Assert(instr->GetSrc1());
|
|
|
if(!instr->GetSrc1()->IsIndirOpnd() ||
|
|
|
- useValueTypes && instr->GetSrc1()->AsIndirOpnd()->GetBaseOpnd()->GetValueType().IsNotArrayOrObjectWithArray())
|
|
|
+ (useValueTypes && instr->GetSrc1()->AsIndirOpnd()->GetBaseOpnd()->GetValueType().IsNotArrayOrObjectWithArray()))
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
@@ -17830,7 +17830,7 @@ GlobOpt::CheckJsArrayKills(IR::Instr *const instr)
|
|
|
|
|
|
const ValueType arrayValueType(arrayOpnd->GetValueType());
|
|
|
|
|
|
- if(!arrayOpnd->IsRegOpnd() || useValueTypes && arrayValueType.IsNotArrayOrObjectWithArray())
|
|
|
+ if(!arrayOpnd->IsRegOpnd() || (useValueTypes && arrayValueType.IsNotArrayOrObjectWithArray()))
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
@@ -17852,10 +17852,12 @@ GlobOpt::CheckJsArrayKills(IR::Instr *const instr)
|
|
|
}
|
|
|
|
|
|
// Don't kill NativeArray, if there is no mismatch between array's type and element's type.
|
|
|
- if(doNativeArrayTypeSpec && !(useValueTypes && arrayValueType.IsNativeArray() &&
|
|
|
- (arrayValueType.IsLikelyNativeIntArray() && instr->GetSrc2()->IsInt32()) ||
|
|
|
- (arrayValueType.IsLikelyNativeFloatArray() && instr->GetSrc2()->IsFloat()))
|
|
|
- && !(useValueTypes && arrayValueType.IsNotNativeArray()))
|
|
|
+ if(doNativeArrayTypeSpec &&
|
|
|
+ !(useValueTypes && arrayValueType.IsNativeArray() &&
|
|
|
+ ((arrayValueType.IsLikelyNativeIntArray() && instr->GetSrc2()->IsInt32()) ||
|
|
|
+ (arrayValueType.IsLikelyNativeFloatArray() && instr->GetSrc2()->IsFloat()))
|
|
|
+ ) &&
|
|
|
+ !(useValueTypes && arrayValueType.IsNotNativeArray()))
|
|
|
{
|
|
|
kills.SetKillsNativeArrays();
|
|
|
}
|
|
|
@@ -17869,7 +17871,7 @@ GlobOpt::CheckJsArrayKills(IR::Instr *const instr)
|
|
|
Assert(arrayOpnd);
|
|
|
|
|
|
const ValueType arrayValueType(arrayOpnd->GetValueType());
|
|
|
- if(!arrayOpnd->IsRegOpnd() || useValueTypes && arrayValueType.IsNotArrayOrObjectWithArray())
|
|
|
+ if(!arrayOpnd->IsRegOpnd() || (useValueTypes && arrayValueType.IsNotArrayOrObjectWithArray()))
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
@@ -17894,7 +17896,7 @@ GlobOpt::CheckJsArrayKills(IR::Instr *const instr)
|
|
|
IR::Opnd *const arrayOpnd = instr->FindCallArgumentOpnd(1);
|
|
|
Assert(arrayOpnd);
|
|
|
const ValueType arrayValueType(arrayOpnd->GetValueType());
|
|
|
- if(!arrayOpnd->IsRegOpnd() || useValueTypes && arrayValueType.IsNotArrayOrObjectWithArray())
|
|
|
+ if(!arrayOpnd->IsRegOpnd() || (useValueTypes && arrayValueType.IsNotArrayOrObjectWithArray()))
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
@@ -18251,10 +18253,10 @@ GlobOpt::VerifyIntSpecForIgnoringIntOverflow(IR::Instr *const instr)
|
|
|
// doesn't generate bailouts or cause ignoring int overflow to be invalid.
|
|
|
// MULs are allowed to start a region and have BailOutInfo since they will bailout on non-32 bit overflow.
|
|
|
if(instr->m_opcode == Js::OpCode::Ld_A ||
|
|
|
- (!instr->HasBailOutInfo() || instr->m_opcode == Js::OpCode::Mul_I4) &&
|
|
|
+ ((!instr->HasBailOutInfo() || instr->m_opcode == Js::OpCode::Mul_I4) &&
|
|
|
(!instr->GetDst() || instr->GetDst()->IsInt32()) &&
|
|
|
(!instr->GetSrc1() || instr->GetSrc1()->IsInt32()) &&
|
|
|
- (!instr->GetSrc2() || instr->GetSrc2()->IsInt32()))
|
|
|
+ (!instr->GetSrc2() || instr->GetSrc2()->IsInt32())))
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
@@ -18681,8 +18683,8 @@ GlobOpt::OptIsInvariant(Sym *sym, BasicBlock *block, Loop *loop, Value *srcVal,
|
|
|
{
|
|
|
Assert(block->globOptData.liveInt32Syms->Test(varSym->m_id));
|
|
|
if (!loop->landingPad->globOptData.liveInt32Syms->Test(varSym->m_id) ||
|
|
|
- loop->landingPad->globOptData.liveLossyInt32Syms->Test(varSym->m_id) &&
|
|
|
- !block->globOptData.liveLossyInt32Syms->Test(varSym->m_id))
|
|
|
+ (loop->landingPad->globOptData.liveLossyInt32Syms->Test(varSym->m_id) &&
|
|
|
+ !block->globOptData.liveLossyInt32Syms->Test(varSym->m_id)))
|
|
|
{
|
|
|
// Either the int32 sym is not live in the landing pad, or it's lossy in the landing pad and the
|
|
|
// instruction's block is using the lossless version. In either case, the instruction cannot be hoisted
|
|
|
@@ -18830,7 +18832,7 @@ GlobOpt::OptIsInvariant(
|
|
|
case Js::OpCode::LdLen_A:
|
|
|
return false;
|
|
|
|
|
|
- //Can't Hoist BailOnNotStackArgs, as it is necessary as InlineArgsOptimization relies on this opcode
|
|
|
+ //Can't Hoist BailOnNotStackArgs, as it is necessary as InlineArgsOptimization relies on this opcode
|
|
|
//to decide whether to throw rejit exception or not.
|
|
|
case Js::OpCode::BailOnNotStackArgs:
|
|
|
return false;
|
|
|
@@ -18971,7 +18973,7 @@ GlobOpt::OptHoistInvariant(
|
|
|
ValueInfo *src1ValueInfo = src1Val->GetValueInfo();
|
|
|
ValueInfo *landingPadSrc1ValueInfo = landingPadSrc1val->GetValueInfo();
|
|
|
IRType dstType = dst->GetType();
|
|
|
-
|
|
|
+
|
|
|
const auto AddBailOutToFromVar = [&]()
|
|
|
{
|
|
|
instr->GetSrc1()->SetValueType(landingPadSrc1val->GetValueInfo()->Type());
|
|
|
@@ -19751,7 +19753,7 @@ GlobOpt::DoArrayCheckHoist() const
|
|
|
bool
|
|
|
GlobOpt::DoArrayCheckHoist(const ValueType baseValueType, Loop* loop, IR::Instr *const instr) const
|
|
|
{
|
|
|
- if(!DoArrayCheckHoist() || instr && !IsLoopPrePass() && instr->DoStackArgsOpt(func))
|
|
|
+ if(!DoArrayCheckHoist() || (instr && !IsLoopPrePass() && instr->DoStackArgsOpt(func)))
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
@@ -19877,7 +19879,7 @@ GlobOpt::DoLdLenIntSpec(IR::Instr *const instr, const ValueType baseValueType) c
|
|
|
if(PHASE_OFF(Js::LdLenIntSpecPhase, func) ||
|
|
|
IsTypeSpecPhaseOff(func) ||
|
|
|
(func->HasProfileInfo() && func->GetReadOnlyProfileInfo()->IsLdLenIntSpecDisabled()) ||
|
|
|
- instr && !IsLoopPrePass() && instr->DoStackArgsOpt(func))
|
|
|
+ (instr && !IsLoopPrePass() && instr->DoStackArgsOpt(func)))
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
@@ -19895,7 +19897,7 @@ GlobOpt::DoLdLenIntSpec(IR::Instr *const instr, const ValueType baseValueType) c
|
|
|
Assert(!instr || baseValueType == instr->GetSrc1()->GetValueType());
|
|
|
return
|
|
|
baseValueType.HasBeenString() ||
|
|
|
- baseValueType.IsLikelyAnyOptimizedArray() && baseValueType.GetObjectType() != ObjectType::ObjectWithArray;
|
|
|
+ (baseValueType.IsLikelyAnyOptimizedArray() && baseValueType.GetObjectType() != ObjectType::ObjectWithArray);
|
|
|
}
|
|
|
|
|
|
bool
|
|
|
@@ -20785,7 +20787,7 @@ GlobOpt::TraceSettings()
|
|
|
Output::Print(_u(" FloatTypeSpec: %s\r\n"), this->DoFloatTypeSpec() ? _u("enabled") : _u("disabled"));
|
|
|
Output::Print(_u(" AggressiveIntTypeSpec: %s\r\n"), this->DoAggressiveIntTypeSpec() ? _u("enabled") : _u("disabled"));
|
|
|
Output::Print(_u(" LossyIntTypeSpec: %s\r\n"), this->DoLossyIntTypeSpec() ? _u("enabled") : _u("disabled"));
|
|
|
- Output::Print(_u(" ArrayCheckHoist: %s\r\n"), (this->func->HasProfileInfo() && this->func->GetReadOnlyProfileInfo()->IsArrayCheckHoistDisabled(func->IsLoopBody())) ? L"disabled" : L"enabled");
|
|
|
+ Output::Print(_u(" ArrayCheckHoist: %s\r\n"), (this->func->HasProfileInfo() && this->func->GetReadOnlyProfileInfo()->IsArrayCheckHoistDisabled(func->IsLoopBody())) ? _u("disabled") : _u("enabled"));
|
|
|
Output::Print(_u(" ImplicitCallFlags: %s\r\n"), Js::DynamicProfileInfo::GetImplicitCallFlagsString(this->func->m_fg->implicitCallFlags));
|
|
|
for (Loop * loop = this->func->m_fg->loopList; loop != NULL; loop = loop->next)
|
|
|
{
|
|
|
@@ -21486,11 +21488,11 @@ GlobOpt::EmitMemop(Loop * loop, LoopCount *loopCount, const MemOpEmitData* emitD
|
|
|
char16 loopCountBuf[loopCountBufSize];
|
|
|
if (loopCount->LoopCountMinusOneSym())
|
|
|
{
|
|
|
- _snwprintf_s(loopCountBuf, loopCountBufSize, _u("s%u"), loopCount->LoopCountMinusOneSym()->m_id);
|
|
|
+ swprintf_s(loopCountBuf, _u("s%u"), loopCount->LoopCountMinusOneSym()->m_id);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- _snwprintf_s(loopCountBuf, loopCountBufSize, _u("%u"), loopCount->LoopCountMinusOneConstantValue() + 1);
|
|
|
+ swprintf_s(loopCountBuf, _u("%u"), loopCount->LoopCountMinusOneConstantValue() + 1);
|
|
|
}
|
|
|
if (isMemset)
|
|
|
{
|
|
|
@@ -21499,7 +21501,7 @@ GlobOpt::EmitMemop(Loop * loop, LoopCount *loopCount, const MemOpEmitData* emitD
|
|
|
char16 constBuf[constBufSize];
|
|
|
if (candidate->srcSym)
|
|
|
{
|
|
|
- _snwprintf_s(constBuf, constBufSize, _u("s%u"), candidate->srcSym->m_id);
|
|
|
+ swprintf_s(constBuf, _u("s%u"), candidate->srcSym->m_id);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -21509,18 +21511,18 @@ GlobOpt::EmitMemop(Loop * loop, LoopCount *loopCount, const MemOpEmitData* emitD
|
|
|
case TyInt16:
|
|
|
case TyInt32:
|
|
|
case TyInt64:
|
|
|
- _snwprintf_s(constBuf, constBufSize, sizeof(IntConstType) == 8 ? _u("%lld") : _u("%d"), candidate->constant.u.intConst.value);
|
|
|
+ swprintf_s(constBuf, sizeof(IntConstType) == 8 ? _u("%lld") : _u("%d"), candidate->constant.u.intConst.value);
|
|
|
break;
|
|
|
case TyFloat32:
|
|
|
case TyFloat64:
|
|
|
- _snwprintf_s(constBuf, constBufSize, _u("%.4f"), candidate->constant.u.floatConst.value);
|
|
|
+ swprintf_s(constBuf, _u("%.4f"), candidate->constant.u.floatConst.value);
|
|
|
break;
|
|
|
case TyVar:
|
|
|
- _snwprintf_s(constBuf, constBufSize, sizeof(Js::Var) == 8 ? _u("0x%.16llX") : _u("0x%.8X"), candidate->constant.u.varConst.value);
|
|
|
+ swprintf_s(constBuf, sizeof(Js::Var) == 8 ? _u("0x%.16llX") : _u("0x%.8X"), candidate->constant.u.varConst.value);
|
|
|
break;
|
|
|
default:
|
|
|
AssertMsg(false, "Unsupported constant type");
|
|
|
- _snwprintf_s(constBuf, constBufSize, _u("Unknown"));
|
|
|
+ swprintf_s(constBuf, _u("Unknown"));
|
|
|
break;
|
|
|
}
|
|
|
}
|