Changeset 209165 in webkit
- Timestamp:
- Nov 30, 2016 5:03:02 PM (7 years ago)
- Location:
- trunk/JSTests
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r209123 r209165 1 2016-11-30 JF Bastien <jfbastien@apple.com> 2 3 WebAssembly builder: don't throw when checker not implemented 4 https://bugs.webkit.org/show_bug.cgi?id=165219 5 6 Reviewed by Mark Lam. 7 8 We should perform whichever checks we've implemented, and assume the rest are OK until bug #163421 is fixed. 9 10 * wasm/Builder.js: 11 * wasm/README.md: 12 * wasm/function-tests/add-12.js: 13 * wasm/function-tests/br-if-loop-less-than.js: 14 * wasm/function-tests/brTableAsIf.js: 15 * wasm/function-tests/brTableManyValues.js: 16 * wasm/function-tests/brTableWithLoop.js: 17 * wasm/function-tests/dumb-eq-if-then-else.js: 18 * wasm/function-tests/dumb-less-than-fallthrough.js: 19 * wasm/function-tests/dumb-less-than-ite.js: 20 * wasm/function-tests/eqz.js: 21 * wasm/function-tests/factorial.js: 22 * wasm/function-tests/float-sub.js: 23 * wasm/function-tests/i32-load.js: 24 * wasm/function-tests/i32-load8-s.js: 25 * wasm/function-tests/if-then-else-fallthrough.js: 26 * wasm/function-tests/if-then-fallthrough.js: 27 * wasm/function-tests/loop-mult.js: 28 * wasm/function-tests/loop-sum.js: 29 * wasm/function-tests/max.js: 30 * wasm/function-tests/min.js: 31 * wasm/function-tests/ret5.js: 32 * wasm/function-tests/select.js: 33 * wasm/self-test/test_BuilderJSON.js: 34 1 35 2016-11-29 JF Bastien <jfbastien@apple.com> 2 36 -
trunk/JSTests/wasm/Builder.js
r209123 r209165 191 191 case "size": break; // FIXME implement size. https://bugs.webkit.org/show_bug.cgi?id=163421 192 192 default: throw new Error(`Implementation problem: unhandled meta-type "${expect}" on "${op}"`); 193 193 } 194 194 } 195 195 } … … 197 197 198 198 const _checkImms = (op, imms, expectedImms, ret) => { 199 assert.eq(imms.length, expectedImms.length, `"${op}" expects ${expectedImms.length} immediates, got ${imms.length}`); 199 const minExpectedImms = expectedImms.filter(i => i.type.slice(-1) !== '*').length; 200 if (minExpectedImms !== expectedImms.length) 201 assert.ge(imms.length, minExpectedImms, `"${op}" expects at least ${minExpectedImms} immediate${minExpectedImms !== 1 ? 's' : ''}, got ${imms.length}`); 202 else 203 assert.eq(imms.length, minExpectedImms, `"${op}" expects exactly ${minExpectedImms} immediate${minExpectedImms !== 1 ? 's' : ''}, got ${imms.length}`); 200 204 for (let idx = 0; idx !== expectedImms.length; ++idx) { 201 205 const got = imms[idx]; … … 206 210 // FIXME check function indices. https://bugs.webkit.org/show_bug.cgi?id=163421 207 211 break; 208 case "local_index": throw new Error(`Unimplemented: "${expect.name}" on "${op}"`);209 case "global_index": throw new Error(`Unimplemented: "${expect.name}" on "${op}"`);210 case "type_index": throw new Error(`Unimplemented: "${expect.name}" on "${op}"`);212 case "local_index": break; // improve checking https://bugs.webkit.org/show_bug.cgi?id=163421 213 case "global_index": break; // improve checking https://bugs.webkit.org/show_bug.cgi?id=163421 214 case "type_index": break; // improve checking https://bugs.webkit.org/show_bug.cgi?id=163421 211 215 case "value": 212 216 assert.truthy(_isValidValue(got, ret[0]), `Invalid value on ${op}: got "${got}", expected ${ret[0]}`); 213 217 break; 214 case "flags": throw new Error(`Unimplemented: "${expect.name}" on "${op}"`);215 case "offset": throw new Error(`Unimplemented: "${expect.name}" on "${op}"`);218 case "flags": break; // improve checking https://bugs.webkit.org/show_bug.cgi?id=163421 219 case "offset": break; // improve checking https://bugs.webkit.org/show_bug.cgi?id=163421 216 220 // Control: 217 case "default_target": throw new Error(`Unimplemented: "${expect.name}" on "${op}"`);218 case "relative_depth": throw new Error(`Unimplemented: "${expect.name}" on "${op}"`);221 case "default_target": break; // improve checking https://bugs.webkit.org/show_bug.cgi?id=163421 222 case "relative_depth": break; // improve checking https://bugs.webkit.org/show_bug.cgi?id=163421 219 223 case "sig": 220 224 // FIXME this should be isValidBlockType https://bugs.webkit.org/show_bug.cgi?id=164724 221 assert.truthy( WASM.isValidValueType(imms[idx]), `Invalid block type on ${op}: "${imms[idx]}"`);225 assert.truthy(imms[idx] === "void" || WASM.isValidValueType(imms[idx]), `Invalid block type on ${op}: "${imms[idx]}"`); 222 226 break; 223 case "target_count": throw new Error(`Unimplemented: "${expect.name}" on "${op}"`);224 case "target_table": throw new Error(`Unimplemented: "${expect.name}" on "${op}"`);227 case "target_count": break; // improve checking https://bugs.webkit.org/show_bug.cgi?id=163421 228 case "target_table": break; // improve checking https://bugs.webkit.org/show_bug.cgi?id=163421 225 229 default: throw new Error(`Implementation problem: unhandled immediate "${expect.name}" on "${op}"`); 226 230 } -
trunk/JSTests/wasm/README.md
r209123 r209165 36 36 // Construct the equivalent of: (module (func "answer" (i32.const 42) (return))) 37 37 builder 38 .setChecked(false) // FIXME remove once checking is better implemented.39 38 // Declare a Type section, which the builder will auto-fill as functions are defined. 40 39 .Type().End() -
trunk/JSTests/wasm/function-tests/add-12.js
r208634 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/br-if-loop-less-than.js
r208634 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/brTableAsIf.js
r208634 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/brTableManyValues.js
r208634 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/brTableWithLoop.js
r208634 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/dumb-eq-if-then-else.js
r208634 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/dumb-less-than-fallthrough.js
r208634 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/dumb-less-than-ite.js
r208634 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/eqz.js
r209083 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/factorial.js
r208634 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/float-sub.js
r208634 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/i32-load.js
r208634 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/i32-load8-s.js
r208634 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/if-then-else-fallthrough.js
r208634 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/if-then-fallthrough.js
r208634 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/loop-mult.js
r208634 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/loop-sum.js
r208634 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/max.js
r209083 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/min.js
r209083 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/ret5.js
r208634 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 let code = b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/function-tests/select.js
r208719 r209165 2 2 3 3 const b = new Builder(); 4 b.setChecked(false);5 4 b.Type().End() 6 5 .Function().End() -
trunk/JSTests/wasm/self-test/test_BuilderJSON.js
r208634 r209165 404 404 405 405 (function CheckedOpcodeArgumentsTooMany() { 406 assertOpThrows(f => f.Nop("uh-oh!"), `Not the same: "1" and "0": "nop" expects 0 immediates, got 1`);406 assertOpThrows(f => f.Nop("uh-oh!"), `Not the same: "1" and "0": "nop" expects exactly 0 immediates, got 1`); 407 407 })(); 408 408 … … 412 412 413 413 (function CheckedOpcodeArgumentsNotEnough() { 414 assertOpThrows(f => f.I32Const(), `Not the same: "0" and "1": "i32.const" expects 1 immediates, got 0`);414 assertOpThrows(f => f.I32Const(), `Not the same: "0" and "1": "i32.const" expects exactly 1 immediate, got 0`); 415 415 })(); 416 416
Note: See TracChangeset
for help on using the changeset viewer.