Skip to content

Commit 5961803

Browse files
author
Meghana Gupta
committed
Fix sal warnings
Add annotation in CodeGenNumberAllocator.cpp to suppress sal warning. Restructure code in Encoder.cpp, the two function calls were throwing off the analyzer.
1 parent f4e226b commit 5961803

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/Backend/CodeGenNumberAllocator.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@ Js::JavascriptNumber* XProcNumberPageSegmentImpl::AllocateNumber(Func* func, dou
324324
Recycler::FillPadNoCheck(pLocalNumber, sizeof(Js::JavascriptNumber), sizeCat, false);
325325
pLocalNumber = new (pLocalNumber) Js::JavascriptNumber(localNumber);
326326
}
327+
#else
328+
Assert(sizeCat == sizeof(Js::JavascriptNumber));
329+
__analysis_assume(sizeCat == sizeof(Js::JavascriptNumber));
327330
#endif
328331
// change vtable to the remote one
329332
*(void**)pLocalNumber = (void*)func->GetScriptContextInfo()->GetVTableAddress(VTableValue::VtableJavascriptNumber);

lib/Backend/Encoder.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,9 @@ Encoder::Encode()
295295
{
296296
if (m_func->IsOOPJIT())
297297
{
298-
Js::ThrowMapEntry * throwMap = NativeCodeDataNewArrayNoFixup(m_func->GetNativeCodeDataAllocator(), Js::ThrowMapEntry, m_pragmaInstrToRecordMap->Count());
299-
for (int32 i = 0; i < m_pragmaInstrToRecordMap->Count(); i++)
298+
int allocSize = m_pragmaInstrToRecordMap->Count();
299+
Js::ThrowMapEntry * throwMap = NativeCodeDataNewArrayNoFixup(m_func->GetNativeCodeDataAllocator(), Js::ThrowMapEntry, allocSize);
300+
for (int i = 0; i < allocSize; i++)
300301
{
301302
IR::PragmaInstr *inst = m_pragmaInstrToRecordMap->Item(i);
302303
throwMap[i].nativeBufferOffset = inst->m_offsetInBuffer;

0 commit comments

Comments
 (0)