Debian Codegraph @

js/src/devtools/rootAnalysis/t/graph/source.cpp

raw
1 #define ANNOTATE(property) __attribute__((annotate(property)))
2
3 extern void GC() ANNOTATE("GC Call");
4
5 void GC() {
6 // If the implementation is too trivial, the function body won't be emitted at
7 // all.
8 asm("");
9 }
10
11 extern void g(int x);
12 extern void h(int x);
13
14 void f(int x) {
15 if (x % 3) {
16 GC();
17 g(x);
18 }
19 h(x);
20 }
21
22 void g(int x) {
23 if (x % 2) f(x);
24 h(x);
25 }
26
27 void h(int x) {
28 if (x) {
29 f(x - 1);
30 g(x - 1);
31 }
32 }
33
34 void leaf() { asm(""); }
35
36 void nonrecursive_root() {
37 leaf();
38 leaf();
39 GC();
40 }
41
42 void self_recursive(int x) {
43 if (x) self_recursive(x - 1);
44 }
45
46 // Set up the graph
47 //
48 // n1 <--> n2 n4 <--> n5
49 // \ /
50 // --> n3 <---------
51 // \
52 // ---> n6 --> n7 <---> n8 --> n9
53 //
54 // So recursive roots are one of (n1, n2) plus one of (n4, n5).
55 extern void n1(int x);
56 extern void n2(int x);
57 extern void n3(int x);
58 extern void n4(int x);
59 extern void n5(int x);
60 extern void n6(int x);
61 extern void n7(int x);
62 extern void n8(int x);
63 extern void n9(int x);
64
65 void n1(int x) { n2(x); }
66
67 void n2(int x) {
68 if (x) n1(x - 1);
69 n3(x);
70 }
71
72 void n4(int x) { n5(x); }
73
74 void n5(int x) {
75 if (x) n4(x - 1);
76 n3(x);
77 }
78
79 void n3(int x) { n6(x); }
80
81 void n6(int x) { n7(x); }
82
83 void n7(int x) { n8(x); }
84
85 void n8(int x) {
86 if (x) n7(x - 1);
87 n9(x);
88 }
89
90 void n9(int x) { asm(""); }