Skip to content

Commit 6b98ef8

Browse files
committed
[MERGE #6294 @akroshg] Fix for the array inline segment assert.
Merge pull request #6294 from akroshg:fix_6277 This assert is happening due to false positive. The array's head segment is not allocated as inlined - but it was allocated on the page boundary. That makes this segement to just aligned with the array and we got the assert fired for wrong reason. We don't need to check the assert for the source array to be not inlined as in the above 'else' condition we allocated the dest segment ourselve in the same function. So I removed the part where we check the current array is not inlined.
2 parents 7e29961 + 6b3148f commit 6b98ef8

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

lib/Runtime/Library/JavascriptArray.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -11951,7 +11951,7 @@ using namespace Js;
1195111951
SetHeadAndLastUsedSegment(dst);
1195211952
dst->CheckLengthvsSize();
1195311953

11954-
Assert(IsInlineSegment(src, instance) == IsInlineSegment(dst, static_cast<T*>(this)));
11954+
Assert(!IsInlineSegment(src, instance) || IsInlineSegment(dst, static_cast<T*>(this)));
1195511955

1195611956
CopyArray(dst->elements, dst->size, src->elements, sourceSize);
1195711957

test/Bugs/bug_6277.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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 inlinee() {
7+
Number.isSafeInteger(1.1 * 0);
8+
return inlinee.arguments[0];
9+
}
10+
function opt(convert_to_var_array) {
11+
let stack_arr = [];
12+
13+
stack_arr[20] = 1.1;
14+
stack_arr[10000] = 1.1;
15+
stack_arr[20000] = 2.2;
16+
let heap_arr = inlinee(stack_arr);
17+
}
18+
function main() {
19+
for (let i = 0; i < 50000; i++) {
20+
opt(new Function(''));
21+
inlinee();
22+
inlinee();
23+
}
24+
inlinee();
25+
opt(heap_arr => {
26+
heap_arr[10000] = {};
27+
inlinee();
28+
inlinee();
29+
});
30+
}
31+
main();
32+
print("Pass");

test/Bugs/rlexe.xml

+5
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,11 @@
618618
<compile-flags>-force:deferparse</compile-flags>
619619
</default>
620620
</test>
621+
<test>
622+
<default>
623+
<files>bug_6277.js</files>
624+
</default>
625+
</test>
621626
<test>
622627
<default>
623628
<files>bug_OS23102586.js</files>

0 commit comments

Comments
 (0)