js/src/jit-test/tests/bug830943.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial