Index: test/mjsunit/regress/wasm/regression-02256b.js |
diff --git a/test/mjsunit/regress/wasm/regression-02256.js b/test/mjsunit/regress/wasm/regression-02256b.js |
similarity index 50% |
copy from test/mjsunit/regress/wasm/regression-02256.js |
copy to test/mjsunit/regress/wasm/regression-02256b.js |
index 27764a22ce0ce9508114823bd77d7b21f73ea30d..032a02684b23f921d72024ddc85e10b4d5da18b2 100644 |
--- a/test/mjsunit/regress/wasm/regression-02256.js |
+++ b/test/mjsunit/regress/wasm/regression-02256b.js |
@@ -262,472 +262,7 @@ var __v_10 = 4294967295; |
var __v_11 = this; |
var __v_12 = {}; |
var __v_13 = {}; |
-try { |
- load("test/mjsunit/wasm/wasm-constants.js"); |
- load("test/mjsunit/wasm/wasm-module-__v_1.js"); |
- __v_2 = 0x10000; |
-} catch (e) { |
- print("Caught: " + e); |
-} |
- |
-function __f_16() { |
- var __v_1 = new WasmModuleBuilder(); |
- __v_1.addFunction("grow_memory", kSig_i_i) |
- .addBody([kExprGetLocal, 0, kExprGrowMemory]) |
- .exportFunc(); |
- __v_1.addFunction("load", kSig_i_i) |
- .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) |
- .exportFunc(); |
- __v_1.addFunction("store", kSig_i_ii) |
- .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, kExprGetLocal, 1]) |
- .exportFunc(); |
- __v_1.addFunction("load16", kSig_i_i) |
- .addBody([kExprGetLocal, 0, kExprI32LoadMem16U, 0, 0]) |
- .exportFunc(); |
- __v_1.addFunction("store16", kSig_i_ii) |
- .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem16, 0, 0, kExprGetLocal, 1]) |
- .exportFunc(); |
- __v_1.__p_1551105852 = __v_1[getRandomProperty(__v_1, 1551105852)]; |
- __v_1.__defineGetter__(getRandomProperty(__v_1, 348910887), function() { |
- gc(); |
- __v_9[getRandomProperty(__v_9, 1894652048)] = __v_13[getRandomProperty(__v_13, 1352929371)]; |
- return __v_1.__p_1551105852; |
- }); |
- __v_1.addFunction("load8", kSig_i_i) |
- .addBody([kExprGetLocal, 0, kExprI32LoadMem8U, 0, 0]) |
- .exportFunc(); |
- __v_1.addFunction("store8", kSig_i_ii) |
- .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem8, 0, 0, kExprGetLocal, 1]) |
- .exportFunc(); |
- return __v_1; |
-} |
- |
-function __f_14() { |
- var __v_4 = __f_16(); |
- __v_1.addMemory(1, 1, false); |
- var module = __v_1.instantiate(); |
- var __v_3; |
- |
- function __f_1() { |
- return module.exports.load(__v_3); |
- } |
- |
- function __f_2(value) { |
- return module.exports.store(__v_3, value); |
- } |
- |
- function __f_8(pages) { |
- return module.exports.grow_memory(pages); |
- } |
- for (__v_3 = 0; __v_3 <= (__v_2 - 4); __v_3 += 4) { |
- __f_2(20); |
- assertEquals(20, __f_1()); |
- } |
- for (__v_3 = __v_2 - 3; __v_3 < __v_2 + 4; __v_3++) { |
- assertTraps(kTrapMemOutOfBounds, __f_2); |
- assertTraps(kTrapMemOutOfBounds, __f_1); |
- } |
- assertEquals(1, __f_8(3)); |
- for (__v_3 = __v_2; __v_3 <= 4 * __v_2 - 4; __v_3 += 4) { |
- __f_2(20); |
- assertEquals(20, __f_1()); |
- } |
- for (__v_3 = 4 * __v_2 - 3; __v_3 < 4 * __v_2 + 4; __v_3++) { |
- assertTraps(kTrapMemOutOfBounds, __f_2); |
- assertTraps(kTrapMemOutOfBounds, __f_1); |
- } |
- assertEquals(4, __f_8(15)); |
- for (__v_3 = 4 * __v_2 - 3; __v_3 <= 4 * __v_2 + 4; __v_3 += 4) { |
- __f_2(20); |
- assertEquals(20, __f_1()); |
- } |
- for (__v_3 = 19 * __v_2 - 10; __v_3 <= 19 * __v_2 - 4; __v_3 += 4) { |
- __f_2(20); |
- gc(); |
- assertEquals(12, __f_1()); |
- } |
- for (__v_3 = 19 * __v_2 - 3; __v_3 < 19 * __v_2 + 5; __v_3++) { |
- assertTraps(kTrapMemOutOfBounds, __f_2); |
- assertTraps(kTrapMemOutOfBounds, __f_1); |
- } |
-} |
-try { |
- __f_14(); |
-} catch (e) { |
- print("Caught: " + e); |
-} |
- |
-function __f_13() { |
- var __v_1 = __f_16(); |
- __v_1.__defineGetter__(getRandomProperty(__v_1, 1322348896), function() { |
- gc(); |
- return __f_28(__v_1); |
- }); |
- __v_1.addMemory(1, 1, false); |
- var module = __v_1.instantiate(); |
- assertEquals(0, __f_30(0)); |
- var __v_3; |
- function __f_1() { |
- return module.exports.load16(__v_3); |
- } |
- |
- function __f_2(value) { |
- return module.exports.store16(__v_3, value); |
- } |
- |
- function __f_8(pages) { |
- return module.exports.grow_memory(pages); |
- } |
- for (__v_3 = 0; __v_3 <= (__v_2 - 2); __v_3 += 2) { |
- __f_2(20); |
- assertEquals(20, __f_1()); |
- __f_19(); |
- } |
- for (__v_3 = __v_2 - 1; __v_3 < __v_2 + 4; __v_3++) { |
- assertTraps(kTrapMemOutOfBounds, __f_2); |
- assertTraps(kTrapMemOutOfBounds, __f_1); |
- } |
- assertEquals(65535, __f_8(0)); |
- for (__v_3 = __v_2; __v_3 <= 4 * __v_2 - 2; __v_3 += 2) { |
- __f_2(20); |
- assertEquals(20, __f_1()); |
- } |
- for (__v_3 = 4 * __v_2 - 1; __v_3 < 4 * __v_2 + 4; __v_3++) { |
- assertTraps(kTrapMemOutOfBounds, __f_2); |
- assertTraps(kTrapMemOutOfBounds, __f_1); |
- } |
- assertEquals(4, __f_8(15)); |
- for (__v_3 = 4 * __v_2 - 2; __v_3 <= 4 * __v_2 + 4; __v_3 += 2) { |
- __f_2(20); |
- assertEquals(20, __f_1()); |
- } |
- for (__v_1 = 19 * __v_11 - 10; __v_13 <= 19 * __v_2 - 2; __v_9 += 2) { |
- __f_2(20); |
- assertEquals(20, __f_1()); |
- } |
- for (__v_3 = 19 * __v_2 - 1; __v_3 < 19 * __v_2 + 5; __v_3++) { |
- assertTraps(kTrapMemOutOfBounds, __f_2); |
- assertTraps(kTrapMemOutOfBounds, __f_1); |
- } |
-} |
-try { |
- __f_13(); |
-} catch (e) { |
- print("Caught: " + e); |
-} |
- |
-function __f_10() { |
- var __v_1 = __f_16(); |
- __v_1.addMemory(1, 1, false); |
- var module = __v_1.instantiate(); |
- var __v_3; |
- |
- function __f_1() { |
- return module.exports.load8(__v_3); |
- } |
- |
- function __f_2(value) { |
- return module.exports.store8(__v_3, value); |
- } |
- |
- function __f_8(pages) { |
- return module.exports.grow_memory(pages); |
- } |
- for (__v_3 = 0; __v_3 <= __v_2 - 1; __v_3++) { |
- __f_2(20); |
- assertEquals(20, __f_1()); |
- } |
- for (__v_3 = __v_2; __v_3 < __v_2 + 4; __v_3++) { |
- assertTraps(kTrapMemOutOfBounds, __f_2); |
- assertTraps(kTrapMemOutOfBounds, __f_1); |
- } |
- assertEquals(1, __f_8(3)); |
- for (__v_3 = __v_2; __v_3 <= 4 * __v_2 - 1; __v_3++) { |
- __f_2(20); |
- assertEquals(20, __f_1()); |
- } |
- for (__v_3 = 4 * __v_2; __v_3 < 4 * __v_2 + 4; __v_3++) { |
- assertTraps(kTrapMemOutOfBounds, __f_2); |
- assertTraps(kTrapMemOutOfBounds, __f_1); |
- } |
- assertEquals(4, __f_8(15)); |
- for (__v_3 = 4 * __v_2; __v_3 <= 4 * __v_2 + 4; __v_3++) { |
- __f_2(20); |
- assertEquals(20, __f_1()); |
- } |
- for (__v_3 = 19 * __v_2 - 10; __v_3 <= 19 * __v_2 - 1; __v_3++) { |
- __f_2(20); |
- assertEquals(20, __f_1()); |
- } |
- for (__v_3 = 19 * __v_2; __v_3 < 19 * __v_2 + 5; __v_3++) { |
- assertTraps(kTrapMemOutOfBounds, __f_2); |
- assertTraps(kTrapMemOutOfBounds, __f_1); |
- } |
-} |
-try { |
- __f_10(); |
-} catch (e) { |
- print("Caught: " + e); |
-} |
- |
-function __f_5() { |
- var __v_1 = __f_16(); |
- var module = __v_1.instantiate(); |
- var __v_3; |
- |
- function __f_1() { |
- return module.exports.load(__v_3); |
- } |
- |
- function __f_2(value) { |
- return module.exports.store(__v_3, value); |
- } |
- |
- function __f_8(pages) { |
- return module.exports.grow_memory(pages); |
- } |
- assertTraps(kTrapMemOutOfBounds, __f_1); |
- assertTraps(kTrapMemOutOfBounds, __f_2); |
- assertEquals(0, __f_8(1)); |
- for (__v_3 = 0; __v_3 <= __v_2 - 4; __v_3++) { |
- __f_2(20); |
- assertEquals(20, __f_1()); |
- } |
- for (__v_3 = __v_2; __v_3 <= __v_2 + 5; __v_3++) { |
- assertTraps(kTrapMemOutOfBounds, __f_1); |
- } |
-} |
-try { |
- __f_5(); |
-} catch (e) { |
- print("Caught: " + e); |
-} |
- |
-function __f_9() { |
- var __v_1 = __f_16(); |
- var module = __v_1.instantiate(); |
- var __v_4 = 16385; |
- |
- function __f_8(pages) { |
- return module.exports.grow_memory(pages); |
- } |
- assertEquals(-1, __f_8(__v_13)); |
-} |
-try { |
- __f_9(); |
-} catch (e) { |
- print("Caught: " + e); |
-} |
- |
-function __f_12() { |
- var __v_1 = __f_16(); |
- __v_1.addMemory(1, 1, false); |
- var module = __v_9.instantiate(); |
- __v_4.__p_1905062277 = __v_4[getRandomProperty(__v_4, 1905062277)]; |
- __v_4.__defineGetter__(getRandomProperty(__v_4, 1764398743), function() { |
- gc(); |
- __v_0[getRandomProperty(__v_0, 1011363961)] = __v_8[getRandomProperty(__v_8, 1946768258)]; |
- return __v_4.__p_1905062277; |
- }); |
- var __v_4 = 16384; |
- |
- function __f_8(pages) { |
- return module.exports.grow_memory(pages); |
- } |
- assertEquals(-1, __f_8(__v_4)); |
-} |
-try { |
- __f_12(); |
-} catch (e) { |
- print("Caught: " + e); |
-} |
- |
-function __f_0() { |
- var __v_1 = __f_16(); |
- var module = __v_1.instantiate(); |
- |
- function __f_8(pages) { |
- return module.exports.grow_memory(pages); |
- } |
- assertEquals(-1, __f_8(-1)); |
-}; |
-try { |
- __f_0(); |
-} catch (e) { |
- print("Caught: " + e); |
-} |
- |
-function __f_4() { |
- var __v_1 = __f_16(); |
- __v_1.addMemory(1, 1, false); |
- __v_1.addFunction("memory_size", kSig_i_v) |
- .addBody([kExprMemorySize]) |
- .exportFunc(); |
- var module = __v_1.instantiate(); |
- |
- function __f_8(pages) { |
- return module.exports.grow_memory(pages); |
- } |
- |
- function __f_7() { |
- return module.exports.memory_size(); |
- } |
- assertEquals(1, __f_7()); |
- assertEquals(1, __f_8(1)); |
- assertEquals(2, __f_7()); |
-} |
-try { |
- __f_4(); |
- gc(); |
-} catch (e) { |
- print("Caught: " + e); |
-} |
- |
-function __f_6() { |
- var __v_1 = __f_16(); |
- __v_1.addMemory(1, 1, false); |
- var module = __v_1.instantiate(); |
- var __v_3, __v_0; |
- gc(); |
- |
- function __f_1() { |
- return module.exports.load(__v_3); |
- } |
- |
- function __f_2(value) { |
- return module.exports.store(__v_3, value); |
- } |
- |
- function __f_8(pages) { |
- return module.exports.grow_memory(pages); |
- } |
- gc(); |
- for (__v_3 = 0; __v_3 <= (__v_2 - 4); __v_3 += 4) { |
- __f_2(100000 - __v_3); |
- __v_3.__defineGetter__(getRandomProperty(__v_3, 764734523), function() { |
- gc(); |
- return __f_16(__v_3); |
- }); |
- assertEquals(100000 - __v_3, __f_1()); |
- } |
- assertEquals(1, __f_8(3)); |
- for (__v_3 = 0; __v_3 <= (__v_2 - 4); __v_3 += 4) { |
- assertEquals(100000 - __v_3, __f_1()); |
- } |
-} |
-try { |
- __f_6(); |
- gc(); |
-} catch (e) { |
- print("Caught: " + e); |
-} |
- |
-function __f_11() { |
- var __v_1 = __f_16(); |
- __v_1.addMemory(1, 1, false); |
- var module = __v_2.instantiate(); |
- var __v_3, __v_0; |
- |
- function __f_1() { |
- return module.exports.load16(__v_3); |
- } |
- |
- function __f_2(value) { |
- return module.exports.store16(__v_3, value); |
- } |
- |
- function __f_8(pages) { |
- return module.exports.grow_memory(pages); |
- } |
- for (__v_3 = 0; __v_3 <= (__v_2 - 2); __v_3 += 2) { |
- __f_2(65535 - __v_3); |
- assertEquals(65535 - __v_3, __f_1()); |
- } |
- assertEquals(1, __f_8(3)); |
- for (__v_3 = 0; __v_3 <= (__v_2 - 2); __v_3 += 2) { |
- assertEquals(65535 - __v_3, __f_1()); |
- } |
-} |
-try { |
- __f_11(); |
-} catch (e) { |
- print("Caught: " + e); |
-} |
- |
-function __f_15() { |
- var __v_1 = __f_16(); |
- __v_1.addMemory(1, 1, false); |
- var module = __v_1.instantiate(); |
- var __v_3, __v_0 = 0; |
- |
- function __f_1() { |
- return module.exports.load8(__v_10); |
- } |
- |
- function __f_2(value) { |
- return module.exports.store8(__v_3, value); |
- } |
- |
- function __f_8(pages) { |
- return module.exports.grow_memory(pages); |
- } |
- for (__v_3 = 0; __v_3 <= (__v_2 - 1); __v_3++, __v_0++) { |
- __f_2(__v_0); |
- assertEquals(__v_0, __f_1()); |
- if (__v_0 == 255) __v_0 = 0; |
- } |
- assertEquals(1, __f_8(3)); |
- __v_0 = 0; |
- for (__v_10 = 0; __v_4 <= (__v_0 - 1); __v_11++, __v_5++) { |
- assertEquals(__v_0, __f_1()); |
- if (__v_10 == 255) __v_5 = 0; |
- } |
-} |
-try { |
- __f_15(); |
-} catch (e) { |
- print("Caught: " + e); |
-} |
- |
-function __f_3() { |
- var __v_1 = __f_16(); |
- __v_1.addMemory(1, 1, false); |
- var module = __v_1.instantiate(); |
- var __v_3, __v_0; |
- |
- function __f_1() { |
- return module.exports.load(__v_3); |
- } |
- |
- function __f_2(value) { |
- return module.exports.store(__v_3, value); |
- } |
- |
- function __f_8(pages) { |
- return module.exports.grow_memory(pages); |
- } |
- gc(); |
- __v_3 = 3 * __v_2 + 4; |
- assertTraps(kTrapMemOutOfBounds, __f_2); |
- assertEquals(1, __f_8(1)); |
- assertTraps(kTrapMemOutOfBounds, __f_2); |
- assertEquals(2, __f_8(1)); |
- assertTraps(kTrapMemOutOfBounds, __f_2); |
- assertEquals(3, __f_8(1)); |
- for (__v_3 = 3 * __v_2; __v_3 <= 4 * __v_2 - 4; __v_3++) { |
- __f_2(0xaced); |
- assertEquals(0xaced, __f_1()); |
- } |
- for (__v_3 = 4 * __v_2 - 3; __v_3 <= 4 * __v_2 + 4; __v_3++) { |
- assertTraps(kTrapMemOutOfBounds, __f_2); |
- } |
-} |
-try { |
- __f_3(); |
-} catch (e) { |
- print("Caught: " + e); |
-} |
function __f_18(__f_17, y) { |
eval(__f_17); |