blob: 7e97b34f327351e5da6893552a3e7fea30c1c675 [file] [log] [blame]
cwzwarich@webkit.orgf3ff2732008-07-01 01:56:16 +00001description(
2"Tests whether peephole optimizations on bytecode properly deal with local registers."
3);
4
5function if_less_test()
6{
7 var a = 0;
8 var b = 2;
9 if (a = 1 < 2)
10 return a == 1;
11}
12
13shouldBeTrue("if_less_test()");
14
15function if_else_less_test()
16{
17 var a = 0;
18 var b = 2;
19 if (a = 1 < 2)
20 return a == 1;
21 else
22 return false;
23}
24
25shouldBeTrue("if_else_less_test()");
26
27function conditional_less_test()
28{
29 var a = 0;
30 var b = 2;
31 return (a = 1 < 2) ? a == 1 : false;
32}
33
34shouldBeTrue("conditional_less_test()");
35
36function logical_and_less_test()
37{
38 var a = 0;
39 var b = 2;
40 return (a = 1 < 2) && a == 1;
41}
42
43shouldBeTrue("logical_and_less_test()");
44
45function logical_or_less_test()
46{
47 var a = 0;
48 var b = 2;
49 var result = (a = 1 < 2) || a == 1;
50 return a == 1;
51}
52
53shouldBeTrue("logical_or_less_test()");
54
55function do_while_less_test()
56{
57 var a = 0;
58 var count = 0;
59 do {
60 if (count == 1)
61 return a == 1;
62 count++;
63 } while (a = 1 < 2)
64}
65
66shouldBeTrue("do_while_less_test()");
67
68function while_less_test()
69{
70 var a = 0;
71 while (a = 1 < 2)
72 return a == 1;
73}
74
75shouldBeTrue("while_less_test()");
76
77function for_less_test()
78{
79 for (var a = 0; a = 1 < 2; )
80 return a == 1;
81}
82
83shouldBeTrue("for_less_test()");