Skip to content

Commit 226a96e

Browse files
committed
[1.2>master] Merge remaining code changes from internal RS1 branch
2 parents 3d6ef20 + 898582f commit 226a96e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1064
-298
lines changed

Build/Common.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<RuntimeTypeInfo>false</RuntimeTypeInfo>
2121
<!-- /Zi -->
2222
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
23+
<DebugInformationFormat Condition="'$(MultiProcessorCompilation)' == 'true'">OldStyle</DebugInformationFormat>
2324
<!-- /EHsc- -->
2425
<ExceptionHandling>SyncCThrow</ExceptionHandling>
2526
<!-- /Gz -->

lib/Backend/EmitBuffer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class EmitBufferManager
3737
void Decommit();
3838
void Clear();
3939

40-
EmitBufferAllocation* AllocateBuffer(__in size_t bytes, __deref_bcount(bytes) BYTE** ppBuffer, ushort pdataCount = 0, ushort xdataSize = 0, bool canAllocInPreReservedHeapPageSegment = false, bool isAnyJittedCode = false);
40+
EmitBufferAllocation* AllocateBuffer(__declspec(guard(overflow)) __in size_t bytes, __deref_bcount(bytes) BYTE** ppBuffer, ushort pdataCount = 0, ushort xdataSize = 0, bool canAllocInPreReservedHeapPageSegment = false, bool isAnyJittedCode = false);
4141
bool CommitBuffer(EmitBufferAllocation* allocation, __out_bcount(bytes) BYTE* destBuffer, __in size_t bytes, __in_bcount(bytes) const BYTE* sourceBuffer, __in DWORD alignPad = 0);
4242
bool ProtectBufferWithExecuteReadWriteForInterpreter(EmitBufferAllocation* allocation);
4343
bool CommitReadWriteBufferForInterpreter(EmitBufferAllocation* allocation, _In_reads_bytes_(bufferSize) BYTE* pBuffer, _In_ size_t bufferSize);
@@ -72,8 +72,8 @@ class EmitBufferManager
7272
ArenaAllocator * allocator;
7373
Js::ScriptContext * scriptContext;
7474

75-
EmitBufferAllocation * NewAllocation(size_t bytes, ushort pdataCount, ushort xdataSize, bool canAllocInPreReservedHeapPageSegment, bool isAnyJittedCode);
76-
EmitBufferAllocation* GetBuffer(EmitBufferAllocation *allocation, __in size_t bytes, __deref_bcount(bytes) BYTE** ppBuffer);
75+
EmitBufferAllocation * NewAllocation(__declspec(guard(overflow)) size_t bytes, ushort pdataCount, ushort xdataSize, bool canAllocInPreReservedHeapPageSegment, bool isAnyJittedCode);
76+
EmitBufferAllocation* GetBuffer(EmitBufferAllocation *allocation, __declspec(guard(overflow)) __in size_t bytes, __deref_bcount(bytes) BYTE** ppBuffer);
7777

7878
bool FinalizeAllocation(EmitBufferAllocation *allocation);
7979
CustomHeap::Heap allocationHeap;

lib/Backend/GlobHashTable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class ValueHashTable
5555
SListBase<HashBucket> * table;
5656

5757
public:
58-
static ValueHashTable * New(JitArenaAllocator *allocator, uint tableSize)
58+
static ValueHashTable * New(JitArenaAllocator *allocator, __declspec(guard(overflow)) uint tableSize)
5959
{
6060
return AllocatorNewPlus(JitArenaAllocator, allocator, (tableSize*sizeof(SListBase<HashBucket>)), ValueHashTable, allocator, tableSize);
6161
}

lib/Backend/Lower.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
#include "ExternalLowerer.h"
1515

16-
#include "ExternalLowerer.h"
17-
1816
///----------------------------------------------------------------------------
1917
///
2018
/// Lowerer::Lower
@@ -8404,6 +8402,7 @@ Lowerer::LowerLdArrViewElem(IR::Instr * instr)
84048402
IR::Opnd * src2 = instr->GetSrc2();
84058403

84068404
IR::Instr * done;
8405+
84078406
if (indexOpnd || m_func->GetJnFunction()->GetAsmJsFunctionInfoWithLock()->AccessNeedsBoundCheck((uint32)src1->AsIndirOpnd()->GetOffset()))
84088407
{
84098408
// CMP indexOpnd, src2(arrSize)
@@ -20242,7 +20241,7 @@ Lowerer::GenerateLdSuper(IR::Instr* instrInsert)
2024220241
Assert(dstOpnd->IsRegOpnd());
2024320242
LowererMD::CreateAssign(dstOpnd, opndUndefAddress, instrInsert);
2024420243

20245-
IR::Opnd * functionObjOpnd;
20244+
IR::Opnd * functionObjOpnd = nullptr;
2024620245
m_lowererMD.LoadFunctionObjectOpnd(instrInsert, functionObjOpnd);
2024720246
LowererMD::CreateAssign(instanceRegOpnd, functionObjOpnd, instrInsert);
2024820247

lib/Backend/NativeCodeData.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class NativeCodeData
3636
Allocator();
3737
~Allocator();
3838

39-
char * Alloc(size_t requestedBytes);
40-
char * AllocZero(size_t requestedBytes);
39+
char * Alloc(__declspec(guard(overflow)) size_t requestedBytes);
40+
char * AllocZero(__declspec(guard(overflow)) size_t requestedBytes);
4141
NativeCodeData * Finalize();
4242
void Free(void * buffer, size_t byteSize);
4343

lib/Backend/amd64/LowererMDArch.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,20 @@ LowererMDArch::LoadDynamicArgumentUsingLength(IR::Instr *instr)
12211221
IR::Instr *
12221222
LowererMDArch::LoadDoubleHelperArgument(IR::Instr * instrInsert, IR::Opnd * opndArg)
12231223
{
1224-
Assert(opndArg->IsFloat64());
1224+
IR::Opnd * float64Opnd;
1225+
if (opndArg->GetType() == TyFloat32)
1226+
{
1227+
float64Opnd = IR::RegOpnd::New(TyFloat64, m_func);
1228+
IR::Instr * instr = IR::Instr::New(Js::OpCode::CVTSS2SD, float64Opnd, opndArg, this->m_func);
1229+
instrInsert->InsertBefore(instr);
1230+
}
1231+
else
1232+
{
1233+
float64Opnd = opndArg;
1234+
}
1235+
1236+
Assert(opndArg->IsFloat());
1237+
12251238
return LoadHelperArgument(instrInsert, opndArg);
12261239
}
12271240

lib/Backend/arm/Thunks.asm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
;Js::JavascriptMethod NativeCodeGenerator::CheckCodeGen(Js::JavascriptFunction * function)
1515
IMPORT |?CheckCodeGen@NativeCodeGenerator@@SAP6APAXPAVRecyclableObject@Js@@UCallInfo@3@ZZPAVScriptFunction@3@@Z|
1616

17+
#if defined(_CONTROL_FLOW_GUARD)
18+
IMPORT __guard_check_icall_fptr
19+
#endif
20+
1721
TEXTAREA
1822

1923
;;============================================================================================================

lib/Common/Core/AllocSizeMath.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class AllocSizeMath
1010
// Works for both 32bit and 64bit size_t arithmetic. It's also pretty
1111
// optimal in the cases where either left or right or both are small, compile-
1212
// time constants.
13-
static size_t Add(size_t left, size_t right)
13+
static size_t Add(__declspec(guard(overflow)) size_t left, __declspec(guard(overflow)) size_t right)
1414
{
1515
size_t allocSize = left + right;
1616
if (allocSize < left)
@@ -28,7 +28,7 @@ class AllocSizeMath
2828
}
2929

3030
// Optimized for right being a constant power of 2...
31-
static size_t Mul(size_t left, size_t right)
31+
static size_t Mul(__declspec(guard(overflow)) size_t left, __declspec(guard(overflow)) size_t right)
3232
{
3333
size_t allocSize = left * right;
3434
if (left != (allocSize / right))

lib/Common/DataStructures/BaseDictionary.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ namespace JsUtil
10431043
entries = newEntries;
10441044
}
10451045

1046-
__ecount(bucketCount) int *AllocateBuckets(const uint bucketCount)
1046+
__ecount(bucketCount) int *AllocateBuckets(__declspec(guard(overflow)) const uint bucketCount)
10471047
{
10481048
return
10491049
AllocateArray<AllocatorType, int, false>(
@@ -1052,7 +1052,7 @@ namespace JsUtil
10521052
bucketCount);
10531053
}
10541054

1055-
__ecount(size) EntryType * AllocateEntries(int size, const bool zeroAllocate = true)
1055+
__ecount(size) EntryType * AllocateEntries(__declspec(guard(overflow)) int size, const bool zeroAllocate = true)
10561056
{
10571057
// Note that the choice of leaf/non-leaf node is decided for the EntryType on the basis of TValue. By default, if
10581058
// TValue is a pointer, a non-leaf allocation is done. This behavior can be overridden by specializing
@@ -1080,7 +1080,7 @@ namespace JsUtil
10801080
AllocatorFree(alloc, EntryAllocatorFuncType::GetFreeFunc(), entries, size * sizeof(EntryType));
10811081
}
10821082

1083-
void Allocate(__deref_out_ecount(bucketCount) int** ppBuckets, __deref_out_ecount(size) EntryType** ppEntries, uint bucketCount, int size)
1083+
void Allocate(__deref_out_ecount(bucketCount) int** ppBuckets, __deref_out_ecount(size) EntryType** ppEntries, __declspec(guard(overflow)) uint bucketCount, __declspec(guard(overflow)) int size)
10841084
{
10851085
int *const buckets = AllocateBuckets(bucketCount);
10861086
Assert(buckets); // no-throw allocators are currently not supported

lib/Common/DataStructures/FixedBitVector.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ class BVFixed
3535
static BVFixed * New(TAllocator* alloc, BVFixed * initBv);
3636

3737
template <typename TAllocator>
38-
static BVFixed * New(BVIndex length, TAllocator* alloc, bool initialSet = false);
38+
static BVFixed * New(__declspec(guard(overflow)) BVIndex length, TAllocator* alloc, bool initialSet = false);
3939

4040
template <typename TAllocator>
41-
static BVFixed * NewNoThrow(BVIndex length, TAllocator* alloc, bool initialSet = false);
41+
static BVFixed * NewNoThrow(__declspec(guard(overflow)) BVIndex length, TAllocator* alloc, bool initialSet = false);
4242

4343
template <typename TAllocator>
4444
void Delete(TAllocator * alloc);
@@ -152,14 +152,14 @@ BVFixed * BVFixed::New(TAllocator * alloc, BVFixed * initBv)
152152
}
153153

154154
template <typename TAllocator>
155-
BVFixed * BVFixed::New(BVIndex length, TAllocator * alloc, bool initialSet)
155+
BVFixed * BVFixed::New(__declspec(guard(overflow)) BVIndex length, TAllocator * alloc, bool initialSet)
156156
{
157157
BVFixed *result = AllocatorNewPlus(TAllocator, alloc, sizeof(BVUnit) * BVFixed::WordCount(length), BVFixed, length, initialSet);
158158
return result;
159159
}
160160

161161
template <typename TAllocator>
162-
BVFixed * BVFixed::NewNoThrow(BVIndex length, TAllocator * alloc, bool initialSet)
162+
BVFixed * BVFixed::NewNoThrow(__declspec(guard(overflow)) BVIndex length, TAllocator * alloc, bool initialSet)
163163
{
164164
BVFixed *result = AllocatorNewNoThrowPlus(TAllocator, alloc, sizeof(BVUnit) * BVFixed::WordCount(length), BVFixed, length, initialSet);
165165
return result;

0 commit comments

Comments
 (0)