Index: test/webkit/dfg-dead-min-two-args.js |
diff --git a/test/webkit/concat-while-having-a-bad-time.js b/test/webkit/dfg-dead-min-two-args.js |
similarity index 61% |
copy from test/webkit/concat-while-having-a-bad-time.js |
copy to test/webkit/dfg-dead-min-two-args.js |
index dfda1e08a0b36194b787a44ee12a9693acd8aeaf..f723f43b3a1fe8b3c2e8e3e0f7fd82821ce4dcf0 100644 |
--- a/test/webkit/concat-while-having-a-bad-time.js |
+++ b/test/webkit/dfg-dead-min-two-args.js |
@@ -22,10 +22,49 @@ |
// 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 a dead use of Math.min(a,b) at least speculates that its arguments are indeed numbers." |
); |
-Object.defineProperty(Array.prototype, 0, { writable: false }); |
-shouldBe("[42].concat()", "[42]"); |
+function foo(a, b) { |
+ Math.min(a.f, b.f); |
+ return 100; |
+} |
+function bar(a, b) { |
+ Math.min(a.f, b.f); |
+ return 100; |
+} |
+ |
+var x = {f:42}; |
+var y = {f:43}; |
+var ok = null; |
+var expected = 42; |
+var empty = ""; |
+ |
+for (var i = 0; i < 200; ++i) { |
+ if (i == 150) { |
+ x = {f:{valueOf:function(){ ok = i; return 37; }}}; |
+ expected = 37; |
+ } |
+ var result = eval(empty + "foo(x, y)"); |
+ if (i >= 150) |
+ shouldBe("ok", "" + i); |
+ shouldBe("result", "100"); |
+} |
+ |
+x = {f:42}; |
+y = {f:43}; |
+ok = null; |
+expected = 42; |
+ |
+for (var i = 0; i < 200; ++i) { |
+ if (i == 150) { |
+ y = {f:{valueOf:function(){ ok = i; return 37; }}}; |
+ expected = 37; |
+ } |
+ var result = eval(empty + "bar(x, y)"); |
+ if (i >= 150) |
+ shouldBe("ok", "" + i); |
+ shouldBe("result", "100"); |
+} |