Skip to content

Commit f7c5dbb

Browse files
committed
[MERGE chakra-core#898] MemSet array btree
Merge pull request chakra-core#898 from Cellule:memset/btree Move the check for array BTree up one level in memset
2 parents 7cfe84a + b22bab3 commit f7c5dbb

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

lib/Runtime/Library/JavascriptArray.inl

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,20 @@ SECOND_PASS:
10161016
template<typename T>
10171017
bool JavascriptArray::DirectSetItemAtRange(uint32 startIndex, uint32 length, T newValue)
10181018
{
1019+
bool isBtree = false;
1020+
1021+
#ifdef ENABLE_DEBUG_CONFIG_OPTIONS
1022+
isBtree = Js::Configuration::Global.flags.ForceArrayBTree;
1023+
#endif
1024+
if (GetSegmentMap() || isBtree)
1025+
{
1026+
for (uint i = startIndex; i < startIndex + length; i++)
1027+
{
1028+
DirectSetItem_Full<T>(i, newValue);
1029+
}
1030+
return true;
1031+
}
1032+
10191033
if (startIndex == 0 && head != EmptySegment && length < head->size)
10201034
{
10211035
if (newValue == (T)0 || newValue == (T)(-1))
@@ -1094,20 +1108,7 @@ SECOND_PASS:
10941108
{
10951109
return true;
10961110
}
1097-
1098-
bool isBtree = false;
1099-
1100-
#ifdef ENABLE_DEBUG_CONFIG_OPTIONS
1101-
isBtree = Js::Configuration::Global.flags.ForceArrayBTree;
1102-
#endif
1103-
if (GetSegmentMap() || isBtree)
1104-
{
1105-
for (uint i = startIndex; i < startIndex + length; i++)
1106-
{
1107-
DirectSetItem_Full<T>(i, newValue);
1108-
}
1109-
return true;
1110-
}
1111+
Assert(!GetSegmentMap());
11111112

11121113
SparseArraySegment<T> *current = PrepareSegmentForMemOp<T>(startIndex, length);
11131114
if (current == nullptr)

0 commit comments

Comments
 (0)