Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r228421 - Support GetArrayLength on ArrayStorage in the FTL
https://bugs.webkit.org/show_bug.cgi?id=182625 Reviewed by Saam Barati. JSTests: * stress/array-storage-length.js: Added. (shouldBe): (testInBound): (testUncountable): (testSlowPutInBound): (testSlowPutUncountable): * stress/undecided-length.js: Added. (shouldBe): (test2): Source/JavaScriptCore: This patch adds GetArrayLength and CheckArray + ArrayStorage & SlowPutArrayStorage support for FTL. The implementation is trivial; just porting one in DFG to FTL. This fixes several FTL compilation failures in web-tooling-benchmarks while we still need to support ArrayPush, ArrayPop, Arrayify, and PutByVal. * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::checkArray): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileGetArrayLength): (JSC::FTL::DFG::LowerDFGToB3::isArrayTypeForArrayify): (JSC::FTL::DFG::LowerDFGToB3::isArrayTypeForCheckArray):
- Loading branch information
1 parent
fbd872c
commit b1a973e
Showing
7 changed files
with
145 additions
and
18 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,60 @@ | ||
'use strict'; | ||
|
||
function shouldBe(actual, expected) { | ||
if (actual !== expected) | ||
throw new Error('bad value: ' + actual); | ||
} | ||
|
||
var object = { a: 10 }; | ||
Object.defineProperties(object, { | ||
"0": { | ||
get: function() { return this.a; }, | ||
set: function(x) { this.a = x; }, | ||
}, | ||
}); | ||
|
||
var array = [ 0, 1, 2, 3, 4, 5 ]; | ||
ensureArrayStorage(array); | ||
|
||
function testInBound(array) | ||
{ | ||
return array.length; | ||
} | ||
noInline(testInBound); | ||
for (var i = 0; i < 1e5; ++i) | ||
shouldBe(testInBound(array), 6); | ||
|
||
function testUncountable(array) | ||
{ | ||
return array.length; | ||
} | ||
noInline(testUncountable); | ||
for (var i = 0; i < 1e5; ++i) | ||
shouldBe(testUncountable(array), 6); | ||
array.length = 0xffffffff - 1; | ||
for (var i = 0; i < 1e5; ++i) | ||
shouldBe(testUncountable(array), 0xffffffff - 1); | ||
|
||
|
||
var slowPutArray = [ 0, 1, 2, 3, 4, 5 ]; | ||
ensureArrayStorage(slowPutArray); | ||
slowPutArray.__proto__ = object; | ||
|
||
function testSlowPutInBound(array) | ||
{ | ||
return array.length; | ||
} | ||
noInline(testSlowPutInBound); | ||
for (var i = 0; i < 1e5; ++i) | ||
shouldBe(testSlowPutInBound(slowPutArray), 6); | ||
|
||
function testSlowPutUncountable(array) | ||
{ | ||
return array.length; | ||
} | ||
noInline(testSlowPutUncountable); | ||
for (var i = 0; i < 1e5; ++i) | ||
shouldBe(testSlowPutUncountable(slowPutArray), 6); | ||
slowPutArray.length = 0xffffffff - 1; | ||
for (var i = 0; i < 1e5; ++i) | ||
shouldBe(testSlowPutUncountable(slowPutArray), 0xffffffff - 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
function shouldBe(actual, expected) { | ||
if (actual !== expected) | ||
throw new Error('bad value: ' + actual); | ||
} | ||
|
||
var array = []; | ||
|
||
function test1(array) | ||
{ | ||
return array.length; | ||
} | ||
noInline(test1); | ||
for (var i = 0; i < 1e5; ++i) | ||
shouldBe(test1(array), 0); | ||
|
||
var array = []; | ||
array.ok = 42; | ||
|
||
function test2(array) | ||
{ | ||
return array.length; | ||
} | ||
noInline(test2); | ||
for (var i = 0; i < 1e5; ++i) | ||
shouldBe(test2(array), 0); |
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