Skip to content

Commit fbda525

Browse files
committed
[MERGE #5300 @rajatd] Memop fix related to scanning for missing values
Merge pull request #5300 from rajatd:prepareSeg If the entire range of a memop operation fits in the head segment, properly check if there were any missing items in the head outside of that range, before setting HasNoMissingValues to true on the dst array. This is needed only after #5110.
2 parents 9e876e0 + e6b59af commit fbda525

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

lib/Runtime/Library/JavascriptArray.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ SECOND_PASS:
892892
else if (!HasNoMissingValues())
893893
{
894894
// Have we overwritten all the missing values?
895-
if (!ScanForMissingValues<T>(0, startOffset))
895+
if (!ScanForMissingValues<T>(0, startOffset) && !ScanForMissingValues<T>(startOffset + length, current->length))
896896
{
897897
SetHasNoMissingValues();
898898
}

test/Array/memop_missingValues.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
//-------------------------------------------------------------------------------------------------------
5+
6+
function test0()
7+
{
8+
var GiantPrintArray = [];
9+
var IntArr0 = new Array(1, 1);
10+
var FloatArr0 = [];
11+
FloatArr0[1] = 1;
12+
FloatArr0[0] = 1;
13+
FloatArr0[12] = 1;
14+
var v5;
15+
v5 = IntArr0.length;
16+
for (var i = 0; i < v5; i++) {
17+
FloatArr0[i] = IntArr0[i];
18+
}
19+
GiantPrintArray.push(FloatArr0);
20+
for (var v2 = 0; 0 < GiantPrintArray; 0) {
21+
}
22+
}
23+
test0();
24+
test0();
25+
test0();
26+
print("passed");

test/Array/rlexe.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,12 @@
714714
<compile-flags>-mic:1 -off:simplejit -mmoc:0</compile-flags>
715715
</default>
716716
</test>
717+
<test>
718+
<default>
719+
<files>memop_missingValues.js</files>
720+
<compile-flags>-mmoc:0</compile-flags>
721+
</default>
722+
</test>
717723
<test>
718724
<default>
719725
<files>bug4587739.js</files>

0 commit comments

Comments
 (0)