Index: test/mjsunit/compiler/dead-code2.js |
diff --git a/test/mjsunit/regress/regress-1114040.js b/test/mjsunit/compiler/dead-code2.js |
similarity index 60% |
copy from test/mjsunit/regress/regress-1114040.js |
copy to test/mjsunit/compiler/dead-code2.js |
index 9d1b320a9a298f36db0c9915687d48951f9e5450..b0580207edb8c1d3905fc20b88b4706905578420 100644 |
--- a/test/mjsunit/regress/regress-1114040.js |
+++ b/test/mjsunit/compiler/dead-code2.js |
@@ -25,34 +25,60 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-function TestBreak() { |
- var sequence = ""; |
- for (var a in [0,1]) { |
- L: { |
- for (var b in [2,3,4]) { |
- break L; |
- } |
+function dead1(a, b) { |
+ { var x = a + b; } |
+ return a; // x is dead |
+} |
+ |
+function dead2(a, b) { |
+ { var x = a | 0; var y = b | 0; } |
+ return a; // x and y are both dead |
+} |
+ |
+function dead3(a, b) { |
+ { |
+ var z; |
+ if(a == 2) z = a; |
+ else z = b; |
} |
- sequence += a; |
- } |
- return sequence; |
+ return a; // z is dead |
} |
+function dead4(a) { |
+ { |
+ var z = 3; |
+ for (i = 0; i < 3; i++) { |
+ z++; |
+ } |
+ } |
+ return a; // z is dead |
+} |
-function TestContinue() { |
- var sequence = ""; |
- for (var a in [0,1]) { |
- L: do { |
- for (var b in [2,3,4]) { |
- continue L; |
+function dead5(a) { |
+ { |
+ var z = 3; |
+ for (i = 0; i < 3; i++) { |
+ z++; |
} |
- } while (false); |
- sequence += a; |
- } |
- return sequence; |
+ var w = z + a; |
+ } |
+ return a; // z and w are dead |
} |
+assertTrue(dead1(33, 32) == 33); |
+assertTrue(dead2(33, 32) == 33); |
+assertTrue(dead3(33, 32) == 33); |
+assertTrue(dead4(33) == 33); |
+assertTrue(dead5(33) == 33); |
-assertEquals("01", TestBreak()); |
-assertEquals("01", TestContinue()); |
+assertTrue(dead1(34, 7) == 34); |
+assertTrue(dead2(34, 7) == 34); |
+assertTrue(dead3(34, 7) == 34); |
+assertTrue(dead4(34) == 34); |
+assertTrue(dead5(34) == 34); |
+assertTrue(dead1(3.4, 0.1) == 3.4); |
+assertTrue(dead2(3.4, 0.1) == 3.4); |
+assertTrue(dead3(3.4, 0.1) == 3.4); |
+assertTrue(dead4(3.4) == 3.4); |
+assertTrue(dead5(3.4) == 3.4); |