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

« back to all changes in this revision

Viewing changes to tools/eliminator/asm-eliminator-test.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 asm(x, y) {
 
2
  x = +x;
 
3
  y = y|0;
 
4
  var a = 0, b = +0, c = 0;
 
5
  var label = 0;
 
6
  a = cheez((y+~~x)|0)|0;
 
7
  b = a*a;
 
8
  fleefl(b|0, a|0);
 
9
}
 
10
function __Z11printResultPiS_j($needle, $haystack, $len) {
 
11
  $needle = $needle | 0;
 
12
  $haystack = $haystack | 0;
 
13
  $len = $len | 0;
 
14
  var $1 = 0, $2 = 0, $3 = 0, $4 = 0, $puts = 0, $7 = 0, $8 = 0, $9 = 0;
 
15
  var label = 0;
 
16
  var __stackBase__ = 0;
 
17
  __stackBase__ = STACKTOP;
 
18
  $1 = $needle;
 
19
  $2 = $haystack;
 
20
  $3 = _bsearch($1, $2, $len, 4, 2);
 
21
  $4 = ($3 | 0) == 0;
 
22
  if ($4) {
 
23
    $puts = _puts(_str | 0);
 
24
    STACKTOP = __stackBase__;
 
25
    return;
 
26
  } else {
 
27
    $7 = $3;
 
28
    $8 = HEAP32[($7 & 16777215) >> 2] | 0;
 
29
    $9 = _printf(__str1 | 0, (tempInt = STACKTOP, STACKTOP = STACKTOP + 4 | 0, HEAP32[(tempInt & 16777215) >> 2] = $8, tempInt));
 
30
    STACKTOP = __stackBase__;
 
31
    return;
 
32
  }
 
33
}
 
34
function _segment_holding($addr) {
 
35
  $addr = $addr | 0;
 
36
  var $sp_0 = 0, $2 = 0, $3 = 0, $4 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0;
 
37
  var $11 = 0, $12 = 0, $13 = 0, $_0 = 0;
 
38
  var label = 0;
 
39
  $sp_0 = __gm_ + 444 | 0;
 
40
  while (1) {
 
41
    $2 = $sp_0 | 0;
 
42
    $3 = HEAP32[($2 & 16777215) >> 2] | 0;
 
43
    $4 = $3 >>> 0 > $addr >>> 0;
 
44
    if (!$4) {
 
45
      $6 = $sp_0 + 4 | 0;
 
46
      $7 = HEAP32[($6 & 16777215) >> 2] | 0;
 
47
      $8 = $3 + $7 | 0;
 
48
      $9 = $8 >>> 0 > $addr >>> 0;
 
49
      if ($9) {
 
50
        $_0 = $sp_0;
 
51
        label = 1658;
 
52
        break;
 
53
      }
 
54
    }
 
55
    $11 = $sp_0 + 8 | 0;
 
56
    $12 = HEAP32[($11 & 16777215) >> 2] | 0;
 
57
    $13 = ($12 | 0) == 0;
 
58
    if ($13) {
 
59
      $_0 = 0;
 
60
      label = 1659;
 
61
      break;
 
62
    } else {
 
63
      $sp_0 = $12;
 
64
    }
 
65
  }
 
66
  if (label == 1659) {
 
67
    return $_0;
 
68
  } else if (label == 1658) {
 
69
    return $_0;
 
70
  }
 
71
}
 
72
function __ZN5identC2EiPKcPci($this, $n, $a) {
 
73
  $this = $this | 0;
 
74
  $n = $n | 0;
 
75
  $a = $a | 0;
 
76
  HEAP32[($this & 16777215) >> 2] = __ZTV5ident + 8 | 0;
 
77
  HEAP32[($this + 4 & 16777215) >> 2] = 5;
 
78
  HEAP32[($this + 8 & 16777215) >> 2] = $n;
 
79
  HEAP32[($this + 20 & 16777215) >> 2] = 2147483647;
 
80
  HEAP32[($this + 24 & 16777215) >> 2] = 0;
 
81
  HEAP32[($this + 28 & 16777215) >> 2] = $a;
 
82
  HEAP32[($this + 32 & 16777215) >> 2] = 0;
 
83
  HEAP32[($this + 40 & 16777215) >> 2] = 1;
 
84
  return;
 
85
}
 
86
function _vec2Length($this) {
 
87
  $this = $this | 0;
 
88
  var $__first_addr_i = 0, $__last_addr_i = 0, $__comp_addr_i = 0, $a13 = 0, $a14 = 0, $a18 = 0, $a19 = 0;
 
89
  var label = 0;
 
90
  var __stackBase__ = 0;
 
91
  __stackBase__ = STACKTOP;
 
92
  STACKTOP = STACKTOP + 8 | 0;
 
93
  $__first_addr_i = __stackBase__;
 
94
  $__last_addr_i = __stackBase__ + 4;
 
95
  $a13 = $__first_addr_i;
 
96
  $a14 = $__last_addr_i;
 
97
  $a18 = $__first_addr_i;
 
98
  $a19 = $__last_addr_i;
 
99
  STACKTOP = __stackBase__;
 
100
  return 0;
 
101
}
 
102
function exc($this) {
 
103
  $this = $this | 0;
 
104
  var $1 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $8 = +0, $9 = 0;
 
105
  var label = 0;
 
106
  var $1 = (function() {
 
107
    try {
 
108
      __THREW__ = false;
 
109
      return __ZNSt3__16locale8__globalEv();
 
110
    } catch (e) {
 
111
      if (typeof e != "number") throw e;
 
112
      if (ABORT) throw e;
 
113
      __THREW__ = true;
 
114
      Module.print("Exception: " + e + ", currently at: " + (new Error).stack);
 
115
      return null;
 
116
    }
 
117
  })();
 
118
  if (!__THREW__) {
 
119
    $3 = $this | 0;
 
120
    $4 = $1 | 0;
 
121
    $5 = HEAP32[($4 & 16777215) >> 2] | 0;
 
122
    HEAP32[($3 & 16777215) >> 2] = $5;
 
123
    $6 = $5 | 0;
 
124
    __ZNSt3__114__shared_count12__add_sharedEv($6);
 
125
    return;
 
126
  } else {
 
127
    $8$0 = ___cxa_find_matching_catch(HEAP32[(_llvm_eh_exception.buf & 16777215) >> 2] | 0, HEAP32[(_llvm_eh_exception.buf + 4 & 16777215) >> 2] | 0, []);
 
128
    $8$1 = tempRet0;
 
129
    $9 = $8$0;
 
130
    ___cxa_call_unexpected($9);
 
131
  }
 
132
}
 
133
function label() {
 
134
  var $1 = 0, $2 = 0;
 
135
  $1 = f();
 
136
  if ($1) {
 
137
    g();
 
138
  }
 
139
  $2 = h();
 
140
  L100: if ($2) {
 
141
    i();
 
142
  }
 
143
}
 
144
function switchy() {
 
145
  var no = 0, yes = 0;
 
146
  while (1) switch (label | 0) {
 
147
    case x:
 
148
      no = 100; // eliminatable in theory, but eliminator does not look into switch. must leave def above as well.
 
149
      break;
 
150
    case y:
 
151
      yes = 111;
 
152
      yes = yes*2;
 
153
      print(yes);
 
154
      yes--;
 
155
      print(yes/2);
 
156
      continue;
 
157
  }
 
158
}
 
159
// EMSCRIPTEN_GENERATED_FUNCTIONS: ["asm", "__Z11printResultPiS_j", "_segment_holding", "__ZN5identC2EiPKcPci", "_vec2Length", "exc", "label"]
 
160