| Index: test/webkit/dfg-arith-add-overflow-check-elimination-tower-of-large-numbers.js
|
| diff --git a/test/webkit/concat-while-having-a-bad-time.js b/test/webkit/dfg-arith-add-overflow-check-elimination-tower-of-large-numbers.js
|
| similarity index 51%
|
| copy from test/webkit/concat-while-having-a-bad-time.js
|
| copy to test/webkit/dfg-arith-add-overflow-check-elimination-tower-of-large-numbers.js
|
| index dfda1e08a0b36194b787a44ee12a9693acd8aeaf..292926eabad62caa883a82685c870493439490c8 100644
|
| --- a/test/webkit/concat-while-having-a-bad-time.js
|
| +++ b/test/webkit/dfg-arith-add-overflow-check-elimination-tower-of-large-numbers.js
|
| @@ -22,10 +22,39 @@
|
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| description(
|
| -"Tests the behavior of Array.prototype.concat while the array is having a bad time due to one of the elements we are concatenating."
|
| +"Tests that if we have a tower of large numerical constants being added to each other, the DFG knows that a sufficiently large tower may produce a large enough value that overflow check elimination must be careful."
|
| );
|
|
|
| -Object.defineProperty(Array.prototype, 0, { writable: false });
|
| -shouldBe("[42].concat()", "[42]");
|
| +function foo(a, b) {
|
| + return (a + b + 281474976710655 + 281474976710655 + 281474976710655 + 281474976710655 +
|
| + 281474976710655 + 281474976710655 + 281474976710655 + 281474976710655 +
|
| + 281474976710655 + 281474976710655 + 281474976710655 + 281474976710655 +
|
| + 281474976710655 + 281474976710655 + 281474976710655 + 281474976710655 +
|
| + 281474976710655 + 281474976710655 + 281474976710655 + 281474976710655 +
|
| + 281474976710655 + 281474976710655 + 281474976710655 + 281474976710655 +
|
| + 281474976710655 + 281474976710655 + 281474976710655 + 281474976710655 +
|
| + 281474976710655 + 281474976710655 + 281474976710655 + 281474976710655 + 30) | 0;
|
| +}
|
|
|
| +function bar(a, b, o) {
|
| + eval(""); // Prevent this function from being opt compiled.
|
| + return foo(a, b, o);
|
| +}
|
| +
|
| +var warmup = 200;
|
| +
|
| +for (var i = 0; i < warmup + 1; ++i) {
|
| + var a, b, c;
|
| + var expected;
|
| + if (i < warmup) {
|
| + a = 1;
|
| + b = 2;
|
| + expected = 0;
|
| + } else {
|
| + a = 2147483645;
|
| + b = 2147483644;
|
| + expected = -10;
|
| + }
|
| + shouldBe("bar(" + a + ", " + b + ")", "" + expected);
|
| +}
|
|
|
|
|