Chromium Code Reviews| Index: test/mjsunit/allocation-folding.js |
| diff --git a/test/mjsunit/allocation-folding.js b/test/mjsunit/allocation-folding.js |
| index fe5fa6d855e5894c2a3f136db2c14a3a865fbe40..f57de11d533f8137ff1ce9e6f8fb98b8af665c39 100644 |
| --- a/test/mjsunit/allocation-folding.js |
| +++ b/test/mjsunit/allocation-folding.js |
| @@ -56,7 +56,7 @@ function doubles() { |
| doubles(); doubles(); doubles(); |
| %OptimizeFunctionOnNextCall(doubles); |
| -var result = doubles(); |
| +result = doubles(); |
|
Michael Starzinger
2013/08/26 15:03:35
suggestion: If you properly scope each test in a s
|
| gc(); |
| @@ -72,8 +72,31 @@ function doubles_int() { |
| doubles_int(); doubles_int(); doubles_int(); |
| %OptimizeFunctionOnNextCall(doubles_int); |
| -var result = doubles_int(); |
| +result = doubles_int(); |
| gc(); |
| assertEquals(result[1], 3.1); |
| + |
| +// Test allocation folding of over a branch. |
|
Michael Starzinger
2013/08/26 15:03:35
nit: s/of//
|
| + |
| +function branch_int(left) { |
| + var elem1 = [1, 2]; |
| + var elem2; |
| + if (left) { |
| + elem2 = [3, 4]; |
| + } else { |
| + elem2 = [5, 6]; |
| + } |
| + return elem2; |
| +} |
| + |
| +branch_int(1); branch_int(1); branch_int(1); |
| +%OptimizeFunctionOnNextCall(branch_int); |
| +result = branch_int(1); |
| +var result2 = branch_int(0); |
| + |
| +gc(); |
| + |
| +assertEquals(result[1], 4); |
| +assertEquals(result2[1], 6); |