~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to src/relooper/test.cpp

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-09-20 22:44:35 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130920224435-apuwj4fsl3fqv1a6
Tags: 1.5.6~20130920~6010666-1
* New snapshot release
* Update the list of supported architectures to the same as libv8
  (Closes: #723129)
* emlibtool has been removed from upstream.
* Fix warning syntax-error-in-dep5-copyright
* Refresh of the patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
  if (1) {
8
8
    Relooper::SetOutputBuffer(buffer, sizeof(buffer));
9
9
 
10
 
    printf("\n\n-- If pattern --\n\n");
 
10
    printf("\n\n-- If pattern --\n\n", "the_var");
11
11
 
12
 
    Block *b_a = new Block("// block A\n");
13
 
    Block *b_b = new Block("// block B\n");
14
 
    Block *b_c = new Block("// block C\n");
 
12
    Block *b_a = new Block("// block A\n", "the_var");
 
13
    Block *b_b = new Block("// block B\n", "the_var");
 
14
    Block *b_c = new Block("// block C\n", "the_var");
15
15
 
16
16
    b_a->AddBranchTo(b_b, "check == 10", "atob();");
17
17
    b_a->AddBranchTo(b_c, NULL, "atoc();");
24
24
    r.AddBlock(b_c);
25
25
 
26
26
    r.Calculate(b_a);
27
 
    printf("\n\n");
 
27
    printf("\n\n", "the_var");
28
28
    r.Render();
29
29
 
30
30
    puts(buffer);
33
33
  if (1) {
34
34
    Relooper::SetOutputBuffer(buffer, sizeof(buffer));
35
35
 
36
 
    printf("\n\n-- If-else pattern --\n\n");
 
36
    printf("\n\n-- If-else pattern --\n\n", "the_var");
37
37
 
38
 
    Block *b_a = new Block("// block A\n");
39
 
    Block *b_b = new Block("// block B\n");
40
 
    Block *b_c = new Block("// block C\n");
41
 
    Block *b_d = new Block("// block D\n");
 
38
    Block *b_a = new Block("// block A\n", "the_var");
 
39
    Block *b_b = new Block("// block B\n", "the_var");
 
40
    Block *b_c = new Block("// block C\n", "the_var");
 
41
    Block *b_d = new Block("// block D\n", "the_var");
42
42
 
43
43
    b_a->AddBranchTo(b_b, "check == 15");
44
44
    b_a->AddBranchTo(b_c, NULL);
54
54
    r.AddBlock(b_d);
55
55
 
56
56
    r.Calculate(b_a);
57
 
    printf("\n\n");
 
57
    printf("\n\n", "the_var");
58
58
    r.Render();
59
59
 
60
60
    puts(buffer);
63
63
  if (1) {
64
64
    Relooper::SetOutputBuffer(buffer, sizeof(buffer));
65
65
 
66
 
    printf("\n\n-- Loop + tail pattern --\n\n");
 
66
    printf("\n\n-- Loop + tail pattern --\n\n", "the_var");
67
67
 
68
 
    Block *b_a = new Block("// block A\nvar check = maybe();\n");
69
 
    Block *b_b = new Block("// block B\n");
70
 
    Block *b_c = new Block("// block C\n");
 
68
    Block *b_a = new Block("// block A\nvar check = maybe();\n", "the_var");
 
69
    Block *b_b = new Block("// block B\n", "the_var");
 
70
    Block *b_c = new Block("// block C\n", "the_var");
71
71
 
72
72
    b_a->AddBranchTo(b_b, NULL);
73
73
 
80
80
    r.AddBlock(b_c);
81
81
 
82
82
    r.Calculate(b_a);
83
 
    printf("\n\n");
 
83
    printf("\n\n", "the_var");
84
84
    r.Render();
85
85
 
86
86
    puts(buffer);
89
89
  if (1) {
90
90
    Relooper::SetOutputBuffer(buffer, sizeof(buffer));
91
91
 
92
 
    printf("\n\n-- Loop with phi to head \n\n");
 
92
    printf("\n\n-- Loop with phi to head \n\n", "the_var");
93
93
 
94
94
    void *block_map[10000];
95
95
    void *rl = rl_new_relooper();
96
 
    void *b1 = rl_new_block("// code 1");
 
96
    void *b1 = rl_new_block("// code 1", "the_var");
97
97
    block_map[1] = b1;
98
98
    rl_relooper_add_block(rl, block_map[1]);
99
 
    void *b2 = rl_new_block("// code 2");
 
99
    void *b2 = rl_new_block("// code 2", "the_var");
100
100
    block_map[2] = b2;
101
101
    rl_relooper_add_block(rl, block_map[2]);
102
 
    void *b3 = rl_new_block("// code 3");
 
102
    void *b3 = rl_new_block("// code 3", "the_var");
103
103
    block_map[3] = b3;
104
104
    rl_relooper_add_block(rl, block_map[3]);
105
 
    void *b4 = rl_new_block("// code 4");
 
105
    void *b4 = rl_new_block("// code 4", "the_var");
106
106
    block_map[4] = b4;
107
107
    rl_relooper_add_block(rl, block_map[4]);
108
 
    void *b5 = rl_new_block("// code 5");
 
108
    void *b5 = rl_new_block("// code 5", "the_var");
109
109
    block_map[5] = b5;
110
110
    rl_relooper_add_block(rl, block_map[5]);
111
 
    void *b6 = rl_new_block("// code 6");
 
111
    void *b6 = rl_new_block("// code 6", "the_var");
112
112
    block_map[6] = b6;
113
113
    rl_relooper_add_block(rl, block_map[6]);
114
 
    void *b7 = rl_new_block("// code 7");
 
114
    void *b7 = rl_new_block("// code 7", "the_var");
115
115
    block_map[7] = b7;
116
116
    rl_relooper_add_block(rl, block_map[7]);
117
117
    rl_block_add_branch_to(block_map[1], block_map[2], NULL, "var $i_0 = 0;var $x_0 = 5; ");
132
132
  if (1) {
133
133
    Relooper::SetOutputBuffer(buffer, sizeof(buffer));
134
134
 
135
 
    printf("\n\n-- phi on split dead ends --\n\n");
 
135
    printf("\n\n-- phi on split dead ends --\n\n", "the_var");
136
136
 
137
 
    Block *b_a = new Block("// block A...................................................................................................\n");
138
 
    Block *b_b = new Block("// block B...................................................................................................\n");
139
 
    Block *b_c = new Block("// block C...................................................................................................\n");
140
 
    Block *b_d = new Block("// block D\n"); // small and splittable!
141
 
    Block *b_e = new Block("// block E\n");
 
137
    Block *b_a = new Block("// block A...................................................................................................\n", "the_var");
 
138
    Block *b_b = new Block("// block B...................................................................................................\n", "the_var");
 
139
    Block *b_c = new Block("// block C...................................................................................................\n", "the_var");
 
140
    Block *b_d = new Block("// block D\n", "the_var"); // small and splittable!
 
141
    Block *b_e = new Block("// block E\n", "the_var");
142
142
 
143
143
    b_a->AddBranchTo(b_b, "chak()", "atob();");
144
144
    b_a->AddBranchTo(b_c, NULL, "atoc();");
155
155
    r.AddBlock(b_e);
156
156
 
157
157
    r.Calculate(b_a);
158
 
    printf("\n\n");
 
158
    printf("\n\n", "the_var");
159
159
    r.Render();
160
160
 
161
161
    puts(buffer);
164
164
  if (1) {
165
165
    Relooper::SetOutputBuffer(buffer, sizeof(buffer));
166
166
 
167
 
    printf("\n\n-- Unbalanced with a dead end --\n\n");
 
167
    printf("\n\n-- Unbalanced with a dead end --\n\n", "the_var");
168
168
 
169
 
    Block *b_a = new Block("// block A\n");
170
 
    Block *b_b = new Block("// block B\n");
171
 
    Block *b_c = new Block("return C;\n");
172
 
    Block *b_d = new Block("// block D\n");
 
169
    Block *b_a = new Block("// block A\n", "the_var");
 
170
    Block *b_b = new Block("// block B\n", "the_var");
 
171
    Block *b_c = new Block("return C;\n", "the_var");
 
172
    Block *b_d = new Block("// block D\n", "the_var");
173
173
 
174
174
    b_a->AddBranchTo(b_b, "check == 10");
175
175
    b_a->AddBranchTo(b_c, NULL); // c is a dead end
185
185
    r.AddBlock(b_d);
186
186
 
187
187
    r.Calculate(b_a);
188
 
    printf("\n\n");
 
188
    printf("\n\n", "the_var");
189
189
    r.Render();
190
190
 
191
191
    puts(buffer);
194
194
  if (1) {
195
195
    Relooper::SetOutputBuffer(buffer, sizeof(buffer));
196
196
 
197
 
    printf("\n\n-- if (expensive || expensive2) X else Y; Z --\n\n");
 
197
    printf("\n\n-- if (expensive || expensive2) X else Y; Z --\n\n", "the_var");
198
198
 
199
 
    Block *b_a = new Block("// block A\n");
200
 
    Block *b_b = new Block("// block B\n");
201
 
    Block *b_c = new Block("// block C;\n");
202
 
    Block *b_d = new Block("// block D\n");
203
 
    Block *b_e = new Block("// block E\n");
204
 
    Block *b_f = new Block("// block F\n");
 
199
    Block *b_a = new Block("// block A\n", "the_var");
 
200
    Block *b_b = new Block("// block B\n", "the_var");
 
201
    Block *b_c = new Block("// block C;\n", "the_var");
 
202
    Block *b_d = new Block("// block D\n", "the_var");
 
203
    Block *b_e = new Block("// block E\n", "the_var");
 
204
    Block *b_f = new Block("// block F\n", "the_var");
205
205
 
206
206
    b_a->AddBranchTo(b_c, "expensive()");
207
207
    b_a->AddBranchTo(b_b, NULL);
226
226
    r.AddBlock(b_f);
227
227
 
228
228
    r.Calculate(b_a);
229
 
    printf("\n\n");
 
229
    printf("\n\n", "the_var");
230
230
    r.Render();
231
231
 
232
232
    puts(buffer);
235
235
  if (1) {
236
236
    Relooper::SetOutputBuffer(buffer, sizeof(buffer));
237
237
 
238
 
    printf("\n\n-- conditional loop --\n\n");
 
238
    printf("\n\n-- conditional loop --\n\n", "the_var");
239
239
 
240
 
    Block *b_a = new Block("// block A\n");
241
 
    Block *b_b = new Block("// block B\n");
242
 
    Block *b_c = new Block("// block C\n");
 
240
    Block *b_a = new Block("// block A\n", "the_var");
 
241
    Block *b_b = new Block("// block B\n", "the_var");
 
242
    Block *b_c = new Block("// block C\n", "the_var");
243
243
 
244
244
    b_a->AddBranchTo(b_b, "shouldLoop()");
245
245
    b_a->AddBranchTo(b_c, NULL);
253
253
    r.AddBlock(b_c);
254
254
 
255
255
    r.Calculate(b_a);
256
 
    printf("\n\n");
 
256
    printf("\n\n", "the_var");
257
257
    r.Render();
258
258
 
259
259
    puts(buffer);