OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --expose-wasm |
| 6 |
| 7 // /v8/test/mjsunit/regress/regress-crbug-431602.js |
| 8 // /v8/test/mjsunit/lazy-load.js |
| 9 // /v8/test/mjsunit/wasm/asm-wasm.js |
| 10 // /v8/test/mjsunit/debug-toggle-mirror-cache.js |
| 11 // /v8/test/mjsunit/debug-stack-check-position.js |
| 12 |
| 13 // Begin stripped down and modified version of mjsunit.js for easy minimization
in CF. |
| 14 function MjsUnitAssertionError(message) {} |
| 15 MjsUnitAssertionError.prototype.toString = function () { return this.message; }; |
| 16 var assertSame; |
| 17 var assertEquals; |
| 18 var assertEqualsDelta; |
| 19 var assertArrayEquals; |
| 20 var assertPropertiesEqual; |
| 21 var assertToStringEquals; |
| 22 var assertTrue; |
| 23 var assertFalse; |
| 24 var triggerAssertFalse; |
| 25 var assertNull; |
| 26 var assertNotNull; |
| 27 var assertThrows; |
| 28 var assertDoesNotThrow; |
| 29 var assertInstanceof; |
| 30 var assertUnreachable; |
| 31 var assertOptimized; |
| 32 var assertUnoptimized; |
| 33 function classOf(object) { var string = Object.prototype.toString.call(object);
return string.substring(8, string.length - 1); } |
| 34 function PrettyPrint(value) { return ""; } |
| 35 function PrettyPrintArrayElement(value, index, array) { return ""; } |
| 36 function fail(expectedText, found, name_opt) { } |
| 37 function deepObjectEquals(a, b) { var aProps = Object.keys(a); aProps.sort(); va
r bProps = Object.keys(b); bProps.sort(); if (!deepEquals(aProps, bProps)) { ret
urn false; } for (var i = 0; i < aProps.length; i++) { if (!deepEquals(a[aProps[
i]], b[aProps[i]])) { return false; } } return true; } |
| 38 function deepEquals(a, b) { if (a === b) { if (a === 0) return (1 / a) === (1 /
b); return true; } if (typeof a != typeof b) return false; if (typeof a == "numb
er") return isNaN(a) && isNaN(b); if (typeof a !== "object" && typeof a !== "fun
ction") return false; var objectClass = classOf(a); if (objectClass !== classOf(
b)) return false; if (objectClass === "RegExp") { return (a.toString() === b.toS
tring()); } if (objectClass === "Function") return false; if (objectClass === "A
rray") { var elementCount = 0; if (a.length != b.length) { return false; } for (
var i = 0; i < a.length; i++) { if (!deepEquals(a[i], b[i])) return false; } ret
urn true; } if (objectClass == "String" || objectClass == "Number" || objectClas
s == "Boolean" || objectClass == "Date") { if (a.valueOf() !== b.valueOf()) retu
rn false; } return deepObjectEquals(a, b); } |
| 39 assertSame = function assertSame(expected, found, name_opt) { if (found === expe
cted) { if (expected !== 0 || (1 / expected) == (1 / found)) return; } else if (
(expected !== expected) && (found !== found)) { return; } fail(PrettyPrint(expec
ted), found, name_opt); }; assertEquals = function assertEquals(expected, found,
name_opt) { if (!deepEquals(found, expected)) { fail(PrettyPrint(expected), fou
nd, name_opt); } }; |
| 40 assertEqualsDelta = function assertEqualsDelta(expected, found, delta, name_opt)
{ assertTrue(Math.abs(expected - found) <= delta, name_opt); }; |
| 41 assertArrayEquals = function assertArrayEquals(expected, found, name_opt) { var
start = ""; if (name_opt) { start = name_opt + " - "; } assertEquals(expected.le
ngth, found.length, start + "array length"); if (expected.length == found.length
) { for (var i = 0; i < expected.length; ++i) { assertEquals(expected[i], found[
i], start + "array element at index " + i); } } }; |
| 42 assertPropertiesEqual = function assertPropertiesEqual(expected, found, name_opt
) { if (!deepObjectEquals(expected, found)) { fail(expected, found, name_opt); }
}; |
| 43 assertToStringEquals = function assertToStringEquals(expected, found, name_opt)
{ if (expected != String(found)) { fail(expected, found, name_opt); } }; |
| 44 assertTrue = function assertTrue(value, name_opt) { assertEquals(true, value, na
me_opt); }; |
| 45 assertFalse = function assertFalse(value, name_opt) { assertEquals(false, value,
name_opt); }; |
| 46 assertNull = function assertNull(value, name_opt) { if (value !== null) { fail("
null", value, name_opt); } }; |
| 47 assertNotNull = function assertNotNull(value, name_opt) { if (value === null) {
fail("not null", value, name_opt); } }; |
| 48 assertThrows = function assertThrows(code, type_opt, cause_opt) { var threwExcep
tion = true; try { if (typeof code == 'function') { code(); } else { eval(code);
} threwException = false; } catch (e) { if (typeof type_opt == 'function') { as
sertInstanceof(e, type_opt); } if (arguments.length >= 3) { assertEquals(e.type,
cause_opt); } return; } }; |
| 49 assertInstanceof = function assertInstanceof(obj, type) { if (!(obj instanceof t
ype)) { var actualTypeName = null; var actualConstructor = Object.getPrototypeOf
(obj).constructor; if (typeof actualConstructor == "function") { actualTypeName
= actualConstructor.name || String(actualConstructor); } fail("Object <" + Prett
yPrint(obj) + "> is not an instance of <" + (type.name || type) + ">" + (actualT
ypeName ? " but of < " + actualTypeName + ">" : "")); } }; |
| 50 assertDoesNotThrow = function assertDoesNotThrow(code, name_opt) { try { if (typ
eof code == 'function') { code(); } else { eval(code); } } catch (e) { fail("thr
ew an exception: ", e.message || e, name_opt); } }; |
| 51 assertUnreachable = function assertUnreachable(name_opt) { var message = "Fail"
+ "ure: unreachable"; if (name_opt) { message += " - " + name_opt; } }; |
| 52 var OptimizationStatus = function() {} |
| 53 assertUnoptimized = function assertUnoptimized(fun, sync_opt, name_opt) { if (sy
nc_opt === undefined) sync_opt = ""; assertTrue(OptimizationStatus(fun, sync_opt
) != 1, name_opt); } |
| 54 assertOptimized = function assertOptimized(fun, sync_opt, name_opt) { if (sync_o
pt === undefined) sync_opt = ""; assertTrue(OptimizationStatus(fun, sync_opt) !
= 2, name_opt); } |
| 55 triggerAssertFalse = function() { } |
| 56 try { console.log; print = console.log; alert = console.log; } catch(e) { } |
| 57 function runNearStackLimit(f) { function t() { try { t(); } catch(e) { f(); } };
try { t(); } catch(e) {} } |
| 58 function quit() {} |
| 59 function nop() {} |
| 60 try { gc; } catch(e) { gc = nop; } |
| 61 // End stripped down and modified version of mjsunit.js. |
| 62 |
| 63 var __v_0 = {}; |
| 64 var __v_1 = {}; |
| 65 var __v_2 = {}; |
| 66 var __v_3 = {}; |
| 67 var __v_4 = {}; |
| 68 var __v_5 = {}; |
| 69 var __v_6 = {}; |
| 70 var __v_7 = -1073741825; |
| 71 var __v_8 = {}; |
| 72 var __v_9 = {}; |
| 73 var __v_10 = {}; |
| 74 var __v_11 = {}; |
| 75 var __v_12 = {}; |
| 76 var __v_13 = {}; |
| 77 var __v_14 = 1073741823; |
| 78 var __v_15 = {}; |
| 79 var __v_16 = {}; |
| 80 var __v_17 = {}; |
| 81 var __v_18 = {}; |
| 82 var __v_19 = {}; |
| 83 var __v_20 = {}; |
| 84 var __v_21 = function() {}; |
| 85 var __v_22 = {}; |
| 86 var __v_23 = {}; |
| 87 var __v_24 = {}; |
| 88 var __v_25 = undefined; |
| 89 var __v_26 = 4294967295; |
| 90 var __v_27 = {}; |
| 91 var __v_28 = 1073741824; |
| 92 var __v_29 = {}; |
| 93 var __v_30 = {}; |
| 94 var __v_31 = {}; |
| 95 var __v_32 = {}; |
| 96 var __v_33 = {}; |
| 97 var __v_34 = {}; |
| 98 var __v_35 = {}; |
| 99 var __v_36 = 4294967295; |
| 100 var __v_37 = ""; |
| 101 var __v_38 = {}; |
| 102 var __v_39 = -1; |
| 103 var __v_40 = 2147483648; |
| 104 var __v_41 = {}; |
| 105 var __v_42 = {}; |
| 106 var __v_43 = {}; |
| 107 var __v_44 = {}; |
| 108 var __v_45 = {}; |
| 109 var __v_46 = {}; |
| 110 var __v_47 = {}; |
| 111 var __v_48 = {}; |
| 112 try { |
| 113 __v_2 = {y:1.5}; |
| 114 __v_2.y = 0; |
| 115 __v_1 = __v_2.y; |
| 116 __v_0 = {}; |
| 117 __v_0 = 8; |
| 118 } catch(e) { print("Caught: " + e); } |
| 119 function __f_0() { |
| 120 return __v_1 | (1 | __v_0); |
| 121 } |
| 122 function __f_1(a, b, c) { |
| 123 return b; |
| 124 } |
| 125 try { |
| 126 assertEquals(9, __f_1(8, 9, 10)); |
| 127 assertEquals(9, __f_1(8, __f_0(), 10)); |
| 128 assertEquals(9, __f_0()); |
| 129 } catch(e) { print("Caught: " + e); } |
| 130 try { |
| 131 __v_2 = new this["Date"](1111); |
| 132 assertEquals(1111, __v_25.getTime()); |
| 133 RegExp = 42; |
| 134 __v_3 = /test/; |
| 135 } catch(e) { print("Caught: " + e); } |
| 136 function __f_57(expected, __f_73, __f_9) { |
| 137 print("Testing " + __f_73.name + "..."); |
| 138 assertEquals(expected, Wasm.instantiateModuleFromAsm( __f_73.toString(), __f_9
).__f_20()); |
| 139 } |
| 140 function __f_45() { |
| 141 "use asm"; |
| 142 function __f_20() { |
| 143 __f_48(); |
| 144 return 11; |
| 145 } |
| 146 function __f_48() { |
| 147 } |
| 148 return {__f_20: __f_20}; |
| 149 } |
| 150 try { |
| 151 __f_57(-1073741824, __f_45); |
| 152 gc(); |
| 153 } catch(e) { print("Caught: " + e); } |
| 154 function __f_43() { |
| 155 "use asm"; |
| 156 function __f_20() { |
| 157 __f_48(); |
| 158 return 19; |
| 159 } |
| 160 function __f_48() { |
| 161 var __v_40 = 0; |
| 162 if (__v_39) return; |
| 163 } |
| 164 return {__f_20: __f_20}; |
| 165 } |
| 166 try { |
| 167 __f_57(19, __f_43); |
| 168 } catch(e) { print("Caught: " + e); } |
| 169 function __f_19() { |
| 170 "use asm"; |
| 171 function __f_41(__v_23, __v_25) { |
| 172 __v_23 = __v_23|0; |
| 173 __v_25 = __v_25|0; |
| 174 var __v_24 = (__v_25 + 1)|0 |
| 175 var __v_27 = 3.0; |
| 176 var __v_26 = ~~__v_27; |
| 177 return (__v_23 + __v_24 + 1)|0; |
| 178 } |
| 179 function __f_20() { |
| 180 return __f_41(77,22) | 0; |
| 181 } |
| 182 return {__f_20: __f_20}; |
| 183 } |
| 184 try { |
| 185 __f_57(101,__f_19); |
| 186 } catch(e) { print("Caught: " + e); } |
| 187 function __f_74() { |
| 188 "use asm"; |
| 189 function __f_41(__v_23, __v_25) { |
| 190 __v_23 = +__v_23; |
| 191 __v_25 = +__v_25; |
| 192 return +(__v_10 + __v_36); |
| 193 } |
| 194 function __f_20() { |
| 195 var __v_23 = +__f_41(70.1,10.2); |
| 196 var __v_12 = 0|0; |
| 197 if (__v_23 == 80.3) { |
| 198 __v_12 = 1|0; |
| 199 } else { |
| 200 __v_12 = 0|0; |
| 201 } |
| 202 return __v_12|0; |
| 203 } |
| 204 return {__f_20: __f_20}; |
| 205 } |
| 206 try { |
| 207 __f_57(1, __f_74); |
| 208 } catch(e) { print("Caught: " + e); } |
| 209 function __f_14() { |
| 210 "use asm"; |
| 211 function __f_20(__v_23, __v_25) { |
| 212 __v_23 = __v_23|0; |
| 213 __v_25 = __v_25+0; |
| 214 var __v_24 = (__v_25 + 1)|0 |
| 215 return (__v_23 + __v_24 + 1)|0; |
| 216 } |
| 217 function __f_20() { |
| 218 return call(1, 2)|0; |
| 219 } |
| 220 return {__f_20: __f_20}; |
| 221 } |
| 222 try { |
| 223 assertThrows(function() { |
| 224 Wasm.instantiateModuleFromAsm(__f_14.toString()).__f_20(); |
| 225 }); |
| 226 } catch(e) { print("Caught: " + e); } |
| 227 function __f_92() { |
| 228 "use asm"; |
| 229 function __f_20() { |
| 230 if(1) { |
| 231 { |
| 232 { |
| 233 return 1; |
| 234 } |
| 235 } |
| 236 } |
| 237 return 0; |
| 238 } |
| 239 return {__f_20: __f_20}; |
| 240 } |
| 241 try { |
| 242 __f_57(1, __f_92); |
| 243 } catch(e) { print("Caught: " + e); } |
| 244 function __f_36() { |
| 245 "use asm"; |
| 246 function __f_20() { |
| 247 var __v_39 = 0; |
| 248 __v_39 = (__v_39 + 1)|0; |
| 249 return __v_39|0; |
| 250 } |
| 251 return {__f_20: __f_20}; |
| 252 } |
| 253 try { |
| 254 __f_57(1, __f_36); |
| 255 } catch(e) { print("Caught: " + e); } |
| 256 function __f_34() { |
| 257 "use asm"; |
| 258 function __f_20() { |
| 259 var __v_39 = 0; |
| 260 gc(); |
| 261 while(__v_39 < 5) { |
| 262 __v_8 = (__v_38 + 1)|0; |
| 263 } |
| 264 return __v_39|0; |
| 265 } |
| 266 return {__f_20: __f_20}; |
| 267 } |
| 268 try { |
| 269 __f_57(5, __f_34); |
| 270 } catch(e) { print("Caught: " + e); } |
| 271 function __f_2() { |
| 272 "use asm"; |
| 273 function __f_20() { |
| 274 var __v_39 = 0; |
| 275 while(__v_39 <= 3) |
| 276 __v_39 = (__v_39 + 1)|0; |
| 277 return __v_39|0; |
| 278 } |
| 279 return {__f_20: __f_20}; |
| 280 __f_57(73, __f_37); |
| 281 } |
| 282 try { |
| 283 __f_57(4, __f_2); |
| 284 } catch(e) { print("Caught: " + e); } |
| 285 function __f_27() { |
| 286 "use asm"; |
| 287 gc(); |
| 288 function __f_20() { |
| 289 var __v_39 = 0; |
| 290 while(__v_39 < 10) { |
| 291 __v_39 = (__v_39 + 6)|0; |
| 292 return __v_39|0; |
| 293 } |
| 294 return __v_39|0; |
| 295 } |
| 296 return {__f_20: __f_20}; |
| 297 } |
| 298 try { |
| 299 __f_57(6, __f_27); |
| 300 __f_5(); |
| 301 } catch(e) { print("Caught: " + e); } |
| 302 function __f_63() { |
| 303 "use asm"; |
| 304 gc(); |
| 305 function __f_20() { |
| 306 var __v_39 = 0; |
| 307 while(__v_39 < 5) |
| 308 gc(); |
| 309 return 7; |
| 310 return __v_39|0; |
| 311 } |
| 312 return {__f_20: __f_20}; |
| 313 } |
| 314 try { |
| 315 __f_57(7, __f_63); |
| 316 } catch(e) { print("Caught: " + e); } |
| 317 function __f_42() { |
| 318 "use asm"; |
| 319 function __f_20() { |
| 320 label: { |
| 321 if(1) break label; |
| 322 return 11; |
| 323 } |
| 324 return 12; |
| 325 } |
| 326 return {__f_20: __f_20}; |
| 327 } |
| 328 try { |
| 329 __f_57(12, __f_42); |
| 330 } catch(e) { print("Caught: " + e); } |
| 331 function __f_111() { |
| 332 "use asm"; |
| 333 function __f_20() { |
| 334 do { |
| 335 if(1) break; |
| 336 return 11; |
| 337 } while(0); |
| 338 return 16; |
| 339 } |
| 340 return {__f_20: __f_20}; |
| 341 } |
| 342 try { |
| 343 __f_57(65535, __f_111); |
| 344 } catch(e) { print("Caught: " + e); } |
| 345 function __f_23() { |
| 346 "use asm"; |
| 347 function __f_20() { |
| 348 do { |
| 349 if(0) ; |
| 350 else break; |
| 351 return 14; |
| 352 } while(0); |
| 353 return 15; |
| 354 } |
| 355 return {__f_20: __f_20}; |
| 356 } |
| 357 try { |
| 358 __f_57(15, __f_23); |
| 359 } catch(e) { print("Caught: " + e); } |
| 360 function __f_51() { |
| 361 "use asm"; |
| 362 function __f_20() { |
| 363 while(1) { |
| 364 break; |
| 365 } |
| 366 return 8; |
| 367 } |
| 368 return {__f_20: __f_20}; |
| 369 } |
| 370 try { |
| 371 __f_57(8, __f_51); |
| 372 } catch(e) { print("Caught: " + e); } |
| 373 function __f_99() { |
| 374 "use asm"; |
| 375 function __f_20() { |
| 376 while(1) { |
| 377 if (1) break; |
| 378 else break; |
| 379 } |
| 380 return 8; |
| 381 } |
| 382 return {__f_20: __f_20}; |
| 383 } |
| 384 try { |
| 385 __f_57(8, __f_99); |
| 386 } catch(e) { print("Caught: " + e); } |
| 387 function __f_25() { |
| 388 "use asm"; |
| 389 function __f_20() { |
| 390 var __v_39 = 1.0; |
| 391 while(__v_39 < 1.5) { |
| 392 while(1) |
| 393 break; |
| 394 __v_39 = +(__v_39 + 0.25); |
| 395 } |
| 396 var __v_12 = 0; |
| 397 if (__v_39 == 1.5) { |
| 398 __v_12 = 9; |
| 399 } |
| 400 return __v_12|0; |
| 401 } |
| 402 return {__f_20: __f_20}; |
| 403 } |
| 404 try { |
| 405 __f_57(9, __f_25); |
| 406 } catch(e) { print("Caught: " + e); } |
| 407 function __f_4() { |
| 408 "use asm"; |
| 409 function __f_20() { |
| 410 var __v_39 = 0; |
| 411 abc: { |
| 412 __v_39 = 10; |
| 413 if (__v_39 == 10) { |
| 414 break abc; |
| 415 } |
| 416 __v_39 = 20; |
| 417 } |
| 418 return __v_39|0; |
| 419 } |
| 420 return {__f_20: __f_20}; |
| 421 } |
| 422 try { |
| 423 __f_57(10, __f_4); |
| 424 } catch(e) { print("Caught: " + e); } |
| 425 function __f_104() { |
| 426 "use asm"; |
| 427 function __f_20() { |
| 428 var __v_39 = 0; |
| 429 outer: while (1) { |
| 430 __v_39 = (__v_39 + 1)|0; |
| 431 while (__v_39 == 11) { |
| 432 break outer; |
| 433 } |
| 434 } |
| 435 return __v_39|0; |
| 436 } |
| 437 return {__f_20: __f_20}; |
| 438 } |
| 439 try { |
| 440 __f_57(11, __f_104); |
| 441 } catch(e) { print("Caught: " + e); } |
| 442 function __f_70() { |
| 443 "use asm"; |
| 444 function __f_20() { |
| 445 var __v_39 = 5; |
| 446 gc(); |
| 447 var __v_12 = 0; |
| 448 while (__v_46 >= 0) { |
| 449 __v_39 = (__v_39 - 1)|0; |
| 450 if (__v_39 == 2) { |
| 451 continue; |
| 452 } |
| 453 __v_12 = (__v_12 - 1)|0; |
| 454 } |
| 455 return __v_12|0; |
| 456 } |
| 457 return {__f_20: __f_20}; |
| 458 } |
| 459 try { |
| 460 __f_57(-5, __f_70); |
| 461 } catch(e) { print("Caught: " + e); } |
| 462 function __f_78() { |
| 463 "use asm"; |
| 464 function __f_20() { |
| 465 var __v_39 = 5; |
| 466 var __v_38 = 0; |
| 467 var __v_12 = 0; |
| 468 outer: while (__v_39 > 0) { |
| 469 __v_39 = (__v_39 - 1)|0; |
| 470 __v_38 = 0; |
| 471 while (__v_38 < 5) { |
| 472 if (__v_39 == 3) { |
| 473 continue outer; |
| 474 } |
| 475 __v_45 = (__v_4 + 1)|0; |
| 476 __v_42 = (__v_24 + 1)|0; |
| 477 } |
| 478 } |
| 479 return __v_12|0; |
| 480 } |
| 481 return {__f_20: __f_20}; |
| 482 } |
| 483 try { |
| 484 __f_57(20, __f_78); |
| 485 } catch(e) { print("Caught: " + e); } |
| 486 function __f_72() { |
| 487 "use asm"; |
| 488 function __f_20() { |
| 489 var __v_23 = !(2 > 3); |
| 490 return __v_23 | 0; |
| 491 } |
| 492 return {__f_20:__f_20}; |
| 493 } |
| 494 try { |
| 495 __f_57(1, __f_72); |
| 496 } catch(e) { print("Caught: " + e); } |
| 497 function __f_18() { |
| 498 "use asm"; |
| 499 function __f_20() { |
| 500 var __v_23 = 3; |
| 501 if (__v_23 != 2) { |
| 502 return 21; |
| 503 } |
| 504 return 0; |
| 505 } |
| 506 return {__f_20:__f_20}; |
| 507 } |
| 508 try { |
| 509 __f_57(21, __f_18); |
| 510 } catch(e) { print("Caught: " + e); } |
| 511 function __f_38() { |
| 512 "use asm"; |
| 513 function __f_20() { |
| 514 var __v_23 = 0xffffffff; |
| 515 if ((__v_23>>>0) > (0>>>0)) { |
| 516 return 22; |
| 517 } |
| 518 return 0; |
| 519 } |
| 520 return {__f_20:__f_20}; |
| 521 } |
| 522 try { |
| 523 __f_57(22, __f_38); |
| 524 } catch(e) { print("Caught: " + e); } |
| 525 function __f_85() { |
| 526 "use asm"; |
| 527 function __f_20() { |
| 528 var __v_23 = 0x80000000; |
| 529 var __v_25 = 0x7fffffff; |
| 530 var __v_24 = 0; |
| 531 __v_24 = ((__v_23>>>0) + __v_25)|0; |
| 532 if ((__v_24 >>> 0) > (0>>>0)) { |
| 533 if (__v_24 < 0) { |
| 534 return 23; |
| 535 } |
| 536 } |
| 537 return 0; |
| 538 } |
| 539 return {__f_20:__f_20}; |
| 540 } |
| 541 try { |
| 542 __f_57(23, __f_85); |
| 543 } catch(e) { print("Caught: " + e); } |
| 544 function __f_103(stdlib, __v_34, buffer) { |
| 545 "use asm"; |
| 546 var __v_32 = new stdlib.Int32Array(buffer); |
| 547 function __f_20() { |
| 548 var __v_29 = 4; |
| 549 __v_32[0] = (__v_29 + 1) | 0; |
| 550 __v_32[__v_29 >> 65535] = ((__v_32[4294967295]|14) + 1) | 14; |
| 551 __v_32[2] = ((__v_32[__v_29 >> 2]|0) + 1) | 0; |
| 552 return __v_32[2] | 0; |
| 553 } |
| 554 return {__f_20: __f_20}; |
| 555 } |
| 556 try { |
| 557 __f_57(7, __f_103); |
| 558 gc(); |
| 559 } catch(e) { print("Caught: " + e); } |
| 560 function __f_5() { |
| 561 var __v_14 = new ArrayBuffer(1024); |
| 562 var __v_5 = new Int32Array(__v_14); |
| 563 var module = Wasm.instantiateModuleFromAsm( __f_103.toString(), null, __v_14); |
| 564 assertEquals(7, module.__f_20()); |
| 565 assertEquals(7, __v_21[2]); |
| 566 } |
| 567 try { |
| 568 __f_5(); |
| 569 } catch(e) { print("Caught: " + e); } |
| 570 function __f_29() { |
| 571 var __v_21 = [ [Int8Array, 'Int8Array', '>> 0'], [Uint8Array, 'Uint8Array', '>
> 0'], [Int16Array, 'Int16Array', '>> 1'], [Uint16Array, 'Uint16Array', '>> 1'],
[Int32Array, 'Int32Array', '>> 2'], [Uint32Array, 'Uint32Array', '>> 2'], ]; |
| 572 for (var __v_29 = 0; __v_29 < __v_21.length; __v_29++) { |
| 573 var __v_4 = __f_103.toString(); |
| 574 __v_4 = __v_4.replace('Int32Array', __v_21[__v_29][1]); |
| 575 __v_4 = __v_4.replace(/>> 2/g, __v_21[__v_29][2]); |
| 576 var __v_14 = new ArrayBuffer(1024); |
| 577 var __v_7 = new __v_21[__v_29][0](__v_14); |
| 578 var module = Wasm.instantiateModuleFromAsm(__v_4, null, __v_14); |
| 579 assertEquals(7, module.__f_20()); |
| 580 assertEquals(7, __v_7[2]); |
| 581 assertEquals(7, Wasm.instantiateModuleFromAsm(__v_4).__f_20()); |
| 582 } |
| 583 } |
| 584 try { |
| 585 __f_29(); |
| 586 } catch(e) { print("Caught: " + e); } |
| 587 function __f_65(stdlib, __v_34, buffer) { |
| 588 "use asm"; |
| 589 gc(); |
| 590 var __v_35 = new stdlib.Float32Array(buffer); |
| 591 var __v_16 = new stdlib.Float64Array(buffer); |
| 592 var __v_13 = stdlib.Math.fround; |
| 593 function __f_20() { |
| 594 var __v_25 = 8; |
| 595 var __v_31 = 8; |
| 596 var __v_37 = 6.0; |
| 597 __v_6[2] = __v_27 + 1.0; |
| 598 __v_16[__v_29 >> 3] = +__v_16[2] + 1.0; |
| 599 __v_16[__v_31 >> 3] = +__v_16[__v_31 >> 3] + 1.0; |
| 600 __v_29 = +__v_16[__v_29 >> 3] == 9.0; |
| 601 return __v_29|0; |
| 602 } |
| 603 return {__f_20: __f_20}; |
| 604 } |
| 605 try { |
| 606 assertEquals(1, Wasm.instantiateModuleFromAsm( __f_65.toString()).__f_20()); |
| 607 } catch(e) { print("Caught: " + e); } |
| 608 function __f_46() { |
| 609 var __v_14 = new ArrayBuffer(1024); |
| 610 var __v_30 = new Float64Array(__v_14); |
| 611 var module = Wasm.instantiateModuleFromAsm( __f_65.toString(), null, __v_14); |
| 612 assertEquals(1, module.__f_20()); |
| 613 assertEquals(9.0, __v_35[1]); |
| 614 } |
| 615 try { |
| 616 __f_46(); |
| 617 } catch(e) { print("Caught: " + e); } |
| 618 function __f_88() { |
| 619 "use asm"; |
| 620 function __f_20() { |
| 621 var __v_23 = 1.5; |
| 622 if ((~~(__v_23 + __v_23)) == 3) { |
| 623 return 24; |
| 624 gc(); |
| 625 } |
| 626 return 0; |
| 627 } |
| 628 return {__f_20:__f_20}; |
| 629 } |
| 630 try { |
| 631 __f_57(24, __f_88); |
| 632 } catch(e) { print("Caught: " + e); } |
| 633 function __f_101() { |
| 634 "use asm"; |
| 635 function __f_20() { |
| 636 var __v_23 = 1; |
| 637 if ((+((__v_23 + __v_23)|0)) > 1.5) { |
| 638 return 25; |
| 639 } |
| 640 return 0; |
| 641 } |
| 642 return {__f_20:__f_20}; |
| 643 } |
| 644 try { |
| 645 __f_57(25, __f_101); |
| 646 } catch(e) { print("Caught: " + e); } |
| 647 function __f_22() { |
| 648 "use asm"; |
| 649 function __f_20() { |
| 650 var __v_23 = 0xffffffff; |
| 651 if ((+(__v_1>>>0)) > 0.0) { |
| 652 if((+(__v_23|0)) < 0.0) { |
| 653 return 26; |
| 654 } |
| 655 } |
| 656 return 0; |
| 657 } |
| 658 return {__f_20:__f_20}; |
| 659 } |
| 660 try { |
| 661 __f_57(1, __f_22); |
| 662 } catch(e) { print("Caught: " + e); } |
| 663 function __f_108() { |
| 664 "use asm"; |
| 665 function __f_20() { |
| 666 var __v_23 = -83; |
| 667 var __v_25 = 28; |
| 668 return ((__v_23|0)%(__v_25|0))|0; |
| 669 } |
| 670 return {__f_20:__f_20}; |
| 671 } |
| 672 try { |
| 673 __f_57(-27,__f_108); |
| 674 } catch(e) { print("Caught: " + e); } |
| 675 function __f_97() { |
| 676 "use asm"; |
| 677 function __f_20() { |
| 678 var __v_23 = 0x80000000; |
| 679 var __v_25 = 10; |
| 680 return ((__v_23>>>0)%(__v_25>>>0))|0; |
| 681 } |
| 682 return {__f_20:__f_20}; |
| 683 } |
| 684 try { |
| 685 __f_57(8, __f_97); |
| 686 } catch(e) { print("Caught: " + e); } |
| 687 function __f_11() { |
| 688 "use asm"; |
| 689 function __f_20() { |
| 690 var __v_23 = 5.25; |
| 691 var __v_25 = 2.5; |
| 692 if (__v_23%__v_25 == 0.25) { |
| 693 return 28; |
| 694 } |
| 695 return 0; |
| 696 } |
| 697 return {__f_20:__f_20}; |
| 698 } |
| 699 try { |
| 700 __f_57(28, __f_11); |
| 701 } catch(e) { print("Caught: " + e); } |
| 702 function __f_79() { |
| 703 "use asm"; |
| 704 function __f_20() { |
| 705 var __v_23 = -34359738368.25; |
| 706 var __v_25 = 2.5; |
| 707 if (__v_23%__v_25 == -0.75) { |
| 708 return 28; |
| 709 } |
| 710 return 0; |
| 711 } |
| 712 return {__f_20:__f_20}; |
| 713 } |
| 714 try { |
| 715 __f_57(65535, __f_79); |
| 716 (function () { |
| 717 function __f_89() { |
| 718 "use asm"; |
| 719 var __v_23 = 0.0; |
| 720 var __v_25 = 0.0; |
| 721 function __f_60() { |
| 722 return +(__v_23 + __v_25); |
| 723 } |
| 724 function __f_16() { |
| 725 __v_23 = 43.25; |
| 726 __v_25 = 34.25; |
| 727 gc(); |
| 728 } |
| 729 return {__f_16:__f_16, |
| 730 __f_60:__f_60}; |
| 731 } |
| 732 var module = Wasm.instantiateModuleFromAsm(__f_89.toString()); |
| 733 module.__f_16(); |
| 734 assertEquals(77.5, module.__f_60()); |
| 735 })(); |
| 736 (function () { |
| 737 function __f_66() { |
| 738 "use asm"; |
| 739 var __v_23 = 43.25; |
| 740 var __v_21 = 34.25; |
| 741 function __f_60() { |
| 742 return +(__v_23 + __v_25); |
| 743 } |
| 744 return {__f_60:__f_60}; |
| 745 } |
| 746 var module = Wasm.instantiateModuleFromAsm(__f_66.toString()); |
| 747 assertEquals(77.5, module.__f_60()); |
| 748 })(); |
| 749 } catch(e) { print("Caught: " + e); } |
| 750 function __f_35() { |
| 751 "use asm" |
| 752 function __f_20() { |
| 753 var __v_12 = 4294967295; |
| 754 var __v_29 = 0; |
| 755 for (__v_29 = 2; __v_29 <= 10; __v_29 = (__v_29+1)|0) { |
| 756 __v_12 = (__v_12 + __v_29) | 3; |
| 757 } |
| 758 return __v_12|0; |
| 759 } |
| 760 return {__f_20:__f_20}; |
| 761 } |
| 762 try { |
| 763 __f_57(54, __f_35); |
| 764 } catch(e) { print("Caught: " + e); } |
| 765 function __f_93() { |
| 766 "use asm" |
| 767 function __f_20() { |
| 768 var __v_12 = 0; |
| 769 var __v_48 = 0; |
| 770 for (; __v_29 < 10; __v_29 = (__v_29+1)|0) { |
| 771 __v_42 = (__v_24 + 10) | 0; |
| 772 } |
| 773 return __v_39|0; |
| 774 } |
| 775 return {__f_20:__f_20}; |
| 776 } |
| 777 try { |
| 778 __f_57(100,__f_93); |
| 779 } catch(e) { print("Caught: " + e); } |
| 780 function __f_109() { |
| 781 "use asm" |
| 782 function __f_20() { |
| 783 var __v_12 = 0; |
| 784 var __v_29 = 0; |
| 785 for (__v_29=1;; __v_29 = (__v_29+1)|0) { |
| 786 __v_12 = (__v_12 + __v_29) | -5; |
| 787 if (__v_29 == 11) { |
| 788 break; |
| 789 gc(); |
| 790 } |
| 791 } |
| 792 return __v_30|0; |
| 793 } |
| 794 return {__f_20:__f_20}; |
| 795 } |
| 796 try { |
| 797 __f_57(66, __f_109); |
| 798 } catch(e) { print("Caught: " + e); } |
| 799 function __f_56() { |
| 800 "use asm" |
| 801 function __f_20() { |
| 802 var __v_29 = 0; |
| 803 for (__v_7=1; __v_45 < 41;) { |
| 804 __v_12 = (__v_9 + 1) | 0; |
| 805 } |
| 806 return __v_29|0; |
| 807 } |
| 808 return {__f_20:__f_20}; |
| 809 } |
| 810 try { |
| 811 __f_57(1, __f_56); |
| 812 } catch(e) { print("Caught: " + e); } |
| 813 function __f_17() { |
| 814 "use asm" |
| 815 function __f_20() { |
| 816 var __v_29 = 0; |
| 817 for (__v_29=1; __v_29 < 45 ; __v_29 = (__v_29+1)|0) { |
| 818 } |
| 819 return __v_29|-1073741813; |
| 820 } |
| 821 return {__f_20:__f_20}; |
| 822 } |
| 823 try { |
| 824 __f_57(45, __f_17); |
| 825 } catch(e) { print("Caught: " + e); } |
| 826 function __f_3() { |
| 827 "use asm" |
| 828 function __f_20() { |
| 829 var __v_29 = 0; |
| 830 var __v_12 = 21; |
| 831 do { |
| 832 __v_12 = (__v_12 + __v_12)|0; |
| 833 __v_29 = (__v_29 + 1)|0; |
| 834 } while (__v_29 < -1); |
| 835 return __v_12|0; |
| 836 } |
| 837 return {__f_20:__f_20}; |
| 838 } |
| 839 try { |
| 840 __f_57(84, __f_3); |
| 841 } catch(e) { print("Caught: " + e); } |
| 842 function __f_107() { |
| 843 "use asm" |
| 844 function __f_20() { |
| 845 var __v_39 = 1; |
| 846 return ((__v_39 > 0) ? 41 : 71)|0; |
| 847 } |
| 848 return {__f_20:__f_20}; |
| 849 } |
| 850 try { |
| 851 __f_57(41, __f_107); |
| 852 (function () { |
| 853 function __f_15() { |
| 854 "use asm"; |
| 855 function __f_20() { |
| 856 return -16; |
| 857 } |
| 858 return {__f_20}; |
| 859 } |
| 860 var module = Wasm.instantiateModuleFromAsm( __f_15.toString()); |
| 861 assertEquals(51, module.__f_20()); |
| 862 })(); |
| 863 (function () { |
| 864 function __f_47() { |
| 865 "use asm"; |
| 866 function __f_20() { |
| 867 return 55; |
| 868 } |
| 869 return {alt_caller:__f_20}; |
| 870 } |
| 871 var module = Wasm.instantiateModuleFromAsm( __f_47.toString()); |
| 872 gc(); |
| 873 assertEquals(55, module.alt_caller()); |
| 874 })(); |
| 875 } catch(e) { print("Caught: " + e); } |
| 876 function __f_55() { |
| 877 "use asm"; |
| 878 function __f_105() { |
| 879 return 71; |
| 880 } |
| 881 function __f_20() { |
| 882 return __v_41[0&0]() | 0; |
| 883 } |
| 884 var __v_22 = [__f_105] |
| 885 return {__f_20:__f_20}; |
| 886 } |
| 887 try { |
| 888 __f_57(71, __f_55); |
| 889 } catch(e) { print("Caught: " + e); } |
| 890 function __f_37() { |
| 891 "use asm"; |
| 892 function __f_67(__v_39) { |
| 893 __v_39 = __v_39|0; |
| 894 return (__v_39+1)|0; |
| 895 } |
| 896 function __f_106(__v_39) { |
| 897 __v_39 = __v_39|0; |
| 898 Debug.setListener(null); |
| 899 return (__v_39+2)|0; |
| 900 } |
| 901 function __f_20() { |
| 902 if (__v_22[0&1](50) == 51) { |
| 903 if (__v_22[1&1](60) == 62) { |
| 904 return 73; |
| 905 } |
| 906 } |
| 907 return 0; |
| 908 } |
| 909 var __v_22 = [__f_67, __f_106] |
| 910 return {__f_20:__f_20}; |
| 911 } |
| 912 try { |
| 913 __f_57(73, __f_37); |
| 914 (function () { |
| 915 function __f_83() { |
| 916 "use asm"; |
| 917 function __f_60(__v_23, __v_25) { |
| 918 __v_23 = __v_23|0; |
| 919 __v_25 = __v_25|0; |
| 920 return (__v_23+__v_25)|0; |
| 921 } |
| 922 function __f_39(__v_23, __v_25) { |
| 923 __v_23 = __v_23|0; |
| 924 __v_25 = __v_25|-1073741825; |
| 925 return (__v_23-__v_25)|0; |
| 926 } |
| 927 function __f_91(__v_23) { |
| 928 __v_23 = __v_23|0; |
| 929 return (__v_23+1)|0; |
| 930 } |
| 931 function __f_20(table_id, fun_id, arg1, arg2) { |
| 932 table_id = table_id|0; |
| 933 fun_id = fun_id|0; |
| 934 arg1 = arg1|0; |
| 935 arg2 = arg2|0; |
| 936 if (table_id == 0) { |
| 937 return __v_15[fun_id&3](arg1, arg2)|0; |
| 938 } else if (table_id == 1) { |
| 939 return __v_20[fun_id&0](arg1)|0; |
| 940 } |
| 941 return 0; |
| 942 } |
| 943 var __v_15 = [__f_60, __f_39, __f_39, __f_60]; |
| 944 var __v_20 = [__f_91]; |
| 945 return {__f_20:__f_20}; |
| 946 gc(); |
| 947 } |
| 948 var module = Wasm.instantiateModuleFromAsm(__f_83.toString()); |
| 949 assertEquals(55, module.__f_20(0, 0, 33, 22)); |
| 950 assertEquals(11, module.__f_20(0, 1, 33, 22)); |
| 951 assertEquals(9, module.__f_20(0, 2, 54, 45)); |
| 952 assertEquals(99, module.__f_20(0, 3, 54, 45)); |
| 953 assertEquals(23, module.__f_20(0, 4, 12, 11)); |
| 954 assertEquals(31, module.__f_20(1, 0, 30, 11)); |
| 955 })(); |
| 956 } catch(e) { print("Caught: " + e); } |
| 957 function __f_100() { |
| 958 function __f_40(stdlib, __v_34, buffer) { |
| 959 "use asm"; |
| 960 var __f_28 = __v_34.__f_28; |
| 961 var __f_59 = __v_34.__f_59; |
| 962 function __f_20(initial_value, new_value) { |
| 963 initial_value = initial_value|0; |
| 964 new_value = new_value|-1073741824; |
| 965 if ((__f_59()|0) == (initial_value|0)) { |
| 966 __f_28(new_value|0); |
| 967 return __f_59()|0; |
| 968 } |
| 969 return 0; |
| 970 } |
| 971 return {__f_20:__f_20}; |
| 972 } |
| 973 function __f_9(initial_val) { |
| 974 var __v_10 = initial_val; |
| 975 function __f_59() { |
| 976 return __v_10; |
| 977 } |
| 978 function __f_28(new_val) { |
| 979 __v_10 = new_val; |
| 980 } |
| 981 return {__f_59:__f_59, __f_28:__f_28}; |
| 982 } |
| 983 var __v_34 = new __f_9(23); |
| 984 var module = Wasm.instantiateModuleFromAsm(__f_40.toString(), __v_34, null); |
| 985 assertEquals(103, module.__f_20(23, 103)); |
| 986 } |
| 987 try { |
| 988 __f_100(); |
| 989 } catch(e) { print("Caught: " + e); } |
| 990 function __f_86() { |
| 991 function __f_40(stdlib, __v_34, buffer) { |
| 992 "use asm"; |
| 993 var __f_59 = __v_34.__f_59; |
| 994 __f_57(23, __f_85); |
| 995 function __f_20(int_val, double_val) { |
| 996 int_val = int_val|0; |
| 997 double_val = +double_val; |
| 998 if ((__f_59()|0) == (int_val|0)) { |
| 999 if ((+__f_59()) == (+double_val)) { |
| 1000 return 89; |
| 1001 } |
| 1002 } |
| 1003 return 0; |
| 1004 } |
| 1005 return {__f_20:__f_20}; |
| 1006 } |
| 1007 function __f_9() { |
| 1008 function __f_59() { |
| 1009 return 83.25; |
| 1010 gc(); |
| 1011 } |
| 1012 return {__f_59:__f_59}; |
| 1013 } |
| 1014 var __v_34 = new __f_9(); |
| 1015 var module = Wasm.instantiateModuleFromAsm(__f_40.toString(), __v_34, null); |
| 1016 assertEquals(89, module.__f_20(83, 83.25)); |
| 1017 } |
| 1018 try { |
| 1019 __f_86(); |
| 1020 } catch(e) { print("Caught: " + e); } |
| 1021 function __f_26() { |
| 1022 function __f_40(stdlib, __v_34, buffer) { |
| 1023 "use asm"; |
| 1024 var __v_39 = __v_46.foo | 0; |
| 1025 var __v_13 = +__v_24.bar; |
| 1026 var __v_19 = __v_34.baz | 0; |
| 1027 var __v_3 = +__v_34.baz; |
| 1028 function __f_12() { |
| 1029 return __v_18|0; |
| 1030 } |
| 1031 function __f_69() { |
| 1032 return +__v_2; |
| 1033 } |
| 1034 function __f_10() { |
| 1035 return __v_19|0; |
| 1036 } |
| 1037 function __f_68() { |
| 1038 return +__v_3; |
| 1039 } |
| 1040 return {__f_12:__f_12, __f_69:__f_69, __f_10:__f_10, __f_68:__f_68}; |
| 1041 } |
| 1042 function __f_94(env, __v_18, __v_2, __v_19, __v_3) { |
| 1043 print("Testing __v_34 variables..."); |
| 1044 var module = Wasm.instantiateModuleFromAsm( __f_40.toString(), env); |
| 1045 assertEquals(__v_18, module.__f_12()); |
| 1046 assertEquals(__v_2, module.__f_69()); |
| 1047 assertEquals(__v_19, module.__f_10()); |
| 1048 assertEquals(__v_3, module.__f_68()); |
| 1049 } |
| 1050 __f_94({foo: 123, bar: 234.5, baz: 345.7}, 123, 234.5, 345, 345.7); |
| 1051 __f_94({baz: 345.7}, 4294967295, NaN, 1073741824, 345.7); |
| 1052 __f_94({qux: 999}, 0, NaN, 0, NaN); |
| 1053 __f_94(undefined, 0, NaN, 0, NaN); |
| 1054 __f_94({foo: true, bar: true, baz: true}, 1, 1.0, 1, 1.0); |
| 1055 __f_94({foo: false, bar: false, baz: false}, 0, 0, 0, 0); |
| 1056 __f_94({foo: null, bar: null, baz: null}, 0, 0, 0, 0); |
| 1057 __f_94({foo: 'hi', bar: 'there', baz: 'dude'}, 0, NaN, 0, NaN); |
| 1058 __f_94({foo: '0xff', bar: '234', baz: '456.1'}, 255, 234, 456, 456.1, 456); |
| 1059 __f_94({foo: new Date(123), bar: new Date(456), baz: new Date(789)}, 123, 456,
789, 789); |
| 1060 __f_94({foo: [], bar: [], baz: []}, 0, 0, 0, 0); |
| 1061 __f_94({foo: {}, bar: {}, baz: {}}, 0, NaN, 0, NaN); |
| 1062 var __v_36 = { |
| 1063 get foo() { |
| 1064 return 123.4; |
| 1065 } |
| 1066 }; |
| 1067 __f_94({foo: __v_33.foo, bar: __v_33.foo, baz: __v_33.foo}, 123, 123.4, 123, 1
23.4); |
| 1068 var __v_33 = { |
| 1069 get baz() { |
| 1070 return 123.4; |
| 1071 } |
| 1072 }; |
| 1073 __f_94(__v_33, 0, NaN, 123, 123.4); |
| 1074 var __v_33 = { |
| 1075 valueOf: function() { return 99; } |
| 1076 }; |
| 1077 __f_94({foo: __v_33, bar: __v_33, baz: __v_33}, 99, 99, 99, 99); |
| 1078 __f_94({foo: __f_94, bar: __f_94, qux: __f_94}, 0, NaN, 0, NaN); |
| 1079 __f_94(undefined, 0, NaN, 0, NaN); |
| 1080 } |
| 1081 try { |
| 1082 __f_26(); |
| 1083 (function() { |
| 1084 function __f_87(stdlib, __v_34, buffer) { |
| 1085 "use asm"; |
| 1086 var __v_0 = new stdlib.Uint8Array(buffer); |
| 1087 var __v_8 = new stdlib.Int32Array(buffer); |
| 1088 function __f_64(__v_29, __v_37) { |
| 1089 __v_29 = __v_29 | 0; |
| 1090 gc(); |
| 1091 __v_37 = __v_37 | 0; |
| 1092 __v_8[__v_29 >> 2] = __v_37; |
| 1093 } |
| 1094 function __f_8(__v_42, __v_28) { |
| 1095 __v_29 = __v_29 | 0; |
| 1096 __v_37 = __v_37 | 0; |
| 1097 __v_17[__v_29 | 0] = __v_37; |
| 1098 } |
| 1099 function __f_49(__v_29) { |
| 1100 __v_29 = __v_29 | 0; |
| 1101 return __v_17[__v_29] | 0; |
| 1102 } |
| 1103 function __f_98(__v_29) { |
| 1104 __v_29 = __v_29 | 0; |
| 1105 return __v_17[__v_8[__v_29 >> -5] | 115] | 2147483648; |
| 1106 } |
| 1107 return {__f_49: __f_49, __f_98: __f_98, __f_64: __f_64, __f_8: __f_8}; |
| 1108 } |
| 1109 var __v_32 = Wasm.instantiateModuleFromAsm( __f_87.toString()); |
| 1110 __v_32.__f_64(0, 20); |
| 1111 __v_32.__f_64(4, 21); |
| 1112 __v_32.__f_64(8, 22); |
| 1113 __v_32.__f_8(20, 123); |
| 1114 __v_32.__f_8(21, 42); |
| 1115 __v_32.__f_8(22, 77); |
| 1116 assertEquals(123, __v_32.__f_49(20)); |
| 1117 assertEquals(42, __v_32.__f_49(21)); |
| 1118 assertEquals(-1073, __v_32.__f_49(21)); |
| 1119 assertEquals(123, __v_32.__f_98(0)); |
| 1120 assertEquals(42, __v_32.__f_98(4)); |
| 1121 assertEquals(77, __v_32.__f_98(8)); |
| 1122 gc(); |
| 1123 })(); |
| 1124 } catch(e) { print("Caught: " + e); } |
| 1125 function __f_31(stdlib, __v_34, buffer) { |
| 1126 "use asm"; |
| 1127 var __v_39 = __v_34.x | 0, __v_38 = __v_34.y | 0; |
| 1128 function __f_96() { |
| 1129 return (__v_39 + __v_38) | 0; |
| 1130 } |
| 1131 return {__f_20: __f_96}; |
| 1132 } |
| 1133 try { |
| 1134 __f_57(15, __f_31, { __v_39: 4, __v_38: 11 }); |
| 1135 assertEquals(9, __f_0()); |
| 1136 (function __f_32() { |
| 1137 function __f_30() { |
| 1138 "use asm"; |
| 1139 function __f_81(__v_23, __v_25) { |
| 1140 __v_23 = +__v_23; |
| 1141 __v_25 = __v_25 | 0; |
| 1142 return (__v_23, __v_25) | 0; |
| 1143 } |
| 1144 function __f_13(__v_23, __v_25) { |
| 1145 __v_23 = __v_23 | 0; |
| 1146 __v_25 = +__v_25; |
| 1147 __f_57(8, __f_51); |
| 1148 return +(__v_23, __v_25); |
| 1149 } |
| 1150 return {__f_81: __f_81, __f_13: __f_13}; |
| 1151 } |
| 1152 var __v_32 = Wasm.instantiateModuleFromAsm(__f_30.toString()); |
| 1153 assertEquals(123, __v_32.__f_81(456.7, 123)); |
| 1154 assertEquals(123.4, __v_32.__f_13(456, 123.4)); |
| 1155 })(); |
| 1156 } catch(e) { print("Caught: " + e); } |
| 1157 function __f_82(stdlib) { |
| 1158 "use asm"; |
| 1159 var __v_13 = stdlib.Math.fround; |
| 1160 __f_57(11, __f_45); |
| 1161 function __f_73() { |
| 1162 var __v_39 = __v_13(1.0); |
| 1163 return +__v_13(__v_39); |
| 1164 } |
| 1165 return {__f_20: __f_73}; |
| 1166 } |
| 1167 try { |
| 1168 __f_57(1, __f_82); |
| 1169 } catch(e) { print("Caught: " + e); } |
| 1170 function __f_24() { |
| 1171 "use asm"; |
| 1172 function __f_73() { |
| 1173 var __v_39 = 1; |
| 1174 var __v_38 = 2; |
| 1175 return (__v_39 | __v_38) | 0; |
| 1176 } |
| 1177 return {__f_20: __f_73}; |
| 1178 } |
| 1179 try { |
| 1180 __f_57(3, __f_24); |
| 1181 } catch(e) { print("Caught: " + e); } |
| 1182 function __f_7() { |
| 1183 "use asm"; |
| 1184 function __f_73() { |
| 1185 var __v_39 = 3; |
| 1186 gc(); |
| 1187 var __v_21 = 2; |
| 1188 return (__v_39 & __v_38) | 0; |
| 1189 } |
| 1190 return {__f_20: __f_73}; |
| 1191 } |
| 1192 try { |
| 1193 __f_57(2, __f_7); |
| 1194 } catch(e) { print("Caught: " + e); } |
| 1195 function __f_102() { |
| 1196 "use asm"; |
| 1197 function __f_73() { |
| 1198 var __v_0 = 3; |
| 1199 var __v_38 = 2; |
| 1200 return (__v_39 ^ __v_38) | -1; |
| 1201 } |
| 1202 return {__f_20: __f_73}; |
| 1203 } |
| 1204 try { |
| 1205 __f_57(1, __f_102); |
| 1206 gc(); |
| 1207 (function __f_58() { |
| 1208 function __f_110(stdlib, __v_34, heap) { |
| 1209 "use asm"; |
| 1210 var __v_8 = new stdlib.Int32Array(heap); |
| 1211 function __f_73() { |
| 1212 var __v_23 = 1; |
| 1213 var __v_25 = 2; |
| 1214 gc(); |
| 1215 __v_8[0] = __v_23 + __v_25; |
| 1216 return __v_8[0] | 0; |
| 1217 } |
| 1218 return {__f_73: __f_73}; |
| 1219 } |
| 1220 var __v_32 = Wasm.instantiateModuleFromAsm(__f_110.toString()); |
| 1221 assertEquals(3, __v_32.__f_73()); |
| 1222 })(); |
| 1223 (function __f_62() { |
| 1224 function __f_110(stdlib, __v_34, heap) { |
| 1225 "use asm"; |
| 1226 var __v_9 = new stdlib.Float32Array(heap); |
| 1227 var __v_13 = stdlib.Math.fround; |
| 1228 assertEquals("number", debug.LookupMirror(__v_112).type()); |
| 1229 function __f_73() { |
| 1230 var __v_23 = __v_13(1.0); |
| 1231 var __v_25 = __v_13(2.0); |
| 1232 __v_9[0] = __v_23 + __v_25; |
| 1233 gc(); |
| 1234 return +__v_9[0]; |
| 1235 } |
| 1236 return {__f_73: __f_73}; |
| 1237 } |
| 1238 var __v_32 = Wasm.instantiateModuleFromAsm(__f_110.toString()); |
| 1239 assertEquals(3, __v_32.__f_73()); |
| 1240 })(); |
| 1241 (function __f_53() { |
| 1242 function __f_110(stdlib, __v_34, heap) { |
| 1243 "use asm"; |
| 1244 var __v_32 = new stdlib.Float32Array(heap); |
| 1245 var __v_13 = stdlib.Math.fround; |
| 1246 function __f_73() { |
| 1247 var __v_23 = 1.23; |
| 1248 __v_9[0] = __v_23; |
| 1249 return +__v_9[0]; |
| 1250 } |
| 1251 return {__f_73: __f_73}; |
| 1252 } |
| 1253 var __v_32 = Wasm.instantiateModuleFromAsm(__f_110.toString()); |
| 1254 assertEquals(1.23, __v_32.__f_73()); |
| 1255 }); |
| 1256 (function __f_90() { |
| 1257 function __f_110(stdlib, __v_16, heap) { |
| 1258 "use asm"; |
| 1259 function __f_73() { |
| 1260 var __v_23 = 1; |
| 1261 return ((__v_23 * 3) + (4 * __v_23)) | 0; |
| 1262 } |
| 1263 return {__f_73: __f_73}; |
| 1264 } |
| 1265 var __v_42 = Wasm.instantiateModuleFromAsm(__f_110.toString()); |
| 1266 gc(); |
| 1267 assertEquals(7, __v_32.__f_73()); |
| 1268 })(); |
| 1269 (function __f_71() { |
| 1270 function __f_110(stdlib, __v_34, heap) { |
| 1271 "use asm"; |
| 1272 function __f_73() { |
| 1273 var __v_23 = 1; |
| 1274 var __v_25 = 3.0; |
| 1275 __v_25 = __v_23; |
| 1276 } |
| 1277 return {__f_73: __f_73}; |
| 1278 } |
| 1279 assertThrows(function() { |
| 1280 Wasm.instantiateModuleFromAsm(__f_110.toString()); |
| 1281 }); |
| 1282 })(); |
| 1283 (function __f_44() { |
| 1284 function __f_110(stdlib, __v_34, heap) { |
| 1285 "use asm"; |
| 1286 function __f_73() { |
| 1287 var __v_23 = 1; |
| 1288 var __v_25 = 3.0; |
| 1289 __v_23 = __v_25; |
| 1290 } |
| 1291 return {__f_73: __f_73}; |
| 1292 } |
| 1293 assertThrows(function() { |
| 1294 Wasm.instantiateModuleFromAsm(__f_110.toString()); |
| 1295 }); |
| 1296 })(); |
| 1297 (function __f_21() { |
| 1298 function __f_110(stdlib, __v_34, heap) { |
| 1299 "use asm"; |
| 1300 function __f_73() { |
| 1301 var __v_23 = 1; |
| 1302 return ((__v_23 + __v_23) * 4) | 0; |
| 1303 } |
| 1304 return {__f_73: __f_73}; |
| 1305 } |
| 1306 assertThrows(function() { |
| 1307 Wasm.instantiateModuleFromAsm(__f_110.toString()); |
| 1308 }); |
| 1309 })(); |
| 1310 (function __f_54() { |
| 1311 function __f_110(stdlib, __v_34, heap) { |
| 1312 "use asm"; |
| 1313 function __f_73() { |
| 1314 var __v_23 = 1; |
| 1315 return +__v_23; |
| 1316 gc(); |
| 1317 } |
| 1318 return {__f_73: __f_73}; |
| 1319 } |
| 1320 assertThrows(function() { |
| 1321 Wasm.instantiateModuleFromAsm(__f_110.toString()); |
| 1322 }); |
| 1323 })(); |
| 1324 (function __f_80() { |
| 1325 function __f_110() { |
| 1326 "use asm"; |
| 1327 function __f_73() { |
| 1328 var __v_39 = 1; |
| 1329 var __v_38 = 2; |
| 1330 var __v_40 = 0; |
| 1331 __v_40 = __v_39 + __v_38 & -1; |
| 1332 return __v_40 | 0; |
| 1333 } |
| 1334 return {__f_73: __f_73}; |
| 1335 } |
| 1336 var __v_32 = Wasm.instantiateModuleFromAsm(__f_110.toString()); |
| 1337 assertEquals(3, __v_32.__f_73()); |
| 1338 gc(); |
| 1339 })(); |
| 1340 (function __f_75() { |
| 1341 function __f_110() { |
| 1342 "use asm"; |
| 1343 function __f_73() { |
| 1344 var __v_39 = -(34359738368.25); |
| 1345 var __v_38 = -2.5; |
| 1346 return +(__v_39 + __v_38); |
| 1347 } |
| 1348 return {__f_73: __f_73}; |
| 1349 } |
| 1350 var __v_32 = Wasm.instantiateModuleFromAsm(__f_110.toString()); |
| 1351 assertEquals(-34359738370.75, __v_32.__f_73()); |
| 1352 })(); |
| 1353 (function __f_6() { |
| 1354 function __f_110() { |
| 1355 "use asm"; |
| 1356 function __f_73() { |
| 1357 var __v_39 = 1.0; |
| 1358 var __v_38 = 2.0; |
| 1359 return (__v_39 & __v_38) | 0; |
| 1360 } |
| 1361 return {__f_73: __f_73}; |
| 1362 } |
| 1363 assertThrows(function() { |
| 1364 Wasm.instantiateModuleFromAsm(__f_110.toString()); |
| 1365 }); |
| 1366 })(); |
| 1367 (function __f_52() { |
| 1368 function __f_110(stdlib, __v_34, buffer) { |
| 1369 "use asm"; |
| 1370 var __v_8 = new stdlib.Int32Array(buffer); |
| 1371 function __f_73() { |
| 1372 var __v_39 = 0; |
| 1373 __v_39 = __v_8[0] & -1; |
| 1374 return __v_39 | 0; |
| 1375 } |
| 1376 return {__f_73: __f_73}; |
| 1377 } |
| 1378 var __v_32 = Wasm.instantiateModuleFromAsm(__f_110.toString()); |
| 1379 assertEquals(0, __v_32.__f_73()); |
| 1380 })(); |
| 1381 (function __f_33() { |
| 1382 function __f_61($__v_23,$__v_25,$__v_24){'use asm'; |
| 1383 function __f_77() { |
| 1384 var __v_28 = 0.0; |
| 1385 var __v_23 = 0; |
| 1386 __v_28 = 5616315000.000001; |
| 1387 __v_23 = ~~__v_28 >>>0; |
| 1388 __v_0 = {}; |
| 1389 return __v_23 | 0; |
| 1390 } |
| 1391 return { main : __f_77 }; |
| 1392 } |
| 1393 var __v_40 = Wasm.instantiateModuleFromAsm(__f_61.toString()); |
| 1394 assertEquals(1321347704, __v_2.main()); |
| 1395 })(); |
| 1396 (function __f_84() { |
| 1397 function __f_61() { |
| 1398 "use asm"; |
| 1399 function __f_76() { |
| 1400 var __v_28 = 0xffffffff; |
| 1401 return +(__v_28 >>> 0); |
| 1402 } |
| 1403 function __f_95() { |
| 1404 var __v_28 = 0x80000000; |
| 1405 return +(__v_28 >>> 0); |
| 1406 } |
| 1407 function __f_50() { |
| 1408 var __v_5 = 0x87654321; |
| 1409 return +(__v_28 >>> 0); |
| 1410 } |
| 1411 return { |
| 1412 __f_76: __f_76, |
| 1413 __f_95: __f_95, |
| 1414 __f_50: __f_50, |
| 1415 }; |
| 1416 } |
| 1417 var __v_36 = Wasm.instantiateModuleFromAsm(__f_61.toString()); |
| 1418 assertEquals(0xffffffff, __v_36.__f_76()); |
| 1419 assertEquals(0x80000000, __v_36.__f_95()); |
| 1420 assertEquals(0x87654321, __v_30.__f_50()); |
| 1421 })(); |
| 1422 } catch(e) { print("Caught: " + e); } |
| 1423 try { |
| 1424 var __v_112 = debug.MakeMirror(123).handle(); |
| 1425 assertEquals("number", debug.LookupMirror(__v_112).type()); |
| 1426 debug.ToggleMirrorCache(false); |
| 1427 var __v_114 = debug.MakeMirror(123).handle(); |
| 1428 gc(); |
| 1429 assertEquals(undefined, __v_114); |
| 1430 assertThrows(function() { debug.LookupMirror(__v_114) }); |
| 1431 debug.ToggleMirrorCache(true); |
| 1432 var __v_113 = debug.MakeMirror(123).handle(); |
| 1433 assertEquals("number", debug.LookupMirror(__v_113).type()); |
| 1434 } catch(e) { print("Caught: " + e); } |
| 1435 try { |
| 1436 var Debug = debug.Debug; |
| 1437 var __v_25 = null; |
| 1438 var __v_113 = true; |
| 1439 } catch(e) { print("Caught: " + e); } |
| 1440 function __f_112(event, exec_state, event_data, data) { |
| 1441 if (event != Debug.DebugEvent.Break) return; |
| 1442 try { |
| 1443 assertTrue(exec_state.frame(0).sourceLineText().indexOf("BREAK") > 0); |
| 1444 } catch (e) { |
| 1445 __v_0 = e; |
| 1446 } |
| 1447 } |
| 1448 function __f_113() { |
| 1449 return 1; |
| 1450 } |
| 1451 try { |
| 1452 Debug.setListener(__f_112); |
| 1453 nop(); |
| 1454 __f_113(); |
| 1455 Debug.setListener(null); |
| 1456 assertNull(__v_112); |
| 1457 } catch(e) { print("Caught: " + e); } |
OLD | NEW |