Changeset 213067 in webkit
- Timestamp:
- Feb 27, 2017 8:52:46 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r213019 r213067 1 2017-02-27 JF Bastien <jfbastien@apple.com> 2 3 WebAssembly: miscellaneous spec fixes part deux 4 https://bugs.webkit.org/show_bug.cgi?id=168861 5 6 Reviewed by Keith Miller. 7 8 * wasm.yaml: more passing tests 9 * wasm/Builder.js: use a Map instead of an Object for the function 10 index space, because Number entries such as 0 were colliding with 11 string entries such as "0". This in turn requires some hashing of 12 objects which are inserted, because Map uses Object's insertion 13 order when comparing. 14 (export.default.Builder): 15 (export.default.Builder.prototype._functionIndexSpaceKeyHash): 16 (export.default.Builder.prototype._registerFunctionToIndexSpace): 17 (export.default.Builder.prototype._getFunctionFromIndexSpace): 18 * wasm/js-api/test_Instance.js: add a FIXME test 19 * wasm/spec-tests/memory.wast.js: 20 (assert_unlinkable): 21 * wasm/spec-tests/names.wast.js: 22 1 23 2017-02-26 Caio Lima <ticaiolima@gmail.com> 2 24 -
trunk/JSTests/wasm.yaml
r212983 r213067 134 134 135 135 - path: wasm/spec-tests/linking.wast.js 136 cmd: runWebAssemblySpecTest :skip 136 cmd: runWebAssemblySpecTest :skip # FIXME This test is mostly blocked on implementing re-exporting an import. https://bugs.webkit.org/show_bug.cgi?id=165510 137 137 138 138 - path: wasm/spec-tests/loop.wast.js … … 140 140 141 141 - path: wasm/spec-tests/memory.wast.js 142 cmd: runWebAssemblySpecTest : skip142 cmd: runWebAssemblySpecTest :normal 143 143 144 144 - path: wasm/spec-tests/memory_redundancy.wast.js … … 149 149 150 150 - path: wasm/spec-tests/names.wast.js 151 cmd: runWebAssemblySpecTest : skip151 cmd: runWebAssemblySpecTest :normal 152 152 153 153 - path: wasm/spec-tests/nop.wast.js -
trunk/JSTests/wasm/Builder.js
r212983 r213067 424 424 this.setPreamble(preamble); 425 425 this._sections = []; 426 this._functionIndexSpace = {};426 this._functionIndexSpace = new Map(); 427 427 this._functionIndexSpaceCount = 0; 428 428 this._registerSectionBuilders(); … … 435 435 this._preamble = Object.assign(this._preamble || {}, p); 436 436 return this; 437 } 438 _functionIndexSpaceKeyHash(obj) { 439 // We don't need a full hash, just something that has a defined order for Map. Objects we insert aren't nested. 440 if (typeof(obj) !== 'object') 441 return obj; 442 const keys = Object.keys(obj).sort(); 443 let entries = []; 444 for (let k in keys) 445 entries.push([k, obj[k]]); 446 return JSON.stringify(entries); 437 447 } 438 448 _registerFunctionToIndexSpace(name) { … … 441 451 name = {}; 442 452 } 453 const value = this._functionIndexSpaceCount++; 443 454 // Collisions are fine: we'll simply count the function and forget the previous one. 444 this._functionIndexSpace [name] = this._functionIndexSpaceCount++;455 this._functionIndexSpace.set(this._functionIndexSpaceKeyHash(name), value); 445 456 // Map it both ways, the number space is distinct from the name space. 446 this._functionIndexSpace [this._functionIndexSpace[name]] = name;457 this._functionIndexSpace.set(this._functionIndexSpaceKeyHash(value), name); 447 458 } 448 459 _getFunctionFromIndexSpace(name) { 449 return this._functionIndexSpace [name];460 return this._functionIndexSpace.get(this._functionIndexSpaceKeyHash(name)); 450 461 } 451 462 _registerSectionBuilders() { -
trunk/JSTests/wasm/js-api/test_Instance.js
r209597 r213067 30 30 assert.eq(result, 42); 31 31 })(); 32 33 // FIXME exporting a property with a name that's a number doesn't work https://bugs.webkit.org/show_bug.cgi?id=168857 34 /* 35 (function ExportedNumber() { 36 for (let i = 0; i <= 129; ++i) { 37 const name = i.toString(); 38 const builder = (new Builder()) 39 .Type().End() 40 .Function().End() 41 .Export() 42 .Function(name) 43 .End() 44 .Code() 45 .Function(name, { params: [], ret: "i32" }) 46 .I32Const(i) 47 .Return() 48 .End() 49 .End(); 50 const bin = builder.WebAssembly().get(); 51 const module = new WebAssembly.Module(bin); 52 const instance = new WebAssembly.Instance(module); 53 const result = instance.exports[name](); 54 assert.isA(result, "number"); 55 assert.eq(result, i); 56 } 57 })(); 58 */ 32 59 33 60 const wasmModuleWhichImportJS = () => { -
trunk/JSTests/wasm/spec-tests/memory.wast.js
r212922 r213067 57 57 let mod = module(bytes); 58 58 try { new WebAssembly.Instance(mod, registry) } catch (e) { 59 if (e instanceof TypeError) return;59 if (e instanceof WebAssembly.LinkError) return; // Note: this is fixed in tip-of-tree wabt. 60 60 } 61 61 throw new Error("Wasm linking failure expected"); … … 143 143 $$ = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x0a\x01\x08\x00\x41\x00\x28\x02\x00\x1a\x0b"); 144 144 $$ = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x0a\x01\x08\x00\x41\x00\x2a\x02\x00\x1a\x0b"); 145 assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x0a\x01\x08\x00\x41\x00\x29\x04\x00\x1a\x0b"); 146 assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x0a\x01\x08\x00\x41\x00\x29\x05\x00\x1a\x0b"); 147 assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x0a\x01\x08\x00\x41\x00\x28\x03\x00\x1a\x0b"); 148 assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x0a\x01\x08\x00\x41\x00\x2f\x02\x00\x1a\x0b"); 149 assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x0a\x01\x08\x00\x41\x00\x2d\x01\x00\x1a\x0b"); 150 assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x0b\x01\x09\x00\x41\x00\x41\x00\x3a\x01\x00\x0b"); 145 // FIXME validate alignment. https://bugs.webkit.org/show_bug.cgi?id=168836 146 //assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x0a\x01\x08\x00\x41\x00\x29\x04\x00\x1a\x0b"); 147 //assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x0a\x01\x08\x00\x41\x00\x29\x05\x00\x1a\x0b"); 148 //assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x0a\x01\x08\x00\x41\x00\x28\x03\x00\x1a\x0b"); 149 //assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x0a\x01\x08\x00\x41\x00\x2f\x02\x00\x1a\x0b"); 150 //assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x0a\x01\x08\x00\x41\x00\x2d\x01\x00\x1a\x0b"); 151 //assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x0b\x01\x09\x00\x41\x00\x41\x00\x3a\x01\x00\x0b"); 151 152 assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x09\x01\x07\x00\x41\x00\x2f\x02\x00\x0b"); 152 153 assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x09\x01\x07\x00\x41\x00\x2d\x01\x00\x0b"); 153 assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x0b\x01\x09\x00\x41\x00\x41\x00\x3a\x01\x00\x0b"); 154 // FIXME validate alignment. https://bugs.webkit.org/show_bug.cgi?id=168836 155 //assert_invalid("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x04\x01\x60\x00\x00\x03\x02\x01\x00\x05\x03\x01\x00\x00\x0a\x0b\x01\x09\x00\x41\x00\x41\x00\x3a\x01\x00\x0b"); 154 156 $$ = instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x16\x05\x60\x00\x01\x7f\x60\x00\x01\x7c\x60\x01\x7f\x01\x7f\x60\x01\x7e\x01\x7e\x60\x00\x00\x03\x1b\x1a\x00\x00\x00\x01\x02\x02\x02\x02\x03\x03\x03\x03\x03\x03\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x05\x03\x01\x00\x01\x07\xbd\x02\x1a\x04\x64\x61\x74\x61\x00\x00\x07\x61\x6c\x69\x67\x6e\x65\x64\x00\x01\x09\x75\x6e\x61\x6c\x69\x67\x6e\x65\x64\x00\x02\x04\x63\x61\x73\x74\x00\x03\x0b\x69\x33\x32\x5f\x6c\x6f\x61\x64\x38\x5f\x73\x00\x04\x0b\x69\x33\x32\x5f\x6c\x6f\x61\x64\x38\x5f\x75\x00\x05\x0c\x69\x33\x32\x5f\x6c\x6f\x61\x64\x31\x36\x5f\x73\x00\x06\x0c\x69\x33\x32\x5f\x6c\x6f\x61\x64\x31\x36\x5f\x75\x00\x07\x0b\x69\x36\x34\x5f\x6c\x6f\x61\x64\x38\x5f\x73\x00\x08\x0b\x69\x36\x34\x5f\x6c\x6f\x61\x64\x38\x5f\x75\x00\x09\x0c\x69\x36\x34\x5f\x6c\x6f\x61\x64\x31\x36\x5f\x73\x00\x0a\x0c\x69\x36\x34\x5f\x6c\x6f\x61\x64\x31\x36\x5f\x75\x00\x0b\x0c\x69\x36\x34\x5f\x6c\x6f\x61\x64\x33\x32\x5f\x73\x00\x0c\x0c\x69\x36\x34\x5f\x6c\x6f\x61\x64\x33\x32\x5f\x75\x00\x0d\x08\x61\x73\x73\x65\x72\x74\x5f\x30\x00\x0e\x08\x61\x73\x73\x65\x72\x74\x5f\x31\x00\x0f\x08\x61\x73\x73\x65\x72\x74\x5f\x32\x00\x10\x08\x61\x73\x73\x65\x72\x74\x5f\x33\x00\x11\x08\x61\x73\x73\x65\x72\x74\x5f\x34\x00\x12\x08\x61\x73\x73\x65\x72\x74\x5f\x35\x00\x13\x08\x61\x73\x73\x65\x72\x74\x5f\x36\x00\x14\x08\x61\x73\x73\x65\x72\x74\x5f\x37\x00\x15\x08\x61\x73\x73\x65\x72\x74\x5f\x38\x00\x16\x08\x61\x73\x73\x65\x72\x74\x5f\x39\x00\x17\x09\x61\x73\x73\x65\x72\x74\x5f\x31\x30\x00\x18\x09\x61\x73\x73\x65\x72\x74\x5f\x31\x31\x00\x19\x0a\x9a\x05\x1a\x4e\x00\x41\x00\x2d\x00\x00\x41\xc1\x00\x46\x41\x03\x2d\x00\x00\x41\xa7\x01\x46\x71\x41\x06\x2d\x00\x00\x41\x00\x46\x41\x13\x2d\x00\x00\x41\x00\x46\x71\x71\x41\x14\x2d\x00\x00\x41\xd7\x00\x46\x41\x17\x2d\x00\x00\x41\xcd\x00\x46\x71\x41\x18\x2d\x00\x00\x41\x00\x46\x41\xff\x07\x2d\x00\x00\x41\x00\x46\x71\x71\x71\x0b\x43\x01\x03\x7f\x41\x0a\x21\x00\x02\x40\x03\x40\x20\x00\x41\x00\x46\x04\x40\x0c\x02\x0b\x20\x00\x41\x04\x6c\x21\x02\x20\x02\x20\x00\x36\x02\x00\x20\x02\x28\x02\x00\x21\x01\x20\x00\x20\x01\x47\x04\x40\x41\x00\x0f\x0b\x20\x00\x41\x01\x6b\x21\x00\x0c\x00\x0b\x0b\x41\x01\x0b\x43\x02\x01\x7f\x02\x7c\x41\x0a\x21\x00\x02\x40\x03\x40\x20\x00\x41\x00\x46\x04\x40\x0c\x02\x0b\x20\x00\xb7\x21\x02\x20\x00\x20\x02\x39\x00\x00\x20\x00\x2b\x00\x00\x21\x01\x20\x02\x20\x01\x62\x04\x40\x41\x00\x0f\x0b\x20\x00\x41\x01\x6b\x21\x00\x0c\x00\x0b\x0b\x41\x01\x0b\x38\x00\x41\x08\x42\xc7\x9f\x7f\x37\x03\x00\x41\x08\x2b\x03\x00\x42\xc7\x9f\x7f\xbf\x61\x04\x40\x44\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x0b\x41\x09\x42\x00\x37\x00\x00\x41\x0f\x41\xc5\x80\x01\x3b\x00\x00\x41\x09\x2b\x00\x00\x0b\x0e\x00\x41\x08\x20\x00\x3a\x00\x00\x41\x08\x2c\x00\x00\x0b\x0e\x00\x41\x08\x20\x00\x3a\x00\x00\x41\x08\x2d\x00\x00\x0b\x0e\x00\x41\x08\x20\x00\x3b\x01\x00\x41\x08\x2e\x01\x00\x0b\x0e\x00\x41\x08\x20\x00\x3b\x01\x00\x41\x08\x2f\x01\x00\x0b\x0e\x00\x41\x08\x20\x00\x3c\x00\x00\x41\x08\x30\x00\x00\x0b\x0e\x00\x41\x08\x20\x00\x3c\x00\x00\x41\x08\x31\x00\x00\x0b\x0e\x00\x41\x08\x20\x00\x3d\x01\x00\x41\x08\x32\x01\x00\x0b\x0e\x00\x41\x08\x20\x00\x3d\x01\x00\x41\x08\x33\x01\x00\x0b\x0e\x00\x41\x08\x20\x00\x3e\x02\x00\x41\x08\x34\x02\x00\x0b\x0e\x00\x41\x08\x20\x00\x3e\x02\x00\x41\x08\x35\x02\x00\x0b\x11\x00\x02\x40\x42\x7f\x10\x08\x42\x7f\x51\x45\x0d\x00\x0f\x0b\x00\x0b\x12\x00\x02\x40\x42\x7f\x10\x09\x42\xff\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b\x11\x00\x02\x40\x42\x7f\x10\x0a\x42\x7f\x51\x45\x0d\x00\x0f\x0b\x00\x0b\x13\x00\x02\x40\x42\x7f\x10\x0b\x42\xff\xff\x03\x51\x45\x0d\x00\x0f\x0b\x00\x0b\x11\x00\x02\x40\x42\x7f\x10\x0c\x42\x7f\x51\x45\x0d\x00\x0f\x0b\x00\x0b\x15\x00\x02\x40\x42\x7f\x10\x0d\x42\xff\xff\xff\xff\x0f\x51\x45\x0d\x00\x0f\x0b\x00\x0b\x13\x00\x02\x40\x42\xe4\x00\x10\x08\x42\xe4\x00\x51\x45\x0d\x00\x0f\x0b\x00\x0b\x13\x00\x02\x40\x42\xc8\x01\x10\x09\x42\xc8\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b\x15\x00\x02\x40\x42\xa0\x9c\x01\x10\x0a\x42\xa0\x9c\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b\x15\x00\x02\x40\x42\xc0\xb8\x02\x10\x0b\x42\xc0\xb8\x02\x51\x45\x0d\x00\x0f\x0b\x00\x0b\x15\x00\x02\x40\x42\xa0\x9c\x01\x10\x0c\x42\xa0\x9c\x01\x51\x45\x0d\x00\x0f\x0b\x00\x0b\x15\x00\x02\x40\x42\xc0\xb8\x02\x10\x0d\x42\xc0\xb8\x02\x51\x45\x0d\x00\x0f\x0b\x00\x0b\x0b\x14\x02\x00\x41\x00\x0b\x05\x41\x42\x43\xa7\x44\x00\x41\x14\x0b\x04\x57\x41\x53\x4d"); 155 157 assert_return(() => $$.exports["data"](), 1); -
trunk/JSTests/wasm/spec-tests/names.wast.js
r212922 r213067 103 103 assert_return(() => $$.exports["__malloc"](), f32(6.3125)); 104 104 assert_return(() => $$.exports["~!@#$%^&*()_+`-={}|[]\x5c:\x22;'<>?,./ "](), f32(6.34375)); 105 assert_return(() => $$.exports["0"](), f32(6.359375)); 105 // FIXME exporting a property with a name that's a number doesn't work https://bugs.webkit.org/show_bug.cgi?id=168857 106 //assert_return(() => $$.exports["0"](), f32(6.359375)); 106 107 assert_return(() => $$.exports["_"](), f32(6.375)); 107 108 assert_return(() => $$.exports["$"](), f32(6.390625)); -
trunk/Source/JavaScriptCore/ChangeLog
r213054 r213067 1 2017-02-27 JF Bastien <jfbastien@apple.com> 2 3 WebAssembly: miscellaneous spec fixes part deux 4 https://bugs.webkit.org/show_bug.cgi?id=168861 5 6 Reviewed by Keith Miller. 7 8 * wasm/WasmFunctionParser.h: add some FIXME 9 1 10 2017-02-27 Alex Christensen <achristensen@webkit.org> 2 11 -
trunk/Source/JavaScriptCore/wasm/WasmFunctionParser.h
r210769 r213067 213 213 ExpressionType result; 214 214 WASM_PARSER_FAIL_IF(!parseVarUInt32(alignment), "can't get load alignment"); 215 // FIXME validate alignment. https://bugs.webkit.org/show_bug.cgi?id=168836 215 216 WASM_PARSER_FAIL_IF(!parseVarUInt32(offset), "can't get load offset"); 216 217 WASM_TRY_POP_EXPRESSION_STACK_INTO(pointer, "load pointer"); … … 226 227 ExpressionType pointer; 227 228 WASM_PARSER_FAIL_IF(!parseVarUInt32(alignment), "can't get store alignment"); 229 // FIXME validate alignment. https://bugs.webkit.org/show_bug.cgi?id=168836 228 230 WASM_PARSER_FAIL_IF(!parseVarUInt32(offset), "can't get store offset"); 229 231 WASM_TRY_POP_EXPRESSION_STACK_INTO(value, "store value");
Note: See TracChangeset
for help on using the changeset viewer.