Changeset 209980 in webkit
- Timestamp:
- Dec 19, 2016 12:19:01 AM (7 years ago)
- Location:
- trunk/JSTests
- Files:
-
- 4 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r209979 r209980 1 2016-12-19 Saam Barati <sbarati@apple.com> 2 3 WebAssembly: Make running Wasm tests take less time by reducing some tests' iteration count and by splitting some tests into different files 4 https://bugs.webkit.org/show_bug.cgi?id=166017 5 6 Reviewed by Yusuke Suzuki. 7 8 * wasm/function-tests/trap-load-2.js: Added. 9 (assert): 10 (wasmFrameCountFromError): 11 (continuation): 12 (i.catch): 13 * wasm/function-tests/trap-load.js: 14 (assert.continuation): Deleted. 15 * wasm/function-tests/trap-store-2.js: Added. 16 (import.Builder.from.string_appeared_here.assert): 17 (continuation): 18 (i.catch): 19 * wasm/function-tests/trap-store.js: 20 (assert.continuation): Deleted. 21 (assert): Deleted. 22 * wasm/js-api/test_memory.js: 23 (test): 24 1 25 2016-12-18 Saam Barati <sbarati@apple.com> 2 26 -
trunk/JSTests/wasm/function-tests/trap-load-2.js
r209979 r209980 19 19 .End(); 20 20 21 const bin = builder.WebAssembly().get();22 const module = new WebAssembly.Module(bin);23 const foo = new WebAssembly.Instance(module, {a: {b: new WebAssembly.Memory({initial: numPages})}}).exports.foo;24 25 21 function assert(b) { 26 22 if (!b) … … 31 27 let stackFrames = e.stack.split("\n").filter((s) => s.indexOf("<wasm>@[wasm code]") !== -1); 32 28 return stackFrames.length; 33 }34 35 for (let i = 0; i < 1000; i++) {36 let threw = false;37 try {38 foo(numPages * pageSize + 1);39 } catch(e) {40 assert(e instanceof WebAssembly.RuntimeError);41 assert(e.message === "Out of bounds memory access");42 threw = true;43 assert(wasmFrameCountFromError(e) === 2);44 }45 assert(threw);46 29 } 47 30 … … 87 70 } 88 71 89 for (let i = 0; i < 10000; i++) {72 for (let i = 0; i < 5000; i++) { 90 73 let threw = false; 91 74 try { 92 foo( 25, address);75 foo(5, address); 93 76 } catch(e) { 94 77 assert(e instanceof WebAssembly.RuntimeError); 95 78 assert(e.message === "Out of bounds memory access"); 96 // There are 25 total calls, and each call does:79 // There are 5 total calls, and each call does: 97 80 // JS entry, wasm entry, js call stub. 98 81 // The last call that traps just has JS entry and wasm entry. 99 assert(wasmFrameCountFromError(e) === 25 * 3 + 2);82 assert(wasmFrameCountFromError(e) === 5 * 3 + 2); 100 83 threw = true; 101 84 } -
trunk/JSTests/wasm/function-tests/trap-load.js
r209696 r209980 45 45 assert(threw); 46 46 } 47 48 {49 const builder = (new Builder())50 .Type().End()51 .Import()52 .Memory("imp", "mem", {initial: numPages})53 .Function("imp", "func", { params: ["i32"] })54 .End()55 .Function().End()56 .Export().Function("foo").End()57 .Code()58 .Function("foo", {params: ["i32", "i32"]})59 .GetLocal(0)60 .I32Const(0)61 .I32Eq()62 .If("void", b =>63 b.GetLocal(1)64 .GetLocal(1)65 .I32Load(2, 0)66 .Br(0)67 .Else()68 .GetLocal(0)69 .Call(0)70 .Br(0)71 )72 .End()73 .End();74 75 const bin = builder.WebAssembly().get();76 const module = new WebAssembly.Module(bin);77 const imp = {78 imp: {79 mem: new WebAssembly.Memory({initial: numPages}),80 func: continuation81 }82 };83 const foo = new WebAssembly.Instance(module, imp).exports.foo;84 const address = numPages*pageSize + 1;85 function continuation(x) {86 foo(x - 1, address);87 }88 89 for (let i = 0; i < 10000; i++) {90 let threw = false;91 try {92 foo(25, address);93 } catch(e) {94 assert(e instanceof WebAssembly.RuntimeError);95 assert(e.message === "Out of bounds memory access");96 // There are 25 total calls, and each call does:97 // JS entry, wasm entry, js call stub.98 // The last call that traps just has JS entry and wasm entry.99 assert(wasmFrameCountFromError(e) === 25 * 3 + 2);100 threw = true;101 }102 assert(threw);103 }104 } -
trunk/JSTests/wasm/function-tests/trap-store-2.js
r209979 r209980 8 8 const pageSize = 64 * 1024; 9 9 const numPages = 10; 10 11 {12 const builder = (new Builder())13 .Type().End()14 .Import()15 .Memory("a", "b", {initial: numPages})16 .End()17 .Function().End()18 .Export().Function("foo").End()19 .Code()20 .Function("foo", {params: ["i32", "i32"]})21 .GetLocal(1)22 .GetLocal(0)23 .I32Store(2, 0)24 .End()25 .End();26 27 const bin = builder.WebAssembly().get();28 const module = new WebAssembly.Module(bin);29 const foo = new WebAssembly.Instance(module, {a: {b: new WebAssembly.Memory({initial: numPages})}}).exports.foo;30 31 for (let i = 0; i < 10000; i++) {32 let threw = false;33 try {34 foo(i, numPages * pageSize + 1);35 } catch(e) {36 assert(e instanceof WebAssembly.RuntimeError);37 assert(e.message === "Out of bounds memory access");38 threw = true;39 }40 assert(threw);41 }42 }43 44 10 45 11 { … … 84 50 } 85 51 86 for (let i = 0; i < 10000; i++) {52 for (let i = 0; i < 5000; i++) { 87 53 let threw = false; 88 54 try { 89 foo( 25, address);55 foo(6, address); 90 56 } catch(e) { 91 57 assert(e instanceof WebAssembly.RuntimeError); -
trunk/JSTests/wasm/function-tests/trap-store.js
r209696 r209980 41 41 } 42 42 } 43 44 45 {46 const builder = (new Builder())47 .Type().End()48 .Import()49 .Memory("imp", "mem", {initial: numPages})50 .Function("imp", "func", { params: ["i32"] })51 .End()52 .Function().End()53 .Export().Function("foo").End()54 .Code()55 .Function("foo", {params: ["i32", "i32"]})56 .GetLocal(0)57 .I32Const(0)58 .I32Eq()59 .If("void", b =>60 b.GetLocal(1)61 .GetLocal(0)62 .I32Store(2, 0)63 .Br(0)64 .Else()65 .GetLocal(0)66 .Call(0)67 .Br(0)68 )69 .End()70 .End();71 72 const bin = builder.WebAssembly().get();73 const module = new WebAssembly.Module(bin);74 const imp = {75 imp: {76 mem: new WebAssembly.Memory({initial: numPages}),77 func: continuation78 }79 };80 const foo = new WebAssembly.Instance(module, imp).exports.foo;81 const address = numPages*pageSize + 1;82 function continuation(x) {83 foo(x - 1, address);84 }85 86 for (let i = 0; i < 10000; i++) {87 let threw = false;88 try {89 foo(25, address);90 } catch(e) {91 assert(e instanceof WebAssembly.RuntimeError);92 assert(e.message === "Out of bounds memory access");93 threw = true;94 }95 assert(threw);96 }97 } -
trunk/JSTests/wasm/js-api/test_memory.js
r209850 r209980 137 137 138 138 test(function() { 139 const memoryDescription = {initial: 2 0, maximum: 20};139 const memoryDescription = {initial: 2, maximum: 2}; 140 140 const builder = (new Builder()) 141 141 .Type().End() … … 176 176 177 177 test(function() { 178 const memoryDescription = {initial: 2 0, maximum: 20};178 const memoryDescription = {initial: 2, maximum: 2}; 179 179 const builder = (new Builder()) 180 180 .Type().End() … … 216 216 217 217 test(function() { 218 const memoryDescription = {initial: 2 0, maximum: 20};218 const memoryDescription = {initial: 2, maximum: 2}; 219 219 const builder = (new Builder()) 220 220 .Type().End() … … 257 257 258 258 test(function() { 259 const memoryDescription = {initial: 2 0, maximum: 20};259 const memoryDescription = {initial: 2, maximum: 2}; 260 260 const builder = (new Builder()) 261 261 .Type().End()
Note: See TracChangeset
for help on using the changeset viewer.