summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/bug830943.js
blob: 8018001889f0efc2b6bda81e8085000053459762 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
// |jit-test| error: Assertion failed: bad label: 2
try {
    this['Module'] = Module;
} catch (e) {
    this['Module'] = Module = {};
}
var ENVIRONMENT_IS_NODE = typeof process === 'object' && typeof require === 'function';
var ENVIRONMENT_IS_WEB = typeof window === 'object';
var ENVIRONMENT_IS_WORKER = typeof importScripts === 'function';
var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
if (ENVIRONMENT_IS_SHELL) {
    Module['print'] = print;
    Module['arguments'] = [];
}
var Runtime = {
    alignMemory: function alignMemory(size, quantum) {},
}
    function SAFE_HEAP_CLEAR(dest) {
    }
    function SAFE_HEAP_STORE(dest, value, type, ignore) {
        setValue(dest, value, type, 1);
    }
    function SAFE_HEAP_LOAD(dest, type, unsigned, ignore) {
	try { } catch(e) {};
        var ret = getValue(dest, type, 1);
        return ret;
    };
    function SAFE_HEAP_LOAD1(dest, type) {
	return getValue(dest, type, 1);
    };
function abort(text) {
    Module.print(text + ':\n' + (new Error).stack);
    throw "Assertion: " + text;
}
function assert(condition, text) {
    if (!condition) {
        abort('Assertion failed: ' + text);
    }
}
function setValue(ptr, value, type, noSafe) {
    if (type.charAt(type.length - 1) === '*') type = 'i32'; // pointers are 32-bit
    if (noSafe) {
        switch (type) {
            case 'i32':
                HEAP32[((ptr) >> 2)] = value;
        }
    }
}
function getValue(ptr, type, noSafe) {
    if (type.charAt(type.length - 1) === '*') type = 'i32'; // pointers are 32-bit
    if (noSafe) {
        switch (type) {
            case 'i32':
                return HEAP32[((ptr) >> 2)];
        }
    }
}
var ALLOC_STATIC = 2; // Cannot be freed
function allocate(slab, types, allocator, ptr) {}
var TOTAL_MEMORY = Module['TOTAL_MEMORY'] || 16777216;
var buffer = new ArrayBuffer(TOTAL_MEMORY);
HEAP32 = new Int32Array(buffer);
STACK_ROOT = STACKTOP = Runtime.alignMemory(1);
function intArrayFromString(stringy, dontAddNull, length /* optional */ ) {}
function __ZN11btRigidBody14getMotionStateEv($this_0_20_val) {
}
function __ZN16btCollisionWorld23getCollisionObjectArrayEv($this) {}
function __ZN20btAlignedObjectArrayIP17btCollisionObjectEixEi($this_0_3_val, $n) {}
function _main($argc, $argv) {
    label = 2;
    while (1) switch (label) {
        case 2:
            var $31 = __Znwj(268);
            var $32 = $31;
            var $67 = __ZN17btCollisionObjectnwEj();
            var $68 = $67;
            __ZN23btDiscreteDynamicsWorld12addRigidBodyEP11btRigidBody($32, $68);
            var $99 = $31;
            var $104 = __ZN23btDiscreteDynamicsWorld14stepSimulationEfif($32, .01666666753590107, 10, .01666666753590107);
            var $106 = __ZNK16btCollisionWorld22getNumCollisionObjectsEv($99);
            var $108 = __ZN16btCollisionWorld23getCollisionObjectArrayEv($99);
            var $_idx6 = $108 + 12 | 0;
            var $j_049_in = $106;
            var $j_049 = $j_049_in - 1 | 0;
            var $_idx6_val = SAFE_HEAP_LOAD($_idx6, "%class.btCollisionObject**", 0, 0);
            var $109 = __ZN20btAlignedObjectArrayIP17btCollisionObjectEixEi($_idx6_val, $j_049);
            var $110 = SAFE_HEAP_LOAD($109, "%class.btCollisionObject*", 0, 0);
            var $111 = __ZN11btRigidBody6upcastEP17btCollisionObject($110);
            var $_idx9 = $111 + 472 | 0;
            var $_idx9_val = SAFE_HEAP_LOAD($_idx9, "%class.btMotionState*", 0, 0);
            var $114 = __ZN11btRigidBody14getMotionStateEv($_idx9_val);
            var $138 = $i_057 + 1 | 0;
            var $139 = ($138 | 0) < 135;
            if ($139) {
                var $i_057 = $138;
                break;
            }
            assert(0, "bad label: " + label);
    }
}
Module["_main"] = _main;
function __ZN17btCollisionObjectnwEj() {
    return __Z22btAlignedAllocInternalji(608);
}
function __ZNK16btCollisionWorld22getNumCollisionObjectsEv($this) {}
function __ZN11btRigidBody6upcastEP17btCollisionObject($colObj) {
    label = 2;
    while (1) switch (label) {
        case 2:
            var $_0;
            return $_0;
    }
}
function __ZNK9btVector33dotERKS_($this_0_0_0_val, $this_0_0_1_val, $this_0_0_2_val, $v_0_0_0_val, $v_0_0_1_val, $v_0_0_2_val) {
}
function __ZN20btAlignedObjectArrayIP11btRigidBodyEixEi($this_0_3_val, $n) {}
function __ZNK17btCollisionObject14getHitFractionEv($this_0_21_val) {}
function __ZN17btCollisionObject30getInterpolationWorldTransformEv($this) {}
function __ZNK17btCollisionObject30getInterpolationLinearVelocityEv($this) {}
function __ZNK17btCollisionObject31getInterpolationAngularVelocityEv($this) {}
function __ZN23btDiscreteDynamicsWorld28synchronizeSingleMotionStateEP11btRigidBody($this, $body) {
    assertEq($body, 16);
    var __stackBase__ = STACKTOP;
    while (1) switch (label) {
        case 2:
            var $interpolatedTransform = __stackBase__;
            var $4 = $body | 0;
            var $7 = __ZN17btCollisionObject30getInterpolationWorldTransformEv($4);
            var $8 = __ZNK17btCollisionObject30getInterpolationLinearVelocityEv($4);
            var $9 = __ZNK17btCollisionObject31getInterpolationAngularVelocityEv($4);
            var $10 = $this + 236 | 0;
            var $11 = SAFE_HEAP_LOAD($10, "float", 0, 0);
            var $_idx2 = $body + 240 | 0;
            var $_idx2_val = SAFE_HEAP_LOAD($_idx2, "float", 0, 0);
            var $12 = __ZNK17btCollisionObject14getHitFractionEv($_idx2_val);
            var $13 = $11 * $12;
            var $_idx3 = $8 | 0;
            var $_idx3_val = SAFE_HEAP_LOAD($_idx3, "float", 0, 0);
            var $_idx4 = $8 + 4 | 0;
            var $_idx4_val = SAFE_HEAP_LOAD($_idx4, "float", 0, 0);
            var $_idx5 = $8 + 8 | 0;
            var $_idx5_val = SAFE_HEAP_LOAD($_idx5, "float", 0, 0);
            __ZN15btTransformUtil18integrateTransformERK11btTransformRK9btVector3S5_fRS0_($7, $_idx3_val, $_idx4_val, $_idx5_val, $9, $13, $interpolatedTransform);
            return;
    }
}
function __ZN15btTransformUtil18integrateTransformERK11btTransformRK9btVector3S5_fRS0_($curTrans, $linvel_0_0_0_val, $linvel_0_0_1_val, $linvel_0_0_2_val, $angvel, $timeStep, $predictedTransform) {
    var __stackBase__ = STACKTOP;
    STACKTOP = STACKTOP + 132 | 0;
    while (1) {
	switch (label) {
        case 2:
            var $axis = __stackBase__ + 32;
            var $3 = __stackBase__ + 48;
            var $angvel_idx10 = $angvel | 0;
            var $angvel_idx10_val = SAFE_HEAP_LOAD($angvel_idx10, "float", 0, 0);
	    var $angvel_idx11 = $angvel + 4 | 0;
            var $angvel_idx11_val = SAFE_HEAP_LOAD($angvel_idx11, "float", 0, 0);
            var $angvel_idx12 = $angvel + 8 | 0;
            var $angvel_idx12_val = SAFE_HEAP_LOAD($angvel_idx12, "float", 0, 0);
            var $7 = __ZNK9btVector36lengthEv($angvel_idx10_val, $angvel_idx11_val, $angvel_idx12_val);
            var $8 = $7 * $timeStep;
            if ($8 > .7853981852531433) {} else {
                var $fAngle_0 = $7;
                label = 5;
            }
	    break;
        case 5:
            var $22 = $axis;
            var $23 = $3;
            SAFE_HEAP_STORE($22 + 12, SAFE_HEAP_LOAD1($23 + 12, "i32"), "i32", 0);
	    assertEq(SAFE_HEAP_LOAD1(0, "%class.btRigidBody*"), 16);
            label = 7;
            break;
        case 6:
            SAFE_HEAP_STORE($29 + 12, SAFE_HEAP_LOAD1($30 + 12, "i32"), "i32", 0);
        case 7:
            for (var i = __stackBase__; i < STACKTOP; i++) SAFE_HEAP_CLEAR(i);
            return;
	}
    }
}
function __ZN23btDiscreteDynamicsWorld12addRigidBodyEP11btRigidBody($this, $body) {
    SAFE_HEAP_STORE(STACKTOP, $body, "%class.btRigidBody*", 0);
    assertEq(SAFE_HEAP_LOAD(0, "%class.btRigidBody*", 0, 0), 16);
}
function __ZN23btDiscreteDynamicsWorld23synchronizeMotionStatesEv($this) {
    var $20 = SAFE_HEAP_LOAD(0, "%class.btRigidBody*", 0, 0);
    assertEq($20, 16);
    __ZN23btDiscreteDynamicsWorld28synchronizeSingleMotionStateEP11btRigidBody($this, $20);
}
function __ZN23btDiscreteDynamicsWorld14stepSimulationEfif($this, $timeStep, $maxSubSteps, $fixedTimeStep) {
    label = 2;
    while (1) switch (label) {
        case 2:
            var $numSimulationSubSteps_0;
            __ZN23btDiscreteDynamicsWorld23synchronizeMotionStatesEv($this);
            return $numSimulationSubSteps_0;
    }
}
function __ZNK9btVector37length2Ev($this_0_0_0_val, $this_0_0_1_val, $this_0_0_2_val) {
    return __ZNK9btVector33dotERKS_($this_0_0_0_val, $this_0_0_1_val, $this_0_0_2_val, $this_0_0_0_val, $this_0_0_1_val, $this_0_0_2_val);
}
function __Z6btSqrtf($y) {
    return Math.sqrt($y);
}
function __ZNK9btVector36lengthEv($this_0_0_0_val, $this_0_0_1_val, $this_0_0_2_val) {
    return __Z6btSqrtf(__ZNK9btVector37length2Ev($this_0_0_0_val, $this_0_0_1_val, $this_0_0_2_val));
}
function __ZL21btAlignedAllocDefaultji($size, $alignment) {
    while (1) switch (label) {
        case 2:
            var $1 = $size + 4 | 0;
            var $2 = $alignment - 1 | 0;
            var $3 = $1 + $2 | 0;
            var $4 = __ZL14btAllocDefaultj($3);
            var $7 = $4 + 4 | 0;
            var $8 = $7;
            var $9 = $alignment - $8 | 0;
            var $10 = $9 & $2;
            var $_sum = $10 + 4 | 0;
            var $11 = $4 + $_sum | 0;
            var $ret_0 = $11;
            return $ret_0;
    }
}
function __ZL14btAllocDefaultj($size) {
    return _malloc($size);
}
function __Z22btAlignedAllocInternalji($size) {
    return __ZL21btAlignedAllocDefaultji($size, 16);
}
function _malloc($bytes) {
    while (1) switch (label) {
        case 2:
            var $189 = SAFE_HEAP_LOAD(5244020, "%struct.malloc_chunk*", 0, 0);
            var $198 = $189 + 8 | 0;
            var $199 = $198;
            var $mem_0 = $199;
            return $mem_0;
    }
}
function __Znwj($size) {
    while (1) switch (label) {
        case 2:
            var $1 = ($size | 0) == 0;
            var $_size = $1 ? 1 : $size;
            var $3 = _malloc($_size);
            return $3;
    }
}
Module.callMain = function callMain(args) {
    var argc = args.length + 1;
    var argv = [allocate(intArrayFromString("/bin/this.program"), 'i8', ALLOC_STATIC)];
    return Module['_main'](argc, argv, 0);
}
function run(args) {
    args = args || Module['arguments'];
    function doRun() {
        if (Module['_main']) {
            ret = Module.callMain(args);
        }
    }
    if (Module['setStatus']) {} else {
        return doRun();
    }
}
run();