~ubuntu-branches/ubuntu/saucy/emscripten/saucy-proposed

« back to all changes in this revision

Viewing changes to tools/test-js-optimizer-regs.js

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function test() {
 
2
  var i = 0;
 
3
  f(i);
 
4
  i+=1;
 
5
  var j = i + 2;
 
6
  g(i, j);
 
7
  f(i);
 
8
  var i2 = cheez();
 
9
  var j2 = i2 + 2;
 
10
  g(j2, j2);
 
11
  var k1 = 200;
 
12
  var k2 = 203;
 
13
  var k3 = 205;
 
14
  var k4 = 208;
 
15
  c(k3);
 
16
  while (f()) {
 
17
    var apple = 5;
 
18
    var orange = 12;
 
19
    gg(apple, orange*2);
 
20
    var tangerine = 100;
 
21
    gg(tangerine, 20);
 
22
  }
 
23
  var ck = f(), ck2 = 100, ck3 = 1000, ck4 = 100000;
 
24
  f(ck());
 
25
}
 
26
function primes() {
 
27
  var label;
 
28
  var $curri_01 = 2;
 
29
  var $primes_02 = 0;
 
30
  $_$2 : while (1) {
 
31
    var $primes_02;
 
32
    var $curri_01;
 
33
    var $conv1 = $curri_01 | 0;
 
34
    var $call = _sqrtf($conv1);
 
35
    var $j_0 = 2;
 
36
    $_$4 : while (1) {
 
37
      var $j_0;
 
38
      var $conv = $j_0 | 0;
 
39
      var $cmp2 = $conv < $call;
 
40
      if (!$cmp2) {
 
41
        var $ok_0 = 1;
 
42
        break $_$4;
 
43
      }
 
44
      var $rem = ($curri_01 | 0) % ($j_0 | 0);
 
45
      var $cmp3 = ($rem | 0) == 0;
 
46
      if ($cmp3) {
 
47
        var $ok_0 = 0;
 
48
        break $_$4;
 
49
      }
 
50
      var $inc = $j_0 + 1 | 0;
 
51
      var $j_0 = $inc;
 
52
    }
 
53
    var $ok_0;
 
54
    var $inc5_primes_0 = $ok_0 + $primes_02 | 0;
 
55
    var $inc7 = $curri_01 + 1 | 0;
 
56
    var $cmp = ($inc5_primes_0 | 0) < 1e5;
 
57
    if ($cmp) {
 
58
      var $curri_01 = $inc7;
 
59
      var $primes_02 = $inc5_primes_0;
 
60
    } else {
 
61
      break $_$2;
 
62
    }
 
63
  }
 
64
  var $call8 = _printf(STRING_TABLE.__str | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = $curri_01, tempInt));
 
65
  return 1;
 
66
  return null;
 
67
}
 
68
function atomic() {
 
69
  var $x$s2;
 
70
  var __stackBase__ = STACKTOP;
 
71
  STACKTOP += 4;
 
72
  var $x$s2 = __stackBase__ >> 2;
 
73
  HEAP32[$x$s2] = 10;
 
74
  var $0 = (tempValue = HEAP32[$x$s2], HEAP32[$x$s2] == 10 && (HEAP32[$x$s2] = 7), tempValue);
 
75
  var $conv = ($0 | 0) == 10 & 1;
 
76
  var $2 = HEAP32[$x$s2];
 
77
  var $call = _printf(STRING_TABLE.__str | 0, (tempInt = STACKTOP, STACKTOP += 8, HEAP32[tempInt >> 2] = $2, HEAP32[tempInt + 4 >> 2] = $conv, tempInt));
 
78
  STACKTOP = __stackBase__;
 
79
  return 0;
 
80
  return null;
 
81
}
 
82
function fcntl_open() {
 
83
  var $1$s2;
 
84
  var $st_mode$s2;
 
85
  var __stackBase__ = STACKTOP;
 
86
  STACKTOP += 84;
 
87
  var $s = __stackBase__;
 
88
  var $nonexistent_name = __stackBase__ + 72;
 
89
  var $0 = $nonexistent_name | 0;
 
90
  for (var $$src = STRING_TABLE.__ZZ4mainE16nonexistent_name | 0, $$dest = $0, $$stop = $$src + 12; $$src < $$stop; $$src++, $$dest++) {
 
91
    HEAP8[$$dest] = HEAP8[$$src];
 
92
  }
 
93
  var $st_mode$s2 = ($s + 8 | 0) >> 2;
 
94
  var $1$s2 = $s >> 2; // critical variable, becomes r8
 
95
  var $arrayidx43 = $nonexistent_name + 9 | 0;
 
96
  var $arrayidx46 = $nonexistent_name + 10 | 0;
 
97
  var $i_04 = 0;
 
98
  while (1) {
 
99
    var $i_04;
 
100
    var $2 = HEAP32[__ZZ4mainE5modes + ($i_04 << 2) >> 2];
 
101
    var $or = $2 | 512;
 
102
    var $conv42 = $i_04 + 97 & 255;
 
103
    var $j_03 = 0;
 
104
    while (1) {
 
105
      var $j_03;
 
106
      var $flags_0 = ($j_03 & 1 | 0) == 0 ? $2 : $or;
 
107
      var $flags_0_or7 = ($j_03 & 2 | 0) == 0 ? $flags_0 : $flags_0 | 2048;
 
108
      var $flags_2 = ($j_03 & 4 | 0) == 0 ? $flags_0_or7 : $flags_0_or7 | 1024;
 
109
      var $flags_2_or17 = ($j_03 & 8 | 0) == 0 ? $flags_2 : $flags_2 | 8;
 
110
      var $call = _printf(STRING_TABLE.__str | 0, (tempInt = STACKTOP, STACKTOP += 8, HEAP32[tempInt >> 2] = $i_04, HEAP32[tempInt + 4 >> 2] = $j_03, tempInt));
 
111
      var $call19 = _open(STRING_TABLE.__str2 | 0, $flags_2_or17, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = 511, tempInt));
 
112
      var $conv = ($call19 | 0) != -1 & 1;
 
113
      var $call21 = _printf(STRING_TABLE.__str1 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = $conv, tempInt));
 
114
      var $call22 = ___errno();
 
115
      var $3 = HEAP32[$call22 >> 2];
 
116
      var $call23 = _printf(STRING_TABLE.__str3 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = $3, tempInt));
 
117
      var $call24 = _stat(STRING_TABLE.__str2 | 0, $s);
 
118
      var $and25 = HEAP32[$st_mode$s2] & -512;
 
119
      var $call26 = _printf(STRING_TABLE.__str4 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = $and25, tempInt));
 
120
      for (var $$dest = $1$s2, $$stop = $$dest + 18; $$dest < $$stop; $$dest++) {
 
121
        HEAP32[$$dest] = 0;
 
122
      }
 
123
      var $putchar = _putchar(10);
 
124
      var $call28 = ___errno();
 
125
      HEAP32[$call28 >> 2] = 0;
 
126
      var $call29 = _printf(STRING_TABLE.__str6 | 0, (tempInt = STACKTOP, STACKTOP += 8, HEAP32[tempInt >> 2] = $i_04, HEAP32[tempInt + 4 >> 2] = $j_03, tempInt));
 
127
      var $call30 = _open(STRING_TABLE.__str7 | 0, $flags_2_or17, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = 511, tempInt));
 
128
      var $conv32 = ($call30 | 0) != -1 & 1;
 
129
      var $call33 = _printf(STRING_TABLE.__str1 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = $conv32, tempInt));
 
130
      var $call34 = ___errno();
 
131
      var $5 = HEAP32[$call34 >> 2];
 
132
      var $call35 = _printf(STRING_TABLE.__str3 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = $5, tempInt));
 
133
      var $call36 = _stat(STRING_TABLE.__str7 | 0, $s);
 
134
      var $and38 = HEAP32[$st_mode$s2] & -512;
 
135
      var $call39 = _printf(STRING_TABLE.__str4 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = $and38, tempInt));
 
136
      for (var $$dest = $1$s2, $$stop = $$dest + 18; $$dest < $$stop; $$dest++) {
 
137
        HEAP32[$$dest] = 0;
 
138
      }
 
139
      var $putchar1 = _putchar(10);
 
140
      var $call41 = ___errno();
 
141
      HEAP32[$call41 >> 2] = 0;
 
142
      HEAP8[$arrayidx43] = $conv42;
 
143
      HEAP8[$arrayidx46] = $j_03 + 97 & 255;
 
144
      var $call47 = _printf(STRING_TABLE.__str8 | 0, (tempInt = STACKTOP, STACKTOP += 8, HEAP32[tempInt >> 2] = $i_04, HEAP32[tempInt + 4 >> 2] = $j_03, tempInt));
 
145
      var $call48 = _open($0, $flags_2_or17, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = 511, tempInt));
 
146
      var $conv50 = ($call48 | 0) != -1 & 1;
 
147
      var $call51 = _printf(STRING_TABLE.__str1 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = $conv50, tempInt));
 
148
      var $call52 = ___errno();
 
149
      var $7 = HEAP32[$call52 >> 2];
 
150
      var $call53 = _printf(STRING_TABLE.__str3 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = $7, tempInt));
 
151
      var $call55 = _stat($0, $s);
 
152
      var $and57 = HEAP32[$st_mode$s2] & -512;
 
153
      var $call58 = _printf(STRING_TABLE.__str4 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = $and57, tempInt));
 
154
      for (var $$dest = $1$s2, $$stop = $$dest + 18; $$dest < $$stop; $$dest++) {
 
155
        HEAP32[$$dest] = 0;
 
156
      }
 
157
      var $putchar2 = _putchar(10);
 
158
      var $call60 = ___errno();
 
159
      HEAP32[$call60 >> 2] = 0;
 
160
      var $inc = $j_03 + 1 | 0;
 
161
      if (($inc | 0) == 16) {
 
162
        break;
 
163
      }
 
164
      var $j_03 = $inc;
 
165
    }
 
166
    var $inc62 = $i_04 + 1 | 0;
 
167
    if (($inc62 | 0) == 3) {
 
168
      break;
 
169
    }
 
170
    var $i_04 = $inc62;
 
171
  }
 
172
  var $puts = _puts(STRING_TABLE._str | 0);
 
173
  var $call65 = _creat(STRING_TABLE.__str10 | 0, 511);
 
174
  var $conv67 = ($call65 | 0) != -1 & 1;
 
175
  var $call68 = _printf(STRING_TABLE.__str1 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = $conv67, tempInt));
 
176
  var $call69 = ___errno();
 
177
  var $9 = HEAP32[$call69 >> 2];
 
178
  var $call70 = _printf(STRING_TABLE.__str3 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = $9, tempInt));
 
179
  STACKTOP = __stackBase__;
 
180
  return 0;
 
181
  return null;
 
182
}
 
183
function ex() {
 
184
  var __stackBase__ = STACKTOP;
 
185
  STACKTOP += 4;
 
186
  var $e1 = __stackBase__;
 
187
  var $puts = _puts(STRING_TABLE._str17 | 0);
 
188
  var $x41 = $e1 | 0;
 
189
  var $i_04 = 0;
 
190
  while (1) {
 
191
    var $i_04;
 
192
    var $call1 = _printf(STRING_TABLE.__str15 | 0, (tempInt = STACKTOP, STACKTOP += 4, HEAP32[tempInt >> 2] = $i_04, tempInt));
 
193
    ((function() {
 
194
      try {
 
195
        __THREW__ = false;
 
196
        return __Z5magici($i_04);
 
197
      } catch (e) {
 
198
        if (typeof e != "number") throw e;
 
199
        if (ABORT) throw e;
 
200
        __THREW__ = true;
 
201
        return null;
 
202
      }
 
203
    }))();
 
204
  }
 
205
}
 
206
function switchey(x) {
 
207
  var a = 5;
 
208
  while (1) {
 
209
    switch (x = f(x, a)) {
 
210
      case 1:
 
211
        g(a);
 
212
        var b = x+1;
 
213
        x--;
 
214
        break;
 
215
      case 2:
 
216
        g(a*2);
 
217
        var c = x+22;
 
218
        var d = c+5;
 
219
        x -= 20;
 
220
        break;
 
221
      default:
 
222
        var c1 = x+22;
 
223
        var d2 = c+5;
 
224
        ch(c1, d2*c);
 
225
        throw 99;
 
226
    }
 
227
  }
 
228
  var aa = x+1;
 
229
  p(a, aa);
 
230
  var aaa = x+2;
 
231
  pp(aaa);
 
232
}
 
233
function __ZN14NetworkAddressC1EPKcti($this) {
 
234
  __ZN14NetworkAddressC2EPKcti($this);
 
235
  return;
 
236
}
 
237
// EMSCRIPTEN_GENERATED_FUNCTIONS: ["test", "primes", "atomic", "fcntl_open", "ex", "switchey", "__ZN14NetworkAddressC1EPKcti"]