Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r222598 - JSArray::canFastCopy() should fail if the source and …
…destination arrays are the same. https://bugs.webkit.org/show_bug.cgi?id=177584 <rdar://problem/34463903> Reviewed by Saam Barati. JSTests: * stress/regress-177584.js: Added. (assertEqual): (Array.prototype.Symbol.species): Source/JavaScriptCore: If the source and destination arrays are the same, we may be copying overlapping regions. Hence, we need to take the slow path. * runtime/JSArrayInlines.h: (JSC::JSArray::canFastCopy):
- Loading branch information
1 parent
c350fe8
commit dff69bc
Showing
4 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
function assertEqual(actual, expected) { | ||
if (actual != expected) | ||
throw "Failed: actual: " + actual + ", expected: " + expected; | ||
} | ||
|
||
var a0 = [,,,,,,,,,,,,,]; | ||
|
||
Array.prototype.constructor = { | ||
[Symbol.species]: function() { | ||
return a0; | ||
} | ||
} | ||
|
||
var a1 = [1,2,3,4]; | ||
var a2 = a1.concat(a0); | ||
|
||
assertEqual(a0, a2); | ||
assertEqual(a0, "1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters