fpizlo@apple.com | 152abff | 2012-06-19 23:10:12 +0000 | [diff] [blame] | 1 | description( |
| 2 | "Tests what happens if we fail to constant fold a LogicalNot that leads into a branch, when the CFA proves that the LogicalNot has a constant value." |
| 3 | ); |
| 4 | |
| 5 | function foo1(o) { |
| 6 | if (!!o.thingy) |
| 7 | return o.thingy(42); |
| 8 | else |
| 9 | return o.otherThingy(57); |
| 10 | } |
| 11 | |
| 12 | function foo2(o) { |
| 13 | if (!o.thingy) |
| 14 | return o.otherThingy(42); |
| 15 | else |
| 16 | return o.thingy(57); |
| 17 | } |
| 18 | |
| 19 | function Stuff() { |
| 20 | } |
| 21 | |
| 22 | Stuff.prototype = { |
| 23 | thingy: function(x) { return x + 1; }, |
| 24 | otherThingy: function(x) { return x - 1; } |
| 25 | }; |
| 26 | |
fpizlo@apple.com | 0fa8386 | 2013-09-06 19:01:21 +0000 | [diff] [blame] | 27 | dfgShouldBe(foo1, "foo1(new Stuff())", "43"); |
| 28 | dfgShouldBe(foo2, "foo2(new Stuff())", "58"); |