Skip to content

Commit c16c5cf

Browse files
authored
Merge branch 'master' into wasm.simd.cleanup
2 parents 39425cc + 22f0a42 commit c16c5cf

31 files changed

+218
-61
lines changed

lib/Backend/IR.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3464,6 +3464,11 @@ IR::Instr* Instr::GetBytecodeArgOutCapture()
34643464
this->m_opcode == Js::OpCode::ArgOut_A_InlineBuiltIn);
34653465
Assert(this->m_dst->GetStackSym()->m_isArgCaptured);
34663466
IR::Instr* instr = this->GetSrc1()->GetStackSym()->m_instrDef;
3467+
while (instr->m_opcode != Js::OpCode::BytecodeArgOutCapture)
3468+
{
3469+
Assert(instr->GetSrc1() && instr->GetSrc1()->GetStackSym() && instr->GetSrc1()->GetStackSym()->IsSingleDef());
3470+
instr = instr->GetSrc1()->GetStackSym()->m_instrDef;
3471+
}
34673472
Assert(instr->m_opcode == Js::OpCode::BytecodeArgOutCapture);
34683473
return instr;
34693474
}

lib/Backend/IRBuilder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4857,6 +4857,7 @@ IRBuilder::BuildElementC2(Js::OpCode newOpcode, uint32 offset, Js::RegSlot insta
48574857
regOpnd = this->BuildDstOpnd(regSlot);
48584858

48594859
instr = IR::ProfiledInstr::New(newOpcode, regOpnd, fieldSymOpnd, value2Opnd, m_func);
4860+
instr->AsProfiledInstr()->u.FldInfo() = *(m_func->GetReadOnlyProfileInfo()->GetFldInfo(propertyIdIndex));
48604861
this->AddInstr(instr, offset);
48614862
}
48624863
break;
@@ -4878,7 +4879,7 @@ IRBuilder::BuildElementC2(Js::OpCode newOpcode, uint32 offset, Js::RegSlot insta
48784879
value2Opnd = this->BuildSrcOpnd(value2Slot);
48794880

48804881
instr = IR::ProfiledInstr::New(newOpcode, fieldSymOpnd, regOpnd, value2Opnd, m_func);
4881-
4882+
instr->AsProfiledInstr()->u.FldInfo() = *(m_func->GetReadOnlyProfileInfo()->GetFldInfo(propertyIdIndex));
48824883
this->AddInstr(instr, offset);
48834884
break;
48844885
}

lib/Backend/IRBuilderAsmJs.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ IRBuilderAsmJs::BuildSrcOpnd(Js::RegSlot srcRegSlot, IRType type)
337337
{
338338
StackSym * symSrc = m_func->m_symTable->FindStackSym(BuildSrcStackSymID(srcRegSlot, type));
339339
AssertMsg(symSrc, "Tried to use an undefined stack slot?");
340-
IR::RegOpnd * regOpnd = IR::RegOpnd::New(symSrc, type, m_func);
340+
IR::RegOpnd * regOpnd = IR::RegOpnd::New(symSrc, type, m_func);
341341

342342
return regOpnd;
343343
}
@@ -5901,7 +5901,6 @@ IRBuilderAsmJs::BuildInt1Uint8x16_1Int1(Js::OpCodeAsmJs newOpcode, uint32 offset
59015901

59025902
void IRBuilderAsmJs::BuildUint8x16_2Int16(Js::OpCodeAsmJs newOpcode, uint32 offset, BUILD_SIMD_ARGS_REG18)
59035903
{
5904-
IR::RegOpnd * dstOpnd = BuildDstOpnd(dstRegSlot, TySimd128U16);
59055904
IR::RegOpnd * src1Opnd = BuildSrcOpnd(src1RegSlot, TySimd128U16);
59065905

59075906
IR::RegOpnd * src2Opnd = BuildIntConstOpnd(src2RegSlot);
@@ -5921,6 +5920,8 @@ void IRBuilderAsmJs::BuildUint8x16_2Int16(Js::OpCodeAsmJs newOpcode, uint32 offs
59215920
IR::RegOpnd * src16Opnd = BuildIntConstOpnd(src16RegSlot);
59225921
IR::RegOpnd * src17Opnd = BuildIntConstOpnd(src17RegSlot);
59235922

5923+
IR::RegOpnd * dstOpnd = BuildDstOpnd(dstRegSlot, TySimd128U16);
5924+
59245925
IR::Instr * instr = nullptr;
59255926
dstOpnd->SetValueType(ValueType::Simd);
59265927
src1Opnd->SetValueType(ValueType::Simd);
@@ -5959,9 +5960,9 @@ IRBuilderAsmJs::BuildAsmShuffle(Js::OpCodeAsmJs newOpcode, uint32 offset)
59595960
Assert(OpCodeAttrAsmJs::HasMultiSizeLayout(newOpcode) && newOpcode == Js::OpCodeAsmJs::Simd128_Shuffle_V8X16);
59605961
auto layout = m_jnReader.GetLayout<Js::OpLayoutT_AsmShuffle<SizePolicy>>();
59615962

5962-
IR::RegOpnd * dstOpnd = BuildDstOpnd(GetRegSlotFromSimd128Reg(layout->R0), TySimd128U16);
59635963
IR::RegOpnd * src1Opnd = BuildSrcOpnd(GetRegSlotFromSimd128Reg(layout->R1), TySimd128U16);
59645964
IR::RegOpnd * src2Opnd = BuildSrcOpnd(GetRegSlotFromSimd128Reg(layout->R2), TySimd128U16);
5965+
IR::RegOpnd * dstOpnd = BuildDstOpnd(GetRegSlotFromSimd128Reg(layout->R0), TySimd128U16);
59655966
dstOpnd->SetValueType(ValueType::Simd);
59665967
src1Opnd->SetValueType(ValueType::Simd);
59675968
src2Opnd->SetValueType(ValueType::Simd);
@@ -5980,7 +5981,6 @@ IRBuilderAsmJs::BuildAsmShuffle(Js::OpCodeAsmJs newOpcode, uint32 offset)
59805981

59815982
void IRBuilderAsmJs::BuildUint8x16_3Int16(Js::OpCodeAsmJs newOpcode, uint32 offset, BUILD_SIMD_ARGS_REG19)
59825983
{
5983-
IR::RegOpnd * dstOpnd = BuildDstOpnd(dstRegSlot, TySimd128U16);
59845984
IR::RegOpnd * src1Opnd = BuildSrcOpnd(src1RegSlot, TySimd128U16);
59855985
IR::RegOpnd * src2Opnd = BuildSrcOpnd(src2RegSlot, TySimd128U16);
59865986

@@ -6001,6 +6001,8 @@ void IRBuilderAsmJs::BuildUint8x16_3Int16(Js::OpCodeAsmJs newOpcode, uint32 offs
60016001
IR::RegOpnd * src17Opnd = BuildIntConstOpnd(src17RegSlot);
60026002
IR::RegOpnd * src18Opnd = BuildIntConstOpnd(src18RegSlot);
60036003

6004+
IR::RegOpnd * dstOpnd = BuildDstOpnd(dstRegSlot, TySimd128U16);
6005+
60046006
IR::Instr * instr = nullptr;
60056007
dstOpnd->SetValueType(ValueType::Simd);
60066008
src1Opnd->SetValueType(ValueType::Simd);

lib/Common/Common/NumberUtilities.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ using namespace Js;
1717
// Redeclare static constants
1818
const UINT64 NumberConstantsBase::k_Nan;
1919
const UINT32 NumberConstantsBase::k_Nan32;
20+
const UINT64 NumberConstantsBase::k_NegativeNan;
2021
const INT64 NumberUtilitiesBase::Pos_InvalidInt64;
2122
const INT64 NumberUtilitiesBase::Neg_InvalidInt64;
2223
const uint64 NumberConstants::k_PosInf;
@@ -59,6 +60,7 @@ using namespace Js;
5960
const double NumberConstants::MAX_VALUE = *(double*)(&NumberConstants::k_PosMax);
6061
const double NumberConstants::MIN_VALUE = *(double*)(&NumberConstants::k_PosMin);
6162
const double NumberConstants::NaN = *(double*)(&NumberConstants::k_Nan);
63+
const double NumberConstants::NegativeNaN = *(double*)(&NumberConstants::k_NegativeNan);
6264
const double NumberConstants::NEGATIVE_INFINITY= *(double*)(&NumberConstants::k_NegInf);
6365
const double NumberConstants::POSITIVE_INFINITY= *(double*)(&NumberConstants::k_PosInf );
6466
const double NumberConstants::NEG_ZERO= *(double*)(&NumberConstants::k_NegZero );

lib/Common/Common/NumberUtilities.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ namespace Js
6464
static const double MAX_VALUE;
6565
static const double MIN_VALUE;
6666
static const double NaN;
67+
static const double NegativeNaN;
6768
static const double NEGATIVE_INFINITY;
6869
static const double POSITIVE_INFINITY;
6970
static const double NEG_ZERO;
@@ -99,6 +100,7 @@ namespace Js
99100

100101
static bool IsFinite(double value);
101102
static bool IsNan(double value);
103+
static bool IsNegative(double value);
102104
static bool IsFloat32NegZero(float value);
103105
static bool IsSpecial(double value, uint64 nSpecial);
104106
static uint64 ToSpecial(double value);

lib/Common/Common/NumberUtilities.inl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ namespace Js
137137
NUMBER_UTIL_INLINE bool NumberUtilities::IsNan(double value)
138138
{
139139
#if defined(TARGET_64)
140-
// NaN is a range of values; all bits on the exponent are 1's and some nonzero significant.
141-
// no distinction on signed NaN's
140+
// NaN is a range of values; all bits on the exponent are 1's
141+
// and some nonzero significant. No distinction on signed NaN's.
142142
uint64 nCompare = ToSpecial(value);
143143
bool isNan = (0 == (~nCompare & 0x7FF0000000000000ull) &&
144144
0 != (nCompare & 0x000FFFFFFFFFFFFFull));
@@ -149,6 +149,12 @@ namespace Js
149149
#endif
150150
}
151151

152+
NUMBER_UTIL_INLINE bool NumberUtilities::IsNegative(double value)
153+
{
154+
uint64 nCompare = ToSpecial(value);
155+
return nCompare & 0x8000000000000000ull;
156+
}
157+
152158
NUMBER_UTIL_INLINE bool NumberUtilities::IsSpecial(double value, uint64 nSpecial)
153159
{
154160
// Perform a bitwise comparison using uint64 instead of a double comparison, since that

lib/Common/Common/NumberUtilitiesBase.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ namespace Js
1212
class NumberConstantsBase
1313
{
1414
public:
15-
static const UINT64 k_Nan = 0xFFF8000000000000ull;
15+
static const UINT64 k_Nan = 0x7FF8000000000000ull;
1616
static const UINT32 k_Nan32 = 0x7FC00000ul;
17+
static const UINT64 k_NegativeNan = 0xFFF8000000000000ull;
1718
};
1819

1920
class NumberUtilitiesBase

lib/Runtime/Base/EtwTrace.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ size_t EtwTrace::GetSimpleJitFunctionName(
382382
const size_t suffixCharLength = _countof(_u("Simple")) - 1;
383383

384384
const char16 *const functionName = GetFunctionName(body);
385-
const size_t functionNameCharLength = wcslen(functionName);
385+
const size_t functionNameCharLength = body->GetDisplayNameLength();
386386
const size_t requiredCharCapacity = functionNameCharLength + suffixCharLength + 1;
387387
if(requiredCharCapacity > nameCharCapacity || name == NULL)
388388
{

lib/Runtime/Language/DynamicProfileInfo.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1172,8 +1172,13 @@ namespace Js
11721172
if (functionBody->GetCallSiteToCallApplyCallSiteArray())
11731173
{
11741174
Js::ProfileId callApplyCallSiteId = functionBody->GetCallSiteToCallApplyCallSiteArray()[callSiteId];
1175+
if (callApplyCallSiteId == Js::Constants::NoProfileId)
1176+
{
1177+
return nullptr;
1178+
}
1179+
11751180
Assert(callApplyCallSiteId < functionBody->GetProfiledCallApplyCallSiteCount());
1176-
1181+
11771182
if (callApplyTargetInfo[callApplyCallSiteId].isPolymorphic)
11781183
{
11791184
return nullptr;

lib/Runtime/Language/InterpreterStackFrame.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3909,11 +3909,14 @@ namespace Js
39093909
if (callSiteToCallApplyCallSiteMap)
39103910
{
39113911
Js::ProfileId callApplyCallSiteId = callSiteToCallApplyCallSiteMap[profileId];
3912-
Assert(callApplyCallSiteId < functionBody->GetProfiledCallApplyCallSiteCount());
3913-
if (callApplyCallSiteId != Js::Constants::NoProfileId)
3912+
if (callApplyCallSiteId < functionBody->GetProfiledCallApplyCallSiteCount())
39143913
{
39153914
dynamicProfileInfo->RecordCallApplyTargetInfo(functionBody, callApplyCallSiteId, targetFunction->GetFunctionInfo(), targetFunction);
39163915
}
3916+
else
3917+
{
3918+
Assert(callApplyCallSiteId == Js::Constants::NoProfileId);
3919+
}
39173920
}
39183921
}
39193922
}

0 commit comments

Comments
 (0)