global statement removal: hphp/test [7/x]
[hiphop-php.git] / hphp / test / quick / asm_sswitch_slow.hhas
blob12c879edd536015a4bc700a3f6b8fe6c242bf1f9
1 # SSwitch with integer-like strings uses a different translator
2 # implementation.
4 .main {
5   FPushFuncD 0 "main"
6   FCall <> 0 1 "" - "" ""
7   RetC
10 .function get_three() {
11   String "3"
12   RetC
15 .function sswitch_on($foo) {
16   CGetL $foo
17   SSwitch <"1":label_1
18            "2":label_2
19            "3":label_3
20              -:fail>
22 label_1:
23   String "1\n"
24   Jmp done
26 label_2:
27   String "2\n"
28   Jmp done
30 label_3:
31   String "3\n"
33 done:
34   Print
35   RetC
37 fail:
38   String "default case\n"
39   Print
40   RetC
43 .function case_three() {
44   FPushFuncD 0 "get_three"
45   FCall <> 0 1 "" - "" ""
46   SetL $foo
47   PopC
49   FPushFuncD 1 "sswitch_on"
50   CGetL $foo
51   FCall <> 1 1 "" - "" ""
52   RetC
55 .class Obj {
56   .default_ctor;
57   .method [public] __toString() {
58     String "2"
59     RetC
60   }
63 .function with_obj() {
64   NewObjD "Obj"
65   Dup
66   FPushCtor 0
67   FCall <> 0 1 "" - "" ""
68   PopC
69   SetL $obj
70   PopC
72   FPushFuncD 1 "sswitch_on"
73   CGetL $obj
74   FCall <> 1 1 "" - "" ""
75   RetC
78 .function case_default() {
79   FPushFuncD 1 "sswitch_on"
80   String "kujhasekguheku"
81   FCall <> 1 1 "" - "" ""
82   RetC
85 .function main() {
86   FPushFuncD 0 "case_three"
87   FCall <> 0 1 "" - "" ""
88   PopC
90   FPushFuncD 0 "with_obj"
91   FCall <> 0 1 "" - "" ""
92   PopC
94   FPushFuncD 0 "case_default"
95   FCall <> 0 1 "" - "" ""
96   PopC
98   String "Done\n"
99   Print
100   RetC