Index: test/mjsunit/compiler/dead-code5.js |
diff --git a/test/mjsunit/keyed-storage-extend.js b/test/mjsunit/compiler/dead-code5.js |
similarity index 60% |
copy from test/mjsunit/keyed-storage-extend.js |
copy to test/mjsunit/compiler/dead-code5.js |
index d7e157b84654063ba39a4f6795bf045ae0c92284..834fa24f0e55cbbc891a9e436594c03d4a3d452f 100644 |
--- a/test/mjsunit/keyed-storage-extend.js |
+++ b/test/mjsunit/compiler/dead-code5.js |
@@ -25,31 +25,65 @@ |
// (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 F() { } |
- |
-function GrowNamed(o) { |
- o.a = 1; |
- o.b = 2; |
- o.c = 3; |
- o.d = 4; |
- o.e = 5; |
- o.f = 6; |
+function dead1(a, b) { |
+ a * b; |
+ a << b; |
+ a >> b; |
+ a >>> b; |
+ a | b; |
+ a & b; |
+ a ^ b; |
+ return a; |
} |
-function GrowKeyed(o) { |
- var names = ['a','b','c','d','e','f']; |
- var i = 0; |
- o[names[i++]] = i; |
- o[names[i++]] = i; |
- o[names[i++]] = i; |
- o[names[i++]] = i; |
- o[names[i++]] = i; |
- o[names[i++]] = i; |
+function dead2(a, b) { |
+ (a | 0) * b; |
+ (a | 0) << b; |
+ (a | 0) >> b; |
+ (a | 0) >>> b; |
+ (a | 0) | b; |
+ (a | 0) & b; |
+ (a | 0) ^ b; |
+ return a; |
} |
-GrowNamed(new F()); |
-GrowNamed(new F()); |
-GrowNamed(new F()); |
-GrowKeyed(new F()); |
-GrowKeyed(new F()); |
-GrowKeyed(new F()); |
+function dead3(a, b) { |
+ a == 2 ? (a * b) : (b * a); // dead |
+ return a; |
+} |
+ |
+function dead4(a) { |
+ var z = 3; |
+ for (i = 0; i < 3; i++) { |
+ z * 3; // dead |
+ } |
+ return a; |
+} |
+ |
+function dead5(a) { |
+ var z = 3; |
+ for (i = 0; i < 3; i++) { |
+ z * 3; // dead |
+ z++; |
+ } |
+ var w = z * a; |
+ return a; // w is dead |
+} |
+ |
+assertTrue(dead1(33, 32) == 33); |
+assertTrue(dead2(33, 32) == 33); |
+assertTrue(dead3(33, 32) == 33); |
+assertTrue(dead4(33) == 33); |
+assertTrue(dead5(33) == 33); |
+ |
+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); |