Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
deps: update ChakraCore to chakra-core/ChakraCore@1fc4e1f08b
Browse files Browse the repository at this point in the history
[MERGE #5476 @Penguinwizzard] Fix a set of permissive- issues

Merge pull request #5476 from Penguinwizzard:permissiveminus

This is a set of fixes for some of the issues that permissive- hits in our codebase. There's a few more (~15 or so right now) that I didn't get around to yet, and won't address in this PR (they tend to look like they need more extensive changes to address).
Fixes #4596
Fixes #5189

Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
  • Loading branch information
Penguinwizzard authored and kfarnung committed Jul 19, 2018
1 parent 07558fa commit d5de45d
Show file tree
Hide file tree
Showing 13 changed files with 107 additions and 77 deletions.
6 changes: 3 additions & 3 deletions deps/chakrashim/core/lib/Backend/GlobHashTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,13 +329,13 @@ class ValueHashTable
{
_TYPENAME SListBase<HashBucket>::Iterator iter2(&this2->table[i]);
iter2.Next();
FOREACH_SLISTBASE_ENTRY_EDITING((HashBucket), bucket, &this->table[i], iter)
FOREACH_SLISTBASE_ENTRY_EDITING(HashBucket, bucket, &this->table[i], iter)
{
while (iter2.IsValid() && bucket.value < iter2.Data().value)
{
HashBucket * newBucket = iter.InsertNodeBefore(this->alloc);
newBucket->value = iter2.Data().value;
newBucket->element = fn(null, iter2.Data().element);
newBucket->element = fn(nullptr, iter2.Data().element);
iter2.Next();
}

Expand All @@ -354,7 +354,7 @@ class ValueHashTable
{
HashBucket * newBucket = iter.InsertNodeBefore(this->alloc);
newBucket->value = iter2.Data().value;
newBucket->element = fn(null, iter2.Data().element);
newBucket->element = fn(nullptr, iter2.Data().element);
iter2.Next();
}
}
Expand Down
2 changes: 1 addition & 1 deletion deps/chakrashim/core/lib/Common/CommonMin.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ using namespace Memory;
#include "DataStructures/SList.h"
#include "DataStructures/DList.h"
#include "DataStructures/KeyValuePair.h"
#include "DataStructures/BaseDictionary.h"
#include "DataStructures/DictionaryEntry.h"
#include "DataStructures/BaseDictionary.h"
#include "DataStructures/ClusterList.h"

// === Configurations Header ===
Expand Down
10 changes: 5 additions & 5 deletions deps/chakrashim/core/lib/Common/DataStructures/ClusterList.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class ClusterList
, consolidated(true)
#endif
{
list = AllocatorNewArrayLeaf(TAllocator, this->alloc, indexType, maxCount);
for (indextype i = 0; i < maxIndex; i++)
list = AllocatorNewArrayLeaf(TAllocator, this->alloc, indexType, maxIndex);
for (indexType i = 0; i < maxIndex; i++)
{
list[i] = i;
}
Expand All @@ -68,7 +68,7 @@ class ClusterList
{
if (this->list != nullptr)
{
AllocatorDeleteArrayLeaf(TAllocator, this->alloc, maxCount, this->list);
AllocatorDeleteArrayLeaf(TAllocator, this->alloc, maxIndex, this->list);
this->list = nullptr;
}
}
Expand All @@ -86,7 +86,7 @@ class ClusterList
// Reset the list; useful if we're re-using the data structure
void Reset()
{
for (indextype i = 0; i < maxIndex; i++)
for (indexType i = 0; i < maxIndex; i++)
{
list[i] = i;
}
Expand Down Expand Up @@ -313,7 +313,7 @@ class SegmentClusterList
{
if (backingStore[i] != nullptr)
{
AllocatorDeleteArrayLeaf(TAllocator, alloc, numPerSegment, backingstore[i]);
AllocatorDeleteArrayLeaf(TAllocator, alloc, numPerSegment, backingStore[i]);
backingStore[i] = nullptr;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace Js
EvalMapStringInternal& operator=(void * str)
{
Assert(str == null);
memset(this, 0, sizeof(EvalMapString));
memset(this, 0, sizeof(*this));
return (*this);
}

Expand Down
4 changes: 2 additions & 2 deletions deps/chakrashim/core/lib/Common/DataStructures/List.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ namespace JsUtil
template <typename TConditionalFunction>
bool Last(TConditionalFunction function, T& outElement)
{
for (int i = count - 1; i >= 0; --i)
for (int i = this->count - 1; i >= 0; --i)
{
if (function(this->buffer[i]))
{
Expand Down Expand Up @@ -420,7 +420,7 @@ namespace JsUtil
JsUtil::ExternalApi::RaiseOnIntOverflow();
}

js_memcpy_s(buffer + this->count, availableByteSpace, items, givenBufferSize);
js_memcpy_s(this->buffer + this->count, availableByteSpace, items, givenBufferSize);
this->count = requiredSize;

return requiredSize; //Returns count
Expand Down
16 changes: 8 additions & 8 deletions deps/chakrashim/core/lib/Common/Memory/AutoAllocatorObjectPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ class AutoAllocatorArrayPtr : public BasePtr<T>
private:
void Clear()
{
if (ptr != nullptr)
if (this->ptr != nullptr)
{
DeleteArray<TAllocator>(m_allocator, m_elementCount, ptr);
ptr = nullptr;
DeleteArray<TAllocator>(m_allocator, this->m_elementCount, this->ptr);
this->ptr = nullptr;
}
}
};
Expand Down Expand Up @@ -98,14 +98,14 @@ class AutoAllocatorObjectArrayPtr : public AutoAllocatorArrayPtr<T*, ArrayAlloca
private:
void Clear()
{
if (ptr != nullptr)
if (this->ptr != nullptr)
{
for (size_t i = 0; i < m_elementCount; i++)
for (size_t i = 0; i < this->m_elementCount; i++)
{
if (ptr[i] != nullptr)
if (this->ptr[i] != nullptr)
{
DeleteObject<TAllocator>(m_allocator, ptr[i]);
ptr[i] = nullptr;
DeleteObject<TAllocator>(this->m_allocator, this->ptr[i]);
this->ptr[i] = nullptr;
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions deps/chakrashim/core/lib/Common/Memory/AutoPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,18 @@ class AutoArrayAndItemsPtr : public AutoArrayPtr<T>
private:
void Clear()
{
if (ptr != nullptr){
if (this->ptr != nullptr){
for (size_t i = 0; i < this->m_elementCount; i++)
{
if (ptr[i] != nullptr)
if (this->ptr[i] != nullptr)
{
ptr[i]->CleanUp();
ptr[i] = nullptr;
this->ptr[i]->CleanUp();
this->ptr[i] = nullptr;
}
}

HeapDeleteArray(m_elementCount, ptr);
ptr = nullptr;
HeapDeleteArray(this->m_elementCount, this->ptr);
this->ptr = nullptr;
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion deps/chakrashim/core/lib/Common/PlatformAgnostic/Arrays.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Arrays
bool GetLocaleSeparator(char16* szSeparator, uint32* sepOutLength, uint32 sepBufferSize);

template <uint32 sepBufferSize>
inline bool GetLocaleSeparator(char16(&szSepatator)[sepBufferSize], uint32 *sepOutLength)
inline bool GetLocaleSeparator(char16(&szSeparator)[sepBufferSize], uint32 *sepOutLength)
{
return GetLocaleSeparator(szSeparator, sepOutLength, sepBufferSize);
}
Expand Down
24 changes: 0 additions & 24 deletions deps/chakrashim/core/lib/Parser/Parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,6 @@ bool Parser::IsES6DestructuringEnabled() const
return m_scriptContext->GetConfig()->IsES6DestructuringEnabled();
}

struct StmtNest
{
union
{
struct
{
ParseNodeStmt * pnodeStmt; // This statement node.
};
struct
{
bool isDeferred : 1;
OpCode op; // This statement operation.
};
};
LabelId* pLabelId; // Labels for this statement.
StmtNest *pstmtOuter; // Enclosing statement.

OpCode GetNop() const
{
AnalysisAssert(isDeferred || pnodeStmt != nullptr);
return isDeferred ? op : pnodeStmt->nop;
}
};

struct BlockInfoStack
{
StmtNest pstmt;
Expand Down
26 changes: 25 additions & 1 deletion deps/chakrashim/core/lib/Parser/Parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,32 @@ struct PidRefStack;

struct DeferredFunctionStub;

struct StmtNest;
struct BlockInfoStack;

struct StmtNest
{
union
{
struct
{
ParseNodeStmt * pnodeStmt; // This statement node.
};
struct
{
bool isDeferred : 1;
OpCode op; // This statement operation.
};
};
LabelId* pLabelId; // Labels for this statement.
StmtNest *pstmtOuter; // Enclosing statement.

inline OpCode GetNop() const
{
AnalysisAssert(isDeferred || pnodeStmt != nullptr);
return isDeferred ? op : pnodeStmt->nop;
}
};

struct ParseContext
{
LPCUTF8 pszSrc;
Expand Down
2 changes: 2 additions & 0 deletions deps/chakrashim/core/lib/Runtime/Base/ThreadContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ class ThreadConfiguration
}
};

class AutoReentrancyHandler;

class ThreadContext sealed :
public DefaultRecyclerCollectionWrapper,
public JsUtil::DoublyLinkedListElement<ThreadContext>,
Expand Down
74 changes: 51 additions & 23 deletions deps/chakrashim/core/lib/Runtime/Library/TypedArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,34 @@ namespace Js
};

template <typename TypeName, bool clamped = false, bool virtualAllocated = false>
class TypedArray;

// These are referenced in the TypedArray implementation, so we need to forward-typedef these.

typedef TypedArray<int8> Int8Array;
typedef TypedArray<uint8,false> Uint8Array;
typedef TypedArray<uint8,true> Uint8ClampedArray;
typedef TypedArray<int16> Int16Array;
typedef TypedArray<uint16> Uint16Array;
typedef TypedArray<int32> Int32Array;
typedef TypedArray<uint32> Uint32Array;
typedef TypedArray<float> Float32Array;
typedef TypedArray<double> Float64Array;
typedef TypedArray<int64> Int64Array;
typedef TypedArray<uint64> Uint64Array;
typedef TypedArray<bool> BoolArray;
typedef TypedArray<int8, false, true> Int8VirtualArray;
typedef TypedArray<uint8, false, true> Uint8VirtualArray;
typedef TypedArray<uint8, true, true> Uint8ClampedVirtualArray;
typedef TypedArray<int16, false, true> Int16VirtualArray;
typedef TypedArray<uint16, false, true> Uint16VirtualArray;
typedef TypedArray<int32, false, true> Int32VirtualArray;
typedef TypedArray<uint32, false, true> Uint32VirtualArray;
typedef TypedArray<float, false, true> Float32VirtualArray;
typedef TypedArray<double, false, true> Float64VirtualArray;


template <typename TypeName, bool clamped /*= false*/, bool virtualAllocated /*= false*/>
class TypedArray : public TypedArrayBase
{
protected:
Expand Down Expand Up @@ -625,34 +653,34 @@ namespace Js

#if defined(__clang__)
// hack for clang message: "...add an explicit instantiation declaration to .."
#define __EXPLICIT_INSTANTINATE_TA(x) x;\
#define __EXPLICIT_INSTANTINATE_TA(x) \
template<> FunctionInfo Js::x::EntryInfo::NewInstance;\
template<> FunctionInfo Js::x::EntryInfo::Set
#else // MSVC
#define __EXPLICIT_INSTANTINATE_TA(x) x
#define __EXPLICIT_INSTANTINATE_TA(x)
#endif

typedef TypedArray<int8> __EXPLICIT_INSTANTINATE_TA(Int8Array);
typedef TypedArray<uint8,false> __EXPLICIT_INSTANTINATE_TA(Uint8Array);
typedef TypedArray<uint8,true> __EXPLICIT_INSTANTINATE_TA(Uint8ClampedArray);
typedef TypedArray<int16> __EXPLICIT_INSTANTINATE_TA(Int16Array);
typedef TypedArray<uint16> __EXPLICIT_INSTANTINATE_TA(Uint16Array);
typedef TypedArray<int32> __EXPLICIT_INSTANTINATE_TA(Int32Array);
typedef TypedArray<uint32> __EXPLICIT_INSTANTINATE_TA(Uint32Array);
typedef TypedArray<float> __EXPLICIT_INSTANTINATE_TA(Float32Array);
typedef TypedArray<double> __EXPLICIT_INSTANTINATE_TA(Float64Array);
typedef TypedArray<int64> __EXPLICIT_INSTANTINATE_TA(Int64Array);
typedef TypedArray<uint64> __EXPLICIT_INSTANTINATE_TA(Uint64Array);
typedef TypedArray<bool> __EXPLICIT_INSTANTINATE_TA(BoolArray);
typedef TypedArray<int8, false, true> __EXPLICIT_INSTANTINATE_TA(Int8VirtualArray);
typedef TypedArray<uint8, false, true> __EXPLICIT_INSTANTINATE_TA(Uint8VirtualArray);
typedef TypedArray<uint8, true, true> __EXPLICIT_INSTANTINATE_TA(Uint8ClampedVirtualArray);
typedef TypedArray<int16, false, true> __EXPLICIT_INSTANTINATE_TA(Int16VirtualArray);
typedef TypedArray<uint16, false, true> __EXPLICIT_INSTANTINATE_TA(Uint16VirtualArray);
typedef TypedArray<int32, false, true> __EXPLICIT_INSTANTINATE_TA(Int32VirtualArray);
typedef TypedArray<uint32, false, true> __EXPLICIT_INSTANTINATE_TA(Uint32VirtualArray);
typedef TypedArray<float, false, true> __EXPLICIT_INSTANTINATE_TA(Float32VirtualArray);
typedef TypedArray<double, false, true> __EXPLICIT_INSTANTINATE_TA(Float64VirtualArray);
__EXPLICIT_INSTANTINATE_TA(Int8Array);
__EXPLICIT_INSTANTINATE_TA(Uint8Array);
__EXPLICIT_INSTANTINATE_TA(Uint8ClampedArray);
__EXPLICIT_INSTANTINATE_TA(Int16Array);
__EXPLICIT_INSTANTINATE_TA(Uint16Array);
__EXPLICIT_INSTANTINATE_TA(Int32Array);
__EXPLICIT_INSTANTINATE_TA(Uint32Array);
__EXPLICIT_INSTANTINATE_TA(Float32Array);
__EXPLICIT_INSTANTINATE_TA(Float64Array);
__EXPLICIT_INSTANTINATE_TA(Int64Array);
__EXPLICIT_INSTANTINATE_TA(Uint64Array);
__EXPLICIT_INSTANTINATE_TA(BoolArray);
__EXPLICIT_INSTANTINATE_TA(Int8VirtualArray);
__EXPLICIT_INSTANTINATE_TA(Uint8VirtualArray);
__EXPLICIT_INSTANTINATE_TA(Uint8ClampedVirtualArray);
__EXPLICIT_INSTANTINATE_TA(Int16VirtualArray);
__EXPLICIT_INSTANTINATE_TA(Uint16VirtualArray);
__EXPLICIT_INSTANTINATE_TA(Int32VirtualArray);
__EXPLICIT_INSTANTINATE_TA(Uint32VirtualArray);
__EXPLICIT_INSTANTINATE_TA(Float32VirtualArray);
__EXPLICIT_INSTANTINATE_TA(Float64VirtualArray);

#undef __EXPLICIT_INSTANTINATE_TA
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace DateTime
double currentRandomWindowScaled = 0.0;
ULONGLONG currentQuantizedQpc = 0;
public:
JitterManager::JitterManager()
JitterManager()
{
// NOTE: We could cache the (1000/frequency) operation, as a double,
// that is used later to convert from seconds to milliseconds so that
Expand Down Expand Up @@ -68,7 +68,7 @@ namespace DateTime
quantizationToSelectedScaleFactor = max(quantizationToSelectedScaleFactor, 1.0);
}

uint64 JitterManager::QuantizedQPC(uint64 qpc)
uint64 QuantizedQPC(uint64 qpc)
{
// Due to further analysis of some attacks, we're jittering on a more granular
// frequency of as much as a full millisecond.
Expand Down

0 comments on commit d5de45d

Please sign in to comment.