diff --git a/deps/chakrashim/core/lib/Runtime/Library/JavascriptArray.inl b/deps/chakrashim/core/lib/Runtime/Library/JavascriptArray.inl index 0311267d35b..f3e393bcbe4 100644 --- a/deps/chakrashim/core/lib/Runtime/Library/JavascriptArray.inl +++ b/deps/chakrashim/core/lib/Runtime/Library/JavascriptArray.inl @@ -1160,23 +1160,15 @@ SECOND_PASS: } else if (startIndex == 0 && length > this->length && (head == EmptySegment || length > head->size)) { - Recycler *recycler = GetRecycler(); - this->length = length; - this->EnsureHead(); - SparseArraySegmentBase* current = nullptr; - - Assert(head->size < length); - - current = SparseArraySegment::AllocateSegment(recycler, 0, length, (SparseArraySegment *)nullptr); + SparseArraySegmentBase* current = SparseArraySegment::AllocateSegment(recycler, 0, length, (SparseArraySegment *)nullptr); this->SetHeadAndLastUsedSegment(current); + this->length = length; Assert(!HasSegmentMap()); SetHasNoMissingValues(true); - CopyValueToSegmentBuferNoCheck(((Js::SparseArraySegment*)current)->elements, length, newValue); - this->SetLastUsedSegment(current); } else {