Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r228727 - [FTL] Support ArrayPop for ArrayStorage
https://bugs.webkit.org/show_bug.cgi?id=182783 Reviewed by Saam Barati. JSTests: * stress/array-pop-array-storage.js: Added. (shouldBe): (test): Source/JavaScriptCore: This patch adds ArrayPop(ArrayStorage) support to FTL. We port the implementation in DFG to FTL. * ftl/FTLAbstractHeapRepository.h: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileArrayPop):
- Loading branch information
1 parent
08abb10
commit 6d62173
Showing
6 changed files
with
136 additions
and
1 deletion.
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,65 @@ | ||
function shouldBe(actual, expected) { | ||
if (actual !== expected) | ||
throw new Error('bad value: ' + actual); | ||
} | ||
|
||
function test(array) { | ||
return [array.pop(), array.pop(), array.pop(), array.pop()]; | ||
} | ||
|
||
noInline(test); | ||
|
||
for (var i = 0; i < 1e4; ++i) { | ||
var array = ["foo", "bar", "baz"]; | ||
ensureArrayStorage(array); | ||
var result = test(array); | ||
shouldBe(result[0], "baz"); | ||
shouldBe(result[1], "bar"); | ||
shouldBe(result[2], "foo"); | ||
shouldBe(result[3], undefined); | ||
shouldBe(array.length, 0); | ||
} | ||
|
||
for (var i = 0; i < 1e4; ++i) { | ||
var array = ["foo", "bar", , "baz"]; | ||
ensureArrayStorage(array); | ||
var result = test(array); | ||
shouldBe(result[0], "baz"); | ||
shouldBe(result[1], undefined); | ||
shouldBe(result[2], "bar"); | ||
shouldBe(result[3], "foo"); | ||
shouldBe(array.length, 0); | ||
} | ||
|
||
for (var i = 0; i < 1e4; ++i) { | ||
var array = ["foo", "bar", , "baz", , , "OK"]; | ||
ensureArrayStorage(array); | ||
shouldBe(array.length, 7); | ||
var result = test(array); | ||
shouldBe(result[0], "OK"); | ||
shouldBe(result[1], undefined); | ||
shouldBe(result[2], undefined); | ||
shouldBe(result[3], "baz"); | ||
shouldBe(array.length, 3); | ||
shouldBe(array[0], "foo"); | ||
shouldBe(array[1], "bar"); | ||
shouldBe(array[2], undefined); | ||
shouldBe(array[3], undefined); | ||
} | ||
|
||
for (var i = 0; i < 1e4; ++i) { | ||
var array = ["foo", "bar", "baz"]; | ||
ensureArrayStorage(array); | ||
array.length = 0xffffffff - 1; | ||
shouldBe(array.length, 0xffffffff - 1); | ||
var result = test(array); | ||
shouldBe(result[0], undefined); | ||
shouldBe(result[1], undefined); | ||
shouldBe(result[2], undefined); | ||
shouldBe(result[3], undefined); | ||
shouldBe(array.length, 0xffffffff - 5); | ||
shouldBe(array[0], "foo"); | ||
shouldBe(array[1], "bar"); | ||
shouldBe(array[2], "baz"); | ||
shouldBe(array[3], undefined); | ||
} |
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
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