| Index: test/webkit/dfg-integer-optimization.js
|
| diff --git a/test/webkit/concat-while-having-a-bad-time.js b/test/webkit/dfg-integer-optimization.js
|
| similarity index 60%
|
| copy from test/webkit/concat-while-having-a-bad-time.js
|
| copy to test/webkit/dfg-integer-optimization.js
|
| index dfda1e08a0b36194b787a44ee12a9693acd8aeaf..31ec8fce4f0e5fb9a1346b356a6666d63e21138e 100644
|
| --- a/test/webkit/concat-while-having-a-bad-time.js
|
| +++ b/test/webkit/dfg-integer-optimization.js
|
| @@ -22,10 +22,25 @@
|
| // 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."
|
| +"This tests that integer addition optimizations in the DFG are not performed too overzealously."
|
| );
|
|
|
| -Object.defineProperty(Array.prototype, 0, { writable: false });
|
| -shouldBe("[42].concat()", "[42]");
|
| +function doAdd(a,b) {
|
| + // The point of this test is to see if the DFG CSE's the second (a + b) against the first, after
|
| + // optimizing the first to be an integer addition. The first one certainly is an integer addition,
|
| + // but the second one isn't - it must either be an integer addition with overflow checking, or a
|
| + // double addition.
|
| + return {a:((a + b) | 0), b:(a + b)};
|
| +}
|
|
|
| +for (var i = 0; i < 1000; ++i) {
|
| + // Create numbers big enough that we'll start seeing doubles only after about 200 invocations.
|
| + var a = i * 1000 * 1000 * 10;
|
| + var b = i * 1000 * 1000 * 10 + 1;
|
| + var result = doAdd(a, b);
|
| +
|
| + // Use eval() for computing the correct result, to force execution to happen outside the DFG.
|
| + shouldBe("result.a", "" + eval("((" + a + " + " + b + ") | 0)"))
|
| + shouldBe("result.b", "" + eval(a + " + " + b))
|
| +}
|
|
|
|
|