Changeset 247440 in webkit
- Timestamp:
- Jul 15, 2019 12:26:56 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 139 added
- 2 deleted
- 36 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r247390 r247440 1 2019-07-15 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Improve wasm wpt test results by fixing miscellaneous issues 4 https://bugs.webkit.org/show_bug.cgi?id=199783 5 6 Reviewed by Mark Lam. 7 8 Fix our spec tests. 9 10 * wasm/js-api/Module-compile.js: 11 * wasm/js-api/test_basic_api.js: 12 (const.c.in.constructorProperties.switch): 13 * wasm/js-api/validate.js: 14 * wasm/js-api/web-assembly-instantiate.js: 15 * wasm/spec-tests/jsapi.js: 16 (testJSAPI.get test): 17 (testJSAPI.set test): 18 1 19 2019-07-12 Justin Michaud <justin_michaud@apple.com> 2 20 -
trunk/JSTests/wasm/js-api/Module-compile.js
r235420 r247440 3 3 4 4 assert.isFunction(WebAssembly.compile); 5 assert. isFunction(WebAssembly.__proto__.compile);5 assert.truthy(WebAssembly.hasOwnProperty('compile')); 6 6 assert.eq(WebAssembly.compile.length, 1); 7 7 -
trunk/JSTests/wasm/js-api/test_basic_api.js
r246589 r247440 79 79 assert.throws(() => new WebAssembly[c](new WebAssembly.Module(emptyModuleArray), invalid), TypeError, `second argument to WebAssembly.Instance must be undefined or an Object (evaluating 'new WebAssembly[c](new WebAssembly.Module(emptyModuleArray), invalid)')`); 80 80 assert.isNotUndef(instance.exports); 81 checkAccessorOwnPropertyDescriptor(WebAssembly.Instance.prototype, "exports", { configurable: true, enumerable: false });81 checkAccessorOwnPropertyDescriptor(WebAssembly.Instance.prototype, "exports", { configurable: true, enumerable: true }); 82 82 assert.throws(() => WebAssembly.Instance.prototype.exports = undefined, TypeError, `Attempted to assign to readonly property.`); 83 83 assert.throws(() => WebAssembly.Instance.prototype.exports, TypeError, `expected |this| value to be an instance of WebAssembly.Instance`); -
trunk/JSTests/wasm/js-api/validate.js
r227994 r247440 3 3 4 4 assert.isFunction(WebAssembly.validate); 5 assert. isFunction(WebAssembly.__proto__.validate);5 assert.truthy(WebAssembly.hasOwnProperty('validate')); 6 6 assert.eq(WebAssembly.validate.length, 1); 7 7 -
trunk/JSTests/wasm/js-api/web-assembly-instantiate.js
r217921 r247440 3 3 4 4 assert.isFunction(WebAssembly.instantiate); 5 assert. isFunction(WebAssembly.__proto__.instantiate);5 assert.truthy(WebAssembly.hasOwnProperty('instantiate')); 6 6 assert.eq(WebAssembly.instantiate.length, 1); 7 7 -
trunk/JSTests/wasm/spec-tests/jsapi.js
r246589 r247440 231 231 assert_equals(typeof moduleImportsDesc.value, "function"); 232 232 assert_equals(moduleImportsDesc.writable, true); 233 assert_equals(moduleImportsDesc.enumerable, false);233 assert_equals(moduleImportsDesc.enumerable, true); 234 234 assert_equals(moduleImportsDesc.configurable, true); 235 235 }, "'WebAssembly.Module.imports' data property"); … … 266 266 assert_equals(typeof moduleExportsDesc.value, "function"); 267 267 assert_equals(moduleExportsDesc.writable, true); 268 assert_equals(moduleExportsDesc.enumerable, false);268 assert_equals(moduleExportsDesc.enumerable, true); 269 269 assert_equals(moduleExportsDesc.configurable, true); 270 270 }, "'WebAssembly.Module.exports' data property"); … … 297 297 assert_equals(typeof customSectionsDesc.value, "function"); 298 298 assert_equals(customSectionsDesc.writable, true); 299 assert_equals(customSectionsDesc.enumerable, false);299 assert_equals(customSectionsDesc.enumerable, true); 300 300 assert_equals(customSectionsDesc.configurable, true); 301 301 }, "'WebAssembly.Module.customSections' data property"); … … 308 308 assertThrows(() => moduleCustomSections(undefined), TypeError); 309 309 assertThrows(() => moduleCustomSections({}), TypeError); 310 var arr = moduleCustomSections(emptyModule );310 var arr = moduleCustomSections(emptyModule, undefined); 311 311 assert_equals(arr instanceof Array, true); 312 312 assert_equals(arr.length, 0); … … 368 368 assert_equals(typeof exportsDesc.get, "function"); 369 369 assert_equals(exportsDesc.set, undefined); 370 assert_equals(exportsDesc.enumerable, false);370 assert_equals(exportsDesc.enumerable, true); 371 371 assert_equals(exportsDesc.configurable, true); 372 372 const exportsGetter = exportsDesc.get; … … 416 416 assertThrows(() => new Memory(1), TypeError); 417 417 assertThrows(() => new Memory({initial:{valueOf() { throw new Error("here")}}}), Error); 418 assertThrows(() => new Memory({initial:-1}), RangeError);419 assertThrows(() => new Memory({initial:Math.pow(2,32)}), RangeError);418 assertThrows(() => new Memory({initial:-1}), TypeError); 419 assertThrows(() => new Memory({initial:Math.pow(2,32)}), TypeError); 420 420 assertThrows(() => new Memory({initial:1, maximum: Math.pow(2,32)/Math.pow(2,14) }), RangeError); 421 421 assertThrows(() => new Memory({initial:2, maximum:1 }), RangeError); 422 assertThrows(() => new Memory({maximum: -1 }), RangeError);422 assertThrows(() => new Memory({maximum: -1 }), TypeError); 423 423 assert_equals(new Memory({initial:1}) instanceof Memory, true); 424 424 assert_equals(new Memory({initial:1.5}).buffer.byteLength, WasmPage); … … 452 452 assert_equals(typeof bufferDesc.get, "function"); 453 453 assert_equals(bufferDesc.set, undefined); 454 assert_equals(bufferDesc.enumerable, false);454 assert_equals(bufferDesc.enumerable, true); 455 455 assert_equals(bufferDesc.configurable, true); 456 456 }, "'WebAssembly.Memory.prototype.buffer' accessor property"); … … 468 468 const memGrowDesc = Object.getOwnPropertyDescriptor(memoryProto, 'grow'); 469 469 assert_equals(typeof memGrowDesc.value, "function"); 470 assert_equals(memGrowDesc.enumerable, false);470 assert_equals(memGrowDesc.enumerable, true); 471 471 assert_equals(memGrowDesc.configurable, true); 472 472 }, "'WebAssembly.Memory.prototype.grow' data property"); … … 478 478 assertThrows(() => memGrow.call(), TypeError); 479 479 assertThrows(() => memGrow.call({}), TypeError); 480 assertThrows(() => memGrow.call(mem1, -1), RangeError);481 assertThrows(() => memGrow.call(mem1, Math.pow(2,32)), RangeError);480 assertThrows(() => memGrow.call(mem1, -1), TypeError); 481 assertThrows(() => memGrow.call(mem1, Math.pow(2,32)), TypeError); 482 482 var mem = new Memory({initial:1, maximum:2}); 483 483 var buf = mem.buffer; … … 517 517 assertThrows(() => new Table({initial:1, element:{valueOf() { return "funcref" }}}), TypeError); 518 518 assertThrows(() => new Table({initial:{valueOf() { throw new Error("here")}}, element:"funcref"}), Error); 519 assertThrows(() => new Table({initial:-1, element:"funcref"}), RangeError);520 assertThrows(() => new Table({initial:Math.pow(2,32), element:"funcref"}), RangeError);519 assertThrows(() => new Table({initial:-1, element:"funcref"}), TypeError); 520 assertThrows(() => new Table({initial:Math.pow(2,32), element:"funcref"}), TypeError); 521 521 assertThrows(() => new Table({initial:2, maximum:1, element:"funcref"}), RangeError); 522 assertThrows(() => new Table({initial:2, maximum:Math.pow(2,32), element:"funcref"}), RangeError);522 assertThrows(() => new Table({initial:2, maximum:Math.pow(2,32), element:"funcref"}), TypeError); 523 523 assert_equals(new Table({initial:1, element:"funcref"}) instanceof Table, true); 524 524 assert_equals(new Table({initial:1.5, element:"funcref"}) instanceof Table, true); … … 554 554 assert_equals(typeof lengthDesc.get, "function"); 555 555 assert_equals(lengthDesc.set, undefined); 556 assert_equals(lengthDesc.enumerable, false);556 assert_equals(lengthDesc.enumerable, true); 557 557 assert_equals(lengthDesc.configurable, true); 558 558 }, "'WebAssembly.Table.prototype.length' accessor data property"); … … 571 571 const getDesc = Object.getOwnPropertyDescriptor(tableProto, 'get'); 572 572 assert_equals(typeof getDesc.value, "function"); 573 assert_equals(getDesc.enumerable, false);573 assert_equals(getDesc.enumerable, true); 574 574 assert_equals(getDesc.configurable, true); 575 575 }, "'WebAssembly.Table.prototype.get' data property"); … … 586 586 assertThrows(() => get.call(tbl1, 2), RangeError); 587 587 assertThrows(() => get.call(tbl1, 2.5), RangeError); 588 assertThrows(() => get.call(tbl1, -1), RangeError);589 assertThrows(() => get.call(tbl1, Math.pow(2,33)), RangeError);588 assertThrows(() => get.call(tbl1, -1), TypeError); 589 assertThrows(() => get.call(tbl1, Math.pow(2,33)), TypeError); 590 590 assertThrows(() => get.call(tbl1, {valueOf() { throw new Error("hi") }}), Error); 591 591 }, "'WebAssembly.Table.prototype.get' method"); … … 594 594 const setDesc = Object.getOwnPropertyDescriptor(tableProto, 'set'); 595 595 assert_equals(typeof setDesc.value, "function"); 596 assert_equals(setDesc.enumerable, false);596 assert_equals(setDesc.enumerable, true); 597 597 assert_equals(setDesc.configurable, true); 598 598 }, "'WebAssembly.Table.prototype.set' data property"); … … 606 606 assertThrows(() => set.call(tbl1, 0), TypeError); 607 607 assertThrows(() => set.call(tbl1, 2, null), RangeError); 608 assertThrows(() => set.call(tbl1, -1, null), RangeError);609 assertThrows(() => set.call(tbl1, Math.pow(2,33), null), RangeError);608 assertThrows(() => set.call(tbl1, -1, null), TypeError); 609 assertThrows(() => set.call(tbl1, Math.pow(2,33), null), TypeError); 610 610 assertThrows(() => set.call(tbl1, 0, undefined), TypeError); 611 611 assertThrows(() => set.call(tbl1, 0, {}), TypeError); … … 620 620 const tblGrowDesc = Object.getOwnPropertyDescriptor(tableProto, 'grow'); 621 621 assert_equals(typeof tblGrowDesc.value, "function"); 622 assert_equals(tblGrowDesc.enumerable, false);622 assert_equals(tblGrowDesc.enumerable, true); 623 623 assert_equals(tblGrowDesc.configurable, true); 624 624 }, "'WebAssembly.Table.prototype.grow' data property"); … … 630 630 assertThrows(() => tblGrow.call(), TypeError); 631 631 assertThrows(() => tblGrow.call({}), TypeError); 632 assertThrows(() => tblGrow.call(tbl1, -1), RangeError);633 assertThrows(() => tblGrow.call(tbl1, Math.pow(2,32)), RangeError);632 assertThrows(() => tblGrow.call(tbl1, -1), TypeError); 633 assertThrows(() => tblGrow.call(tbl1, Math.pow(2,32)), TypeError); 634 634 var tbl = new Table({element:"funcref", initial:1, maximum:2}); 635 635 assert_equals(tbl.length, 1); -
trunk/LayoutTests/ChangeLog
r247438 r247440 1 2019-07-15 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Improve wasm wpt test results by fixing miscellaneous issues 4 https://bugs.webkit.org/show_bug.cgi?id=199783 5 6 Reviewed by Mark Lam. 7 8 * platform/ios-simulator/TestExpectations: 9 * platform/win/TestExpectations: 10 1 11 2019-07-15 Youenn Fablet <youenn@apple.com> 2 12 -
trunk/LayoutTests/imported/w3c/ChangeLog
r247255 r247440 1 2019-07-15 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Improve wasm wpt test results by fixing miscellaneous issues 4 https://bugs.webkit.org/show_bug.cgi?id=199783 5 6 Reviewed by Mark Lam. 7 8 Import web-platform-tests/wasm/jsapi. Some of tests are failing just because imported wpt tests are old. 9 They are fixed in the upstream. When upgrading wpt tests, we can mark them PASS. 10 11 * resources/import-expectations.json: 12 * web-platform-tests/wasm/jsapi/assertions.js: Added. 13 (assert_function_name): 14 (assert_function_length): 15 * web-platform-tests/wasm/jsapi/bad-imports.js: Added. 16 (test_bad_imports): 17 * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any-expected.txt: Added. 18 * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.html: Added. 19 * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.js: Added. 20 (test_bad_imports): 21 * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker-expected.txt: Added. 22 * web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker.html: Added. 23 * web-platform-tests/wasm/jsapi/constructor/w3c-import.log: Added. 24 * web-platform-tests/wasm/jsapi/global/constructor.any-expected.txt: Added. 25 * web-platform-tests/wasm/jsapi/global/constructor.any.html: Added. 26 * web-platform-tests/wasm/jsapi/global/constructor.any.js: Added. 27 (assert_Global): 28 (test): 29 (test.get assert_array_equals): 30 (string_appeared_here.test): 31 (string_appeared_here.toString): 32 (string_appeared_here.valueOf): 33 (string_appeared_here.name.format_value): 34 * web-platform-tests/wasm/jsapi/global/constructor.any.worker-expected.txt: Added. 35 * web-platform-tests/wasm/jsapi/global/constructor.any.worker.html: Added. 36 * web-platform-tests/wasm/jsapi/global/toString.any-expected.txt: Added. 37 * web-platform-tests/wasm/jsapi/global/toString.any.html: Added. 38 * web-platform-tests/wasm/jsapi/global/toString.any.js: Added. 39 (test): 40 * web-platform-tests/wasm/jsapi/global/toString.any.worker-expected.txt: Added. 41 * web-platform-tests/wasm/jsapi/global/toString.any.worker.html: Added. 42 * web-platform-tests/wasm/jsapi/global/value-set.any-expected.txt: Added. 43 * web-platform-tests/wasm/jsapi/global/value-set.any.html: Added. 44 * web-platform-tests/wasm/jsapi/global/value-set.any.js: Added. 45 (test): 46 (string_appeared_here.name.of.immutableOptions.test): 47 (string_appeared_here.name.of.mutableOptions.test): 48 * web-platform-tests/wasm/jsapi/global/value-set.any.worker-expected.txt: Added. 49 * web-platform-tests/wasm/jsapi/global/value-set.any.worker.html: Added. 50 * web-platform-tests/wasm/jsapi/global/valueOf.any-expected.txt: Added. 51 * web-platform-tests/wasm/jsapi/global/valueOf.any.html: Added. 52 * web-platform-tests/wasm/jsapi/global/valueOf.any.js: Added. 53 (test): 54 * web-platform-tests/wasm/jsapi/global/valueOf.any.worker-expected.txt: Added. 55 * web-platform-tests/wasm/jsapi/global/valueOf.any.worker.html: Added. 56 * web-platform-tests/wasm/jsapi/global/w3c-import.log: Added. 57 * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any-expected.txt: Added. 58 * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.html: Added. 59 * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.js: Added. 60 (test_bad_imports): 61 * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker-expected.txt: Added. 62 * web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker.html: Added. 63 * web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt: Added. 64 * web-platform-tests/wasm/jsapi/instance/constructor.any.html: Added. 65 * web-platform-tests/wasm/jsapi/instance/constructor.any.js: Added. 66 (assert_exported_function): 67 * web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt: Added. 68 * web-platform-tests/wasm/jsapi/instance/constructor.any.worker.html: Added. 69 * web-platform-tests/wasm/jsapi/instance/exports.any-expected.txt: Added. 70 * web-platform-tests/wasm/jsapi/instance/exports.any.html: Added. 71 * web-platform-tests/wasm/jsapi/instance/exports.any.js: Added. 72 (setup): 73 (test): 74 * web-platform-tests/wasm/jsapi/instance/exports.any.worker-expected.txt: Added. 75 * web-platform-tests/wasm/jsapi/instance/exports.any.worker.html: Added. 76 * web-platform-tests/wasm/jsapi/instance/toString.any-expected.txt: Added. 77 * web-platform-tests/wasm/jsapi/instance/toString.any.html: Added. 78 * web-platform-tests/wasm/jsapi/instance/toString.any.js: Added. 79 (test): 80 * web-platform-tests/wasm/jsapi/instance/toString.any.worker-expected.txt: Added. 81 * web-platform-tests/wasm/jsapi/instance/toString.any.worker.html: Added. 82 * web-platform-tests/wasm/jsapi/instance/w3c-import.log: Added. 83 * web-platform-tests/wasm/jsapi/interface.any-expected.txt: Added. 84 * web-platform-tests/wasm/jsapi/interface.any.html: Added. 85 * web-platform-tests/wasm/jsapi/interface.any.js: Added. 86 (test_operations): 87 (test): 88 (const.name.of.interfaces.test): 89 * web-platform-tests/wasm/jsapi/interface.any.worker-expected.txt: Added. 90 * web-platform-tests/wasm/jsapi/interface.any.worker.html: Added. 91 * web-platform-tests/wasm/jsapi/memory/buffer.any-expected.txt: Added. 92 * web-platform-tests/wasm/jsapi/memory/buffer.any.html: Added. 93 * web-platform-tests/wasm/jsapi/memory/buffer.any.js: Added. 94 (test): 95 * web-platform-tests/wasm/jsapi/memory/buffer.any.worker-expected.txt: Added. 96 * web-platform-tests/wasm/jsapi/memory/buffer.any.worker.html: Added. 97 * web-platform-tests/wasm/jsapi/memory/constructor.any-expected.txt: Added. 98 * web-platform-tests/wasm/jsapi/memory/constructor.any.html: Added. 99 * web-platform-tests/wasm/jsapi/memory/constructor.any.js: Added. 100 (assert_Memory): 101 (test): 102 (const.value.of.outOfRangeValues.test): 103 (test.get new): 104 (test.get assert_array_equals): 105 * web-platform-tests/wasm/jsapi/memory/constructor.any.worker-expected.txt: Added. 106 * web-platform-tests/wasm/jsapi/memory/constructor.any.worker.html: Added. 107 * web-platform-tests/wasm/jsapi/memory/grow.any-expected.txt: Added. 108 * web-platform-tests/wasm/jsapi/memory/grow.any.html: Added. 109 * web-platform-tests/wasm/jsapi/memory/grow.any.js: Added. 110 (assert_ArrayBuffer): 111 (test): 112 (valueOf): 113 (const.value.of.outOfRangeValues.test): 114 * web-platform-tests/wasm/jsapi/memory/grow.any.worker-expected.txt: Added. 115 * web-platform-tests/wasm/jsapi/memory/grow.any.worker.html: Added. 116 * web-platform-tests/wasm/jsapi/memory/toString.any-expected.txt: Added. 117 * web-platform-tests/wasm/jsapi/memory/toString.any.html: Added. 118 * web-platform-tests/wasm/jsapi/memory/toString.any.js: Added. 119 (test): 120 * web-platform-tests/wasm/jsapi/memory/toString.any.worker-expected.txt: Added. 121 * web-platform-tests/wasm/jsapi/memory/toString.any.worker.html: Added. 122 * web-platform-tests/wasm/jsapi/memory/w3c-import.log: Added. 123 * web-platform-tests/wasm/jsapi/module/constructor.any-expected.txt: Added. 124 * web-platform-tests/wasm/jsapi/module/constructor.any.html: Added. 125 * web-platform-tests/wasm/jsapi/module/constructor.any.js: Added. 126 (setup): 127 (test): 128 * web-platform-tests/wasm/jsapi/module/constructor.any.worker-expected.txt: Added. 129 * web-platform-tests/wasm/jsapi/module/constructor.any.worker.html: Added. 130 * web-platform-tests/wasm/jsapi/module/customSections.any-expected.txt: Added. 131 * web-platform-tests/wasm/jsapi/module/customSections.any.html: Added. 132 * web-platform-tests/wasm/jsapi/module/customSections.any.js: Added. 133 (assert_ArrayBuffer): 134 (assert_sections): 135 (setup): 136 (test): 137 * web-platform-tests/wasm/jsapi/module/customSections.any.worker-expected.txt: Added. 138 * web-platform-tests/wasm/jsapi/module/customSections.any.worker.html: Added. 139 * web-platform-tests/wasm/jsapi/module/exports.any-expected.txt: Added. 140 * web-platform-tests/wasm/jsapi/module/exports.any.html: Added. 141 * web-platform-tests/wasm/jsapi/module/exports.any.js: Added. 142 (setup): 143 (assert_ModuleExportDescriptor): 144 (assert_exports): 145 (test): 146 * web-platform-tests/wasm/jsapi/module/exports.any.worker-expected.txt: Added. 147 * web-platform-tests/wasm/jsapi/module/exports.any.worker.html: Added. 148 * web-platform-tests/wasm/jsapi/module/imports.any-expected.txt: Added. 149 * web-platform-tests/wasm/jsapi/module/imports.any.html: Added. 150 * web-platform-tests/wasm/jsapi/module/imports.any.js: Added. 151 (assert_ModuleImportDescriptor): 152 (assert_imports): 153 (setup): 154 (test): 155 * web-platform-tests/wasm/jsapi/module/imports.any.worker-expected.txt: Added. 156 * web-platform-tests/wasm/jsapi/module/imports.any.worker.html: Added. 157 * web-platform-tests/wasm/jsapi/module/toString.any-expected.txt: Added. 158 * web-platform-tests/wasm/jsapi/module/toString.any.html: Added. 159 * web-platform-tests/wasm/jsapi/module/toString.any.js: Added. 160 (test): 161 * web-platform-tests/wasm/jsapi/module/toString.any.worker-expected.txt: Added. 162 * web-platform-tests/wasm/jsapi/module/toString.any.worker.html: Added. 163 * web-platform-tests/wasm/jsapi/module/w3c-import.log: Added. 164 * web-platform-tests/wasm/jsapi/table/assertions.js: Added. 165 (assert_equal_to_array): 166 * web-platform-tests/wasm/jsapi/table/constructor.any-expected.txt: Added. 167 * web-platform-tests/wasm/jsapi/table/constructor.any.html: Added. 168 * web-platform-tests/wasm/jsapi/table/constructor.any.js: Added. 169 (assert_Table): 170 (test): 171 (const.value.of.outOfRangeValues.test): 172 (test.get const): 173 * web-platform-tests/wasm/jsapi/table/constructor.any.worker-expected.txt: Added. 174 * web-platform-tests/wasm/jsapi/table/constructor.any.worker.html: Added. 175 * web-platform-tests/wasm/jsapi/table/get-set.any-expected.txt: Added. 176 * web-platform-tests/wasm/jsapi/table/get-set.any.html: Added. 177 * web-platform-tests/wasm/jsapi/table/get-set.any.js: Added. 178 (setup): 179 (test): 180 (test.set assert_equal_to_array): 181 (test.const.fn): 182 (valueOf): 183 (const.value.of.outOfRangeValues.test): 184 * web-platform-tests/wasm/jsapi/table/get-set.any.worker-expected.txt: Added. 185 * web-platform-tests/wasm/jsapi/table/get-set.any.worker.html: Added. 186 * web-platform-tests/wasm/jsapi/table/grow.any-expected.txt: Added. 187 * web-platform-tests/wasm/jsapi/table/grow.any.html: Added. 188 * web-platform-tests/wasm/jsapi/table/grow.any.js: Added. 189 (nulls): 190 (test): 191 (valueOf): 192 (const.value.of.outOfRangeValues.test): 193 * web-platform-tests/wasm/jsapi/table/grow.any.worker-expected.txt: Added. 194 * web-platform-tests/wasm/jsapi/table/grow.any.worker.html: Added. 195 * web-platform-tests/wasm/jsapi/table/length.any-expected.txt: Added. 196 * web-platform-tests/wasm/jsapi/table/length.any.html: Added. 197 * web-platform-tests/wasm/jsapi/table/length.any.js: Added. 198 (test): 199 * web-platform-tests/wasm/jsapi/table/length.any.worker-expected.txt: Added. 200 * web-platform-tests/wasm/jsapi/table/length.any.worker.html: Added. 201 * web-platform-tests/wasm/jsapi/table/toString.any-expected.txt: Added. 202 * web-platform-tests/wasm/jsapi/table/toString.any.html: Added. 203 * web-platform-tests/wasm/jsapi/table/toString.any.js: Added. 204 (test): 205 * web-platform-tests/wasm/jsapi/table/toString.any.worker-expected.txt: Added. 206 * web-platform-tests/wasm/jsapi/table/toString.any.worker.html: Added. 207 * web-platform-tests/wasm/jsapi/table/w3c-import.log: Added. 208 * web-platform-tests/wasm/jsapi/w3c-import.log: Added. 209 * web-platform-tests/wasm/jsapi/wasm-constants.js: Added. 210 (bytes): 211 (bytesWithHeader): 212 (makeSig): 213 (makeSig_v_x): 214 (makeSig_v_xx): 215 (makeSig_r_v): 216 (makeSig_r_x): 217 (makeSig_r_xx): 218 (assertTraps): 219 (assertWasmThrows): 220 * web-platform-tests/wasm/jsapi/wasm-module-builder.js: Added. 221 (Binary.prototype.emit_u8): 222 (Binary.prototype.emit_u16): 223 (Binary.prototype.emit_u32): 224 (Binary.prototype.emit_u32v): 225 (Binary.prototype.emit_bytes): 226 (Binary.prototype.emit_string): 227 (Binary.prototype.emit_header): 228 (Binary.prototype.emit_section): 229 (Binary): 230 (WasmFunctionBuilder): 231 (WasmFunctionBuilder.prototype.exportAs): 232 (WasmFunctionBuilder.prototype.exportFunc): 233 (WasmFunctionBuilder.prototype.addBody): 234 (WasmFunctionBuilder.prototype.addLocals): 235 (WasmFunctionBuilder.prototype.end): 236 (WasmGlobalBuilder): 237 (WasmGlobalBuilder.prototype.exportAs): 238 (WasmModuleBuilder): 239 (WasmModuleBuilder.prototype.addStart): 240 (WasmModuleBuilder.prototype.addMemory): 241 (WasmModuleBuilder.prototype.addExplicitSection): 242 (WasmModuleBuilder.prototype.addType): 243 (WasmModuleBuilder.prototype.addGlobal): 244 (WasmModuleBuilder.prototype.addFunction): 245 (WasmModuleBuilder.prototype.addImport): 246 (WasmModuleBuilder.prototype.addImportedGlobal): 247 (WasmModuleBuilder.prototype.addImportedMemory): 248 (WasmModuleBuilder.prototype.addImportedTable): 249 (WasmModuleBuilder.prototype.addExport): 250 (WasmModuleBuilder.prototype.addExportOfKind): 251 (WasmModuleBuilder.prototype.addDataSegment): 252 (WasmModuleBuilder.prototype.exportMemoryAs): 253 (WasmModuleBuilder.prototype.addFunctionTableInit): 254 (WasmModuleBuilder.prototype.appendToTable): 255 (WasmModuleBuilder.prototype.setFunctionTableLength): 256 (WasmModuleBuilder.prototype.toArray): 257 (WasmModuleBuilder.prototype.toBuffer): 258 (WasmModuleBuilder.prototype.instantiate): 259 1 260 2019-07-09 Cathie Chen <cathiechen@igalia.com> 2 261 -
trunk/LayoutTests/imported/w3c/resources/import-expectations.json
r247193 r247440 344 344 "web-platform-tests/wai-aria": "skip", 345 345 "web-platform-tests/wasm": "skip", 346 "web-platform-tests/wasm/jsapi": "import", 346 347 "web-platform-tests/web-animations": "skip", 347 348 "web-platform-tests/web-nfc": "skip", -
trunk/LayoutTests/platform/ios-simulator/TestExpectations
r244197 r247440 124 124 webkit.org/b/195466 imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/ready-states/autoplay.html [ Pass Failure ] 125 125 webkit.org/b/195466 imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/error-codes/error.html [ Pass Failure ] 126 127 imported/w3c/web-platform-tests/wasm [ Skip ] -
trunk/LayoutTests/platform/win/TestExpectations
r247295 r247440 4424 4424 4425 4425 webkit.org/b/198679 fast/events/fire-mousedown-while-pressing-mouse-button.html [ Failure ] 4426 4427 imported/w3c/web-platform-tests/wasm [ Skip ] -
trunk/Source/JavaScriptCore/CMakeLists.txt
r247097 r247440 109 109 wasm/js/WebAssemblyModuleConstructor.cpp 110 110 wasm/js/WebAssemblyModulePrototype.cpp 111 wasm/js/WebAssemblyPrototype.cpp112 111 wasm/js/WebAssemblyRuntimeErrorConstructor.cpp 113 112 wasm/js/WebAssemblyRuntimeErrorPrototype.cpp … … 1012 1011 wasm/WasmTierUpCount.h 1013 1012 1013 wasm/js/JSWebAssembly.h 1014 1014 wasm/js/JSWebAssemblyModule.h 1015 wasm/js/WebAssemblyPrototype.h1016 1015 1017 1016 … … 1221 1220 ${JAVASCRIPTCORE_DIR}/builtins/TypedArrayConstructor.js 1222 1221 ${JAVASCRIPTCORE_DIR}/builtins/TypedArrayPrototype.js 1223 ${JAVASCRIPTCORE_DIR}/builtins/WebAssemblyPrototype.js1224 1222 ) 1225 1223 -
trunk/Source/JavaScriptCore/ChangeLog
r247438 r247440 1 2019-07-15 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Improve wasm wpt test results by fixing miscellaneous issues 4 https://bugs.webkit.org/show_bug.cgi?id=199783 5 6 Reviewed by Mark Lam. 7 8 This patch fixes miscellaneous issues in our Wasm JS API implementation to improve WPT score. 9 I picked trivial ones in this patch to make this easily reviewable. 10 11 1. Remove WebAssemblyPrototype. It does not exist in the spec. Merging WebAssemblyPrototype into JSWebAssembly. 12 2. Fix various attributes. It does not match to the usual JSC builtin's convention. But this change 13 is correct because they are changed to be matched against WebIDL definition, and WebAssembly implementation 14 follows WebIDL. In the future, we could move WebCore WebIDL things into WTF layer and even use (or leverage 15 some of utility functions) in our WebAssembly JS API implementation. 16 3. Fix how we interpret "present" in WebAssembly spec. This does not mean [[HasProperty]] result. It follows to 17 WebIDL spec, and it means that [[Get]] result is not undefined. 18 4. Add argument count check to Module.customSections, which is required because the method is defined in WebIDL. 19 5. Fix toNonWrappingUint32 to match it to WebIDL's conversion rule. 20 21 * CMakeLists.txt: 22 * DerivedSources-input.xcfilelist: 23 * DerivedSources-output.xcfilelist: 24 * DerivedSources.make: 25 * JavaScriptCore.xcodeproj/project.pbxproj: 26 * Sources.txt: 27 * builtins/WebAssembly.js: Renamed from Source/JavaScriptCore/builtins/WebAssemblyPrototype.js. 28 * jit/Repatch.cpp: 29 * runtime/JSGlobalObject.cpp: 30 (JSC::JSGlobalObject::init): 31 * runtime/JSModuleLoader.cpp: 32 (JSC::moduleLoaderParseModule): 33 * wasm/js/JSWebAssembly.cpp: 34 (JSC::JSWebAssembly::create): 35 (JSC::JSWebAssembly::finishCreation): 36 (JSC::reject): 37 (JSC::webAssemblyModuleValidateAsyncInternal): 38 (JSC::webAssemblyCompileFunc): 39 (JSC::resolve): 40 (JSC::JSWebAssembly::webAssemblyModuleValidateAsync): 41 (JSC::instantiate): 42 (JSC::compileAndInstantiate): 43 (JSC::JSWebAssembly::instantiate): 44 (JSC::webAssemblyModuleInstantinateAsyncInternal): 45 (JSC::JSWebAssembly::webAssemblyModuleInstantinateAsync): 46 (JSC::webAssemblyInstantiateFunc): 47 (JSC::webAssemblyValidateFunc): 48 (JSC::webAssemblyCompileStreamingInternal): 49 (JSC::webAssemblyInstantiateStreamingInternal): 50 * wasm/js/JSWebAssembly.h: 51 * wasm/js/JSWebAssemblyHelpers.h: 52 (JSC::toNonWrappingUint32): 53 * wasm/js/WebAssemblyCompileErrorConstructor.cpp: 54 (JSC::WebAssemblyCompileErrorConstructor::finishCreation): 55 * wasm/js/WebAssemblyInstanceConstructor.cpp: 56 (JSC::WebAssemblyInstanceConstructor::finishCreation): 57 * wasm/js/WebAssemblyInstancePrototype.cpp: 58 * wasm/js/WebAssemblyLinkErrorConstructor.cpp: 59 (JSC::WebAssemblyLinkErrorConstructor::finishCreation): 60 * wasm/js/WebAssemblyMemoryConstructor.cpp: 61 (JSC::constructJSWebAssemblyMemory): 62 (JSC::WebAssemblyMemoryConstructor::finishCreation): 63 * wasm/js/WebAssemblyMemoryPrototype.cpp: 64 * wasm/js/WebAssemblyModuleConstructor.cpp: 65 (JSC::webAssemblyModuleCustomSections): 66 (JSC::WebAssemblyModuleConstructor::finishCreation): 67 * wasm/js/WebAssemblyPrototype.cpp: Removed. 68 * wasm/js/WebAssemblyPrototype.h: Removed. 69 * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp: 70 (JSC::WebAssemblyRuntimeErrorConstructor::finishCreation): 71 * wasm/js/WebAssemblyTableConstructor.cpp: 72 (JSC::constructJSWebAssemblyTable): 73 (JSC::WebAssemblyTableConstructor::finishCreation): 74 * wasm/js/WebAssemblyTablePrototype.cpp: 75 1 76 2019-07-15 Youenn Fablet <youenn@apple.com> 2 77 -
trunk/Source/JavaScriptCore/DerivedSources-input.xcfilelist
r246567 r247440 58 58 $(PROJECT_DIR)/builtins/TypedArrayConstructor.js 59 59 $(PROJECT_DIR)/builtins/TypedArrayPrototype.js 60 $(PROJECT_DIR)/builtins/WebAssembly Prototype.js60 $(PROJECT_DIR)/builtins/WebAssembly.js 61 61 $(PROJECT_DIR)/bytecode/BytecodeList.rb 62 62 $(PROJECT_DIR)/create_hash_table … … 184 184 $(PROJECT_DIR)/wasm/js/WebAssemblyModuleConstructor.cpp 185 185 $(PROJECT_DIR)/wasm/js/WebAssemblyModulePrototype.cpp 186 $(PROJECT_DIR)/wasm/js/WebAssemblyPrototype.cpp187 186 $(PROJECT_DIR)/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp 188 187 $(PROJECT_DIR)/wasm/js/WebAssemblyRuntimeErrorPrototype.cpp -
trunk/Source/JavaScriptCore/DerivedSources-output.xcfilelist
r243011 r247440 70 70 $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/WebAssemblyModuleConstructor.lut.h 71 71 $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/WebAssemblyModulePrototype.lut.h 72 $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/WebAssemblyPrototype.lut.h73 72 $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/WebAssemblyRuntimeErrorConstructor.lut.h 74 73 $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/WebAssemblyRuntimeErrorPrototype.lut.h -
trunk/Source/JavaScriptCore/DerivedSources.make
r246567 r247440 120 120 $(JavaScriptCore)/builtins/TypedArrayConstructor.js \ 121 121 $(JavaScriptCore)/builtins/TypedArrayPrototype.js \ 122 $(JavaScriptCore)/builtins/WebAssembly Prototype.js \122 $(JavaScriptCore)/builtins/WebAssembly.js \ 123 123 # 124 124 … … 184 184 WebAssemblyModuleConstructor.lut.h \ 185 185 WebAssemblyModulePrototype.lut.h \ 186 WebAssemblyPrototype.lut.h \187 186 WebAssemblyRuntimeErrorConstructor.lut.h \ 188 187 WebAssemblyRuntimeErrorPrototype.lut.h \ -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r247432 r247440 1574 1574 AD2FCC201DB59CB200B3E736 /* WebAssemblyTableConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2FCC141DB59C5900B3E736 /* WebAssemblyTableConstructor.lut.h */; }; 1575 1575 AD2FCC211DB59CB200B3E736 /* WebAssemblyTablePrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2FCC151DB59C5900B3E736 /* WebAssemblyTablePrototype.lut.h */; }; 1576 AD2FCC2D1DB838FD00B3E736 /* WebAssemblyPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = AD2FCC271DB838C400B3E736 /* WebAssemblyPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };1577 1576 AD412B341E7B2E9E008AF157 /* WasmContext.h in Headers */ = {isa = PBXBuildFile; fileRef = AD412B321E7B2E8A008AF157 /* WasmContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1578 1577 AD4252511E5D0E14009D2A97 /* FullCodeOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = AD4252501E5D0DEB009D2A97 /* FullCodeOrigin.h */; }; … … 4513 4512 AD2FCC141DB59C5900B3E736 /* WebAssemblyTableConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAssemblyTableConstructor.lut.h; sourceTree = "<group>"; }; 4514 4513 AD2FCC151DB59C5900B3E736 /* WebAssemblyTablePrototype.lut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebAssemblyTablePrototype.lut.h; sourceTree = "<group>"; }; 4515 AD2FCC261DB838C400B3E736 /* WebAssemblyPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyPrototype.cpp; path = js/WebAssemblyPrototype.cpp; sourceTree = "<group>"; };4516 AD2FCC271DB838C400B3E736 /* WebAssemblyPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyPrototype.h; path = js/WebAssemblyPrototype.h; sourceTree = "<group>"; };4517 4514 AD2FCC321DC4045300B3E736 /* WasmFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WasmFormat.cpp; sourceTree = "<group>"; }; 4518 4515 AD412B321E7B2E8A008AF157 /* WasmContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WasmContext.h; sourceTree = "<group>"; }; … … 4817 4814 E39DA4A41B7E8B7C0084F33A /* JSModuleRecord.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSModuleRecord.cpp; sourceTree = "<group>"; }; 4818 4815 E39DA4A51B7E8B7C0084F33A /* JSModuleRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSModuleRecord.h; sourceTree = "<group>"; }; 4816 E39E030D22D9EA3E00408C18 /* WebAssembly.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = WebAssembly.js; sourceTree = "<group>"; }; 4819 4817 E39EEAF12281244C008474F4 /* ObjectToStringAdaptiveStructureWatchpoint.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ObjectToStringAdaptiveStructureWatchpoint.cpp; sourceTree = "<group>"; }; 4820 4818 E39EEAF22281244C008474F4 /* ObjectToStringAdaptiveStructureWatchpoint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ObjectToStringAdaptiveStructureWatchpoint.h; sourceTree = "<group>"; }; … … 8361 8359 534C457A1BC703DC007476A7 /* TypedArrayConstructor.js */, 8362 8360 53917E831B791CB8000EBD33 /* TypedArrayPrototype.js */, 8361 E39E030D22D9EA3E00408C18 /* WebAssembly.js */, 8363 8362 ); 8364 8363 path = builtins; … … 8423 8422 AD4937C51DDCDCF00077C807 /* WebAssemblyModuleRecord.cpp */, 8424 8423 AD4937C61DDCDCF00077C807 /* WebAssemblyModuleRecord.h */, 8425 AD2FCC261DB838C400B3E736 /* WebAssemblyPrototype.cpp */,8426 AD2FCC271DB838C400B3E736 /* WebAssemblyPrototype.h */,8427 8424 AD2FCBBC1DB58DA400B3E736 /* WebAssemblyRuntimeErrorConstructor.cpp */, 8428 8425 AD2FCBBD1DB58DA400B3E736 /* WebAssemblyRuntimeErrorConstructor.h */, … … 10065 10062 AD2FCC1D1DB59CB200B3E736 /* WebAssemblyModulePrototype.lut.h in Headers */, 10066 10063 AD4937C81DDD0AAE0077C807 /* WebAssemblyModuleRecord.h in Headers */, 10067 AD2FCC2D1DB838FD00B3E736 /* WebAssemblyPrototype.h in Headers */,10068 10064 AD2FCBF91DB58DAD00B3E736 /* WebAssemblyRuntimeErrorConstructor.h in Headers */, 10069 10065 AD2FCC1E1DB59CB200B3E736 /* WebAssemblyRuntimeErrorConstructor.lut.h in Headers */, -
trunk/Source/JavaScriptCore/Sources.txt
r246567 r247440 1054 1054 wasm/js/WebAssemblyModulePrototype.cpp 1055 1055 wasm/js/WebAssemblyModuleRecord.cpp 1056 wasm/js/WebAssemblyPrototype.cpp1057 1056 wasm/js/WebAssemblyRuntimeErrorConstructor.cpp 1058 1057 wasm/js/WebAssemblyRuntimeErrorPrototype.cpp -
trunk/Source/JavaScriptCore/jit/Repatch.cpp
r246372 r247440 52 52 #include "JSModuleNamespaceObject.h" 53 53 #include "JSWebAssembly.h" 54 #include "JSWebAssemblyModule.h" 54 55 #include "LinkBuffer.h" 55 56 #include "ModuleNamespaceAccessCase.h" … … 63 64 #include "SuperSampler.h" 64 65 #include "ThunkGenerators.h" 66 #include "WebAssemblyFunction.h" 67 #include "WebAssemblyToJSCallee.h" 65 68 #include <wtf/CommaPrinter.h> 66 69 #include <wtf/ListDump.h> -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r247173 r247440 126 126 #include "JSWeakSet.h" 127 127 #include "JSWebAssembly.h" 128 #include "JSWebAssemblyCompileError.h" 129 #include "JSWebAssemblyInstance.h" 130 #include "JSWebAssemblyLinkError.h" 131 #include "JSWebAssemblyMemory.h" 132 #include "JSWebAssemblyModule.h" 133 #include "JSWebAssemblyRuntimeError.h" 134 #include "JSWebAssemblyTable.h" 128 135 #include "JSWithScope.h" 129 136 #include "LazyClassStructureInlines.h" … … 179 186 #include "WeakSetConstructor.h" 180 187 #include "WeakSetPrototype.h" 181 #include "WebAssemblyPrototype.h" 188 #include "WebAssemblyCompileErrorConstructor.h" 189 #include "WebAssemblyCompileErrorPrototype.h" 190 #include "WebAssemblyFunction.h" 191 #include "WebAssemblyInstanceConstructor.h" 192 #include "WebAssemblyInstancePrototype.h" 193 #include "WebAssemblyLinkErrorConstructor.h" 194 #include "WebAssemblyLinkErrorPrototype.h" 195 #include "WebAssemblyMemoryConstructor.h" 196 #include "WebAssemblyMemoryPrototype.h" 197 #include "WebAssemblyModuleConstructor.h" 198 #include "WebAssemblyModulePrototype.h" 199 #include "WebAssemblyModuleRecord.h" 200 #include "WebAssemblyRuntimeErrorConstructor.h" 201 #include "WebAssemblyRuntimeErrorPrototype.h" 202 #include "WebAssemblyTableConstructor.h" 203 #include "WebAssemblyTablePrototype.h" 182 204 #include "WebAssemblyToJSCallee.h" 183 205 #include <wtf/RandomNumber.h> … … 1061 1083 #if ENABLE(WEBASSEMBLY) 1062 1084 if (Wasm::isSupported()) { 1063 auto* webAssemblyPrototype = WebAssemblyPrototype::create(vm, this, WebAssemblyPrototype::createStructure(vm, this, m_objectPrototype.get()));1064 1085 m_webAssemblyModuleRecordStructure.initLater( 1065 1086 [] (const Initializer<Structure>& init) { … … 1082 1103 init.set(WebAssemblyToJSCallee::createStructure(init.vm, init.owner, jsNull())); 1083 1104 }); 1084 auto* webAssembly = JSWebAssembly::create(vm, this, JSWebAssembly::createStructure(vm, this, webAssemblyPrototype));1105 auto* webAssembly = JSWebAssembly::create(vm, this, JSWebAssembly::createStructure(vm, this, m_objectPrototype.get())); 1085 1106 putDirectWithoutTransition(vm, Identifier::fromString(exec, "WebAssembly"), webAssembly, static_cast<unsigned>(PropertyAttribute::DontEnum)); 1086 1107 -
trunk/Source/JavaScriptCore/runtime/JSModuleLoader.cpp
r247403 r247440 42 42 #include "JSModuleRecord.h" 43 43 #include "JSSourceCode.h" 44 #include "JSWebAssembly.h" 44 45 #include "ModuleAnalyzer.h" 45 46 #include "Nodes.h" … … 47 48 #include "Parser.h" 48 49 #include "ParserError.h" 49 #include "WebAssemblyPrototype.h"50 50 51 51 namespace JSC { … … 414 414 #if ENABLE(WEBASSEMBLY) 415 415 if (sourceCode.provider()->sourceType() == SourceProviderSourceType::WebAssembly) 416 return JSValue::encode( WebAssemblyPrototype::instantiate(exec, deferred, moduleKey, jsSourceCode));416 return JSValue::encode(JSWebAssembly::instantiate(exec, deferred, moduleKey, jsSourceCode)); 417 417 #endif 418 418 -
trunk/Source/JavaScriptCore/wasm/js/JSWebAssembly.cpp
r243011 r247440 29 29 #if ENABLE(WEBASSEMBLY) 30 30 31 #include "CatchScope.h" 32 #include "Exception.h" 33 #include "FunctionPrototype.h" 34 #include "JSCBuiltins.h" 31 35 #include "JSCInlines.h" 36 #include "JSModuleNamespaceObject.h" 37 #include "JSPromiseDeferred.h" 38 #include "JSToWasm.h" 39 #include "JSWebAssemblyHelpers.h" 40 #include "JSWebAssemblyInstance.h" 41 #include "JSWebAssemblyModule.h" 42 #include "ObjectConstructor.h" 43 #include "Options.h" 44 #include "PromiseDeferredTimer.h" 45 #include "StrongInlines.h" 46 #include "ThrowScope.h" 47 #include "WasmBBQPlan.h" 48 #include "WasmToJS.h" 49 #include "WasmWorklist.h" 50 #include "WebAssemblyInstanceConstructor.h" 51 #include "WebAssemblyModuleConstructor.h" 52 53 using JSC::Wasm::Plan; 54 using JSC::Wasm::BBQPlan; 32 55 33 56 namespace JSC { … … 47 70 #undef DEFINE_CALLBACK_FOR_CONSTRUCTOR 48 71 72 static EncodedJSValue JSC_HOST_CALL webAssemblyCompileFunc(ExecState*); 73 static EncodedJSValue JSC_HOST_CALL webAssemblyInstantiateFunc(ExecState*); 74 static EncodedJSValue JSC_HOST_CALL webAssemblyValidateFunc(ExecState*); 75 49 76 } 50 77 … … 53 80 namespace JSC { 54 81 55 const ClassInfo JSWebAssembly::s_info = { "WebAssembly", &Base::s_info, & jsWebAssemblyTable, nullptr, CREATE_METHOD_TABLE(JSWebAssembly) };82 const ClassInfo JSWebAssembly::s_info = { "WebAssembly", &Base::s_info, &webAssemblyTable, nullptr, CREATE_METHOD_TABLE(JSWebAssembly) }; 56 83 57 84 /* Source for JSWebAssembly.lut.h 58 @begin jsWebAssemblyTable85 @begin webAssemblyTable 59 86 CompileError createWebAssemblyCompileError DontEnum|PropertyCallback 60 87 Instance createWebAssemblyInstance DontEnum|PropertyCallback … … 64 91 RuntimeError createWebAssemblyRuntimeError DontEnum|PropertyCallback 65 92 Table createWebAssemblyTable DontEnum|PropertyCallback 93 compile webAssemblyCompileFunc Function 1 94 instantiate webAssemblyInstantiateFunc Function 1 95 validate webAssemblyValidateFunc Function 1 66 96 @end 67 97 */ 68 98 69 JSWebAssembly* JSWebAssembly::create(VM& vm, JSGlobalObject* , Structure* structure)99 JSWebAssembly* JSWebAssembly::create(VM& vm, JSGlobalObject* globalObject, Structure* structure) 70 100 { 71 101 auto* object = new (NotNull, allocateCell<JSWebAssembly>(vm.heap)) JSWebAssembly(vm, structure); 72 object->finishCreation(vm );102 object->finishCreation(vm, globalObject); 73 103 return object; 74 104 } … … 79 109 } 80 110 81 void JSWebAssembly::finishCreation(VM& vm )111 void JSWebAssembly::finishCreation(VM& vm, JSGlobalObject* globalObject) 82 112 { 83 113 Base::finishCreation(vm); 84 114 ASSERT(inherits(vm, info())); 115 if (Options::useWebAssemblyStreamingApi()) { 116 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("compileStreaming", webAssemblyCompileStreamingCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 117 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("instantiateStreaming", webAssemblyInstantiateStreamingCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); 118 } 85 119 } 86 120 … … 90 124 } 91 125 126 static void reject(ExecState* exec, CatchScope& catchScope, JSPromiseDeferred* promise) 127 { 128 Exception* exception = catchScope.exception(); 129 ASSERT(exception); 130 catchScope.clearException(); 131 promise->reject(exec, exception->value()); 132 CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, void()); 133 } 134 135 static void webAssemblyModuleValidateAsyncInternal(ExecState* exec, JSPromiseDeferred* promise, Vector<uint8_t>&& source) 136 { 137 VM& vm = exec->vm(); 138 auto* globalObject = exec->lexicalGlobalObject(); 139 140 Vector<Strong<JSCell>> dependencies; 141 dependencies.append(Strong<JSCell>(vm, globalObject)); 142 143 vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies)); 144 145 Wasm::Module::validateAsync(&vm.wasmContext, WTFMove(source), createSharedTask<Wasm::Module::CallbackType>([promise, globalObject, &vm] (Wasm::Module::ValidationResult&& result) mutable { 146 vm.promiseDeferredTimer->scheduleWorkSoon(promise, [promise, globalObject, result = WTFMove(result), &vm] () mutable { 147 auto scope = DECLARE_CATCH_SCOPE(vm); 148 ExecState* exec = globalObject->globalExec(); 149 JSValue module = JSWebAssemblyModule::createStub(vm, exec, globalObject->webAssemblyModuleStructure(), WTFMove(result)); 150 if (UNLIKELY(scope.exception())) { 151 reject(exec, scope, promise); 152 return; 153 } 154 155 promise->resolve(exec, module); 156 CLEAR_AND_RETURN_IF_EXCEPTION(scope, void()); 157 }); 158 })); 159 } 160 161 static EncodedJSValue JSC_HOST_CALL webAssemblyCompileFunc(ExecState* exec) 162 { 163 VM& vm = exec->vm(); 164 auto throwScope = DECLARE_THROW_SCOPE(vm); 165 auto* globalObject = exec->lexicalGlobalObject(); 166 167 JSPromiseDeferred* promise = JSPromiseDeferred::tryCreate(exec, globalObject); 168 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 169 170 { 171 auto catchScope = DECLARE_CATCH_SCOPE(vm); 172 Vector<uint8_t> source = createSourceBufferFromValue(vm, exec, exec->argument(0)); 173 174 if (UNLIKELY(catchScope.exception())) 175 reject(exec, catchScope, promise); 176 else 177 webAssemblyModuleValidateAsyncInternal(exec, promise, WTFMove(source)); 178 179 return JSValue::encode(promise->promise()); 180 } 181 } 182 183 enum class Resolve { WithInstance, WithModuleRecord, WithModuleAndInstance }; 184 static void resolve(VM& vm, ExecState* exec, JSPromiseDeferred* promise, JSWebAssemblyInstance* instance, JSWebAssemblyModule* module, JSObject* importObject, Ref<Wasm::CodeBlock>&& codeBlock, Resolve resolveKind, Wasm::CreationMode creationMode) 185 { 186 auto scope = DECLARE_CATCH_SCOPE(vm); 187 instance->finalizeCreation(vm, exec, WTFMove(codeBlock), importObject, creationMode); 188 RETURN_IF_EXCEPTION(scope, reject(exec, scope, promise)); 189 190 if (resolveKind == Resolve::WithInstance) 191 promise->resolve(exec, instance); 192 else if (resolveKind == Resolve::WithModuleRecord) { 193 auto* moduleRecord = instance->moduleNamespaceObject()->moduleRecord(); 194 if (Options::dumpModuleRecord()) 195 moduleRecord->dump(); 196 promise->resolve(exec, moduleRecord); 197 } else { 198 JSObject* result = constructEmptyObject(exec); 199 result->putDirect(vm, Identifier::fromString(&vm, "module"_s), module); 200 result->putDirect(vm, Identifier::fromString(&vm, "instance"_s), instance); 201 promise->resolve(exec, result); 202 } 203 CLEAR_AND_RETURN_IF_EXCEPTION(scope, void()); 204 } 205 206 void JSWebAssembly::webAssemblyModuleValidateAsync(ExecState* exec, JSPromiseDeferred* promise, Vector<uint8_t>&& source) 207 { 208 VM& vm = exec->vm(); 209 auto catchScope = DECLARE_CATCH_SCOPE(vm); 210 webAssemblyModuleValidateAsyncInternal(exec, promise, WTFMove(source)); 211 CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, void()); 212 } 213 214 static void instantiate(VM& vm, ExecState* exec, JSPromiseDeferred* promise, JSWebAssemblyModule* module, JSObject* importObject, const Identifier& moduleKey, Resolve resolveKind, Wasm::CreationMode creationMode) 215 { 216 auto scope = DECLARE_CATCH_SCOPE(vm); 217 // In order to avoid potentially recompiling a module. We first gather all the import/memory information prior to compiling code. 218 JSWebAssemblyInstance* instance = JSWebAssemblyInstance::create(vm, exec, moduleKey, module, importObject, exec->lexicalGlobalObject()->webAssemblyInstanceStructure(), Ref<Wasm::Module>(module->module()), creationMode); 219 RETURN_IF_EXCEPTION(scope, reject(exec, scope, promise)); 220 221 Vector<Strong<JSCell>> dependencies; 222 // The instance keeps the module alive. 223 dependencies.append(Strong<JSCell>(vm, instance)); 224 dependencies.append(Strong<JSCell>(vm, importObject)); 225 vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies)); 226 // Note: This completion task may or may not get called immediately. 227 module->module().compileAsync(&vm.wasmContext, instance->memoryMode(), createSharedTask<Wasm::CodeBlock::CallbackType>([promise, instance, module, importObject, resolveKind, creationMode, &vm] (Ref<Wasm::CodeBlock>&& refCodeBlock) mutable { 228 RefPtr<Wasm::CodeBlock> codeBlock = WTFMove(refCodeBlock); 229 vm.promiseDeferredTimer->scheduleWorkSoon(promise, [promise, instance, module, importObject, resolveKind, creationMode, &vm, codeBlock = WTFMove(codeBlock)] () mutable { 230 ExecState* exec = instance->globalObject(vm)->globalExec(); 231 resolve(vm, exec, promise, instance, module, importObject, codeBlock.releaseNonNull(), resolveKind, creationMode); 232 }); 233 }), &Wasm::createJSToWasmWrapper, &Wasm::wasmToJSException); 234 } 235 236 static void compileAndInstantiate(VM& vm, ExecState* exec, JSPromiseDeferred* promise, const Identifier& moduleKey, JSValue buffer, JSObject* importObject, Resolve resolveKind, Wasm::CreationMode creationMode) 237 { 238 auto scope = DECLARE_CATCH_SCOPE(vm); 239 240 auto* globalObject = exec->lexicalGlobalObject(); 241 242 JSCell* moduleKeyCell = identifierToJSValue(vm, moduleKey).asCell(); 243 Vector<Strong<JSCell>> dependencies; 244 dependencies.append(Strong<JSCell>(vm, importObject)); 245 dependencies.append(Strong<JSCell>(vm, moduleKeyCell)); 246 vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies)); 247 248 Vector<uint8_t> source = createSourceBufferFromValue(vm, exec, buffer); 249 RETURN_IF_EXCEPTION(scope, reject(exec, scope, promise)); 250 251 Wasm::Module::validateAsync(&vm.wasmContext, WTFMove(source), createSharedTask<Wasm::Module::CallbackType>([promise, importObject, moduleKeyCell, globalObject, resolveKind, creationMode, &vm] (Wasm::Module::ValidationResult&& result) mutable { 252 vm.promiseDeferredTimer->scheduleWorkSoon(promise, [promise, importObject, moduleKeyCell, globalObject, result = WTFMove(result), resolveKind, creationMode, &vm] () mutable { 253 auto scope = DECLARE_CATCH_SCOPE(vm); 254 ExecState* exec = globalObject->globalExec(); 255 JSWebAssemblyModule* module = JSWebAssemblyModule::createStub(vm, exec, globalObject->webAssemblyModuleStructure(), WTFMove(result)); 256 if (UNLIKELY(scope.exception())) 257 return reject(exec, scope, promise); 258 259 const Identifier moduleKey = JSValue(moduleKeyCell).toPropertyKey(exec); 260 if (UNLIKELY(scope.exception())) 261 return reject(exec, scope, promise); 262 263 instantiate(vm, exec, promise, module, importObject, moduleKey, resolveKind, creationMode); 264 }); 265 })); 266 } 267 268 JSValue JSWebAssembly::instantiate(ExecState* exec, JSPromiseDeferred* promise, const Identifier& moduleKey, JSValue argument) 269 { 270 VM& vm = exec->vm(); 271 compileAndInstantiate(vm, exec, promise, moduleKey, argument, nullptr, Resolve::WithModuleRecord, Wasm::CreationMode::FromModuleLoader); 272 return promise->promise(); 273 } 274 275 static void webAssemblyModuleInstantinateAsyncInternal(ExecState* exec, JSPromiseDeferred* promise, Vector<uint8_t>&& source, JSObject* importObject) 276 { 277 auto* globalObject = exec->lexicalGlobalObject(); 278 VM& vm = exec->vm(); 279 280 Vector<Strong<JSCell>> dependencies; 281 dependencies.append(Strong<JSCell>(vm, importObject)); 282 dependencies.append(Strong<JSCell>(vm, globalObject)); 283 vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies)); 284 285 Wasm::Module::validateAsync(&vm.wasmContext, WTFMove(source), createSharedTask<Wasm::Module::CallbackType>([promise, importObject, globalObject, &vm] (Wasm::Module::ValidationResult&& result) mutable { 286 vm.promiseDeferredTimer->scheduleWorkSoon(promise, [promise, importObject, globalObject, result = WTFMove(result), &vm] () mutable { 287 auto scope = DECLARE_CATCH_SCOPE(vm); 288 ExecState* exec = globalObject->globalExec(); 289 JSWebAssemblyModule* module = JSWebAssemblyModule::createStub(vm, exec, globalObject->webAssemblyModuleStructure(), WTFMove(result)); 290 if (UNLIKELY(scope.exception())) 291 return reject(exec, scope, promise); 292 293 instantiate(vm, exec, promise, module, importObject, JSWebAssemblyInstance::createPrivateModuleKey(), Resolve::WithModuleAndInstance, Wasm::CreationMode::FromJS); 294 CLEAR_AND_RETURN_IF_EXCEPTION(scope, reject(exec, scope, promise)); 295 }); 296 })); 297 } 298 299 void JSWebAssembly::webAssemblyModuleInstantinateAsync(ExecState* exec, JSPromiseDeferred* promise, Vector<uint8_t>&& source, JSObject* importedObject) 300 { 301 VM& vm = exec->vm(); 302 auto catchScope = DECLARE_CATCH_SCOPE(vm); 303 webAssemblyModuleInstantinateAsyncInternal(exec, promise, WTFMove(source), importedObject); 304 CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, void()); 305 } 306 307 static EncodedJSValue JSC_HOST_CALL webAssemblyInstantiateFunc(ExecState* exec) 308 { 309 VM& vm = exec->vm(); 310 auto throwScope = DECLARE_THROW_SCOPE(vm); 311 auto* globalObject = exec->lexicalGlobalObject(); 312 313 JSPromiseDeferred* promise = JSPromiseDeferred::tryCreate(exec, globalObject); 314 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 315 316 { 317 auto catchScope = DECLARE_CATCH_SCOPE(vm); 318 319 JSValue importArgument = exec->argument(1); 320 JSObject* importObject = importArgument.getObject(); 321 if (UNLIKELY(!importArgument.isUndefined() && !importObject)) { 322 promise->reject(exec, createTypeError(exec, 323 "second argument to WebAssembly.instantiate must be undefined or an Object"_s, defaultSourceAppender, runtimeTypeForValue(vm, importArgument))); 324 CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, JSValue::encode(promise->promise())); 325 } else { 326 JSValue firstArgument = exec->argument(0); 327 if (auto* module = jsDynamicCast<JSWebAssemblyModule*>(vm, firstArgument)) 328 instantiate(vm, exec, promise, module, importObject, JSWebAssemblyInstance::createPrivateModuleKey(), Resolve::WithInstance, Wasm::CreationMode::FromJS); 329 else 330 compileAndInstantiate(vm, exec, promise, JSWebAssemblyInstance::createPrivateModuleKey(), firstArgument, importObject, Resolve::WithModuleAndInstance, Wasm::CreationMode::FromJS); 331 } 332 333 return JSValue::encode(promise->promise()); 334 } 335 } 336 337 static EncodedJSValue JSC_HOST_CALL webAssemblyValidateFunc(ExecState* exec) 338 { 339 VM& vm = exec->vm(); 340 auto scope = DECLARE_THROW_SCOPE(vm); 341 342 auto [base, byteSize] = getWasmBufferFromValue(exec, exec->argument(0)); 343 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 344 BBQPlan plan(&vm.wasmContext, BBQPlan::Validation, Plan::dontFinalize()); 345 // FIXME: We might want to throw an OOM exception here if we detect that something will OOM. 346 // https://bugs.webkit.org/show_bug.cgi?id=166015 347 return JSValue::encode(jsBoolean(plan.parseAndValidateModule(base, byteSize))); 348 } 349 350 EncodedJSValue JSC_HOST_CALL webAssemblyCompileStreamingInternal(ExecState* exec) 351 { 352 VM& vm = exec->vm(); 353 auto* globalObject = exec->lexicalGlobalObject(); 354 auto catchScope = DECLARE_CATCH_SCOPE(vm); 355 356 JSPromiseDeferred* promise = JSPromiseDeferred::tryCreate(exec, globalObject); 357 358 Vector<Strong<JSCell>> dependencies; 359 dependencies.append(Strong<JSCell>(vm, globalObject)); 360 vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies)); 361 362 if (globalObject->globalObjectMethodTable()->compileStreaming) 363 globalObject->globalObjectMethodTable()->compileStreaming(globalObject, exec, promise, exec->argument(0)); 364 else { 365 // CompileStreaming is not supported in jsc, only in browser environment 366 ASSERT_NOT_REACHED(); 367 } 368 369 CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, JSValue::encode(promise->promise())); 370 371 return JSValue::encode(promise->promise()); 372 } 373 374 EncodedJSValue JSC_HOST_CALL webAssemblyInstantiateStreamingInternal(ExecState* exec) 375 { 376 VM& vm = exec->vm(); 377 auto throwScope = DECLARE_THROW_SCOPE(vm); 378 auto* globalObject = exec->lexicalGlobalObject(); 379 380 JSPromiseDeferred* promise = JSPromiseDeferred::tryCreate(exec, globalObject); 381 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 382 { 383 auto catchScope = DECLARE_CATCH_SCOPE(vm); 384 385 JSValue importArgument = exec->argument(1); 386 JSObject* importObject = importArgument.getObject(); 387 if (UNLIKELY(!importArgument.isUndefined() && !importObject)) { 388 promise->reject(exec, createTypeError(exec, 389 "second argument to WebAssembly.instantiateStreaming must be undefined or an Object"_s, defaultSourceAppender, runtimeTypeForValue(vm, importArgument))); 390 CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, JSValue::encode(promise->promise())); 391 } else { 392 if (globalObject->globalObjectMethodTable()->instantiateStreaming) { 393 Vector<Strong<JSCell>> dependencies; 394 dependencies.append(Strong<JSCell>(vm, globalObject)); 395 dependencies.append(Strong<JSCell>(vm, importObject)); 396 vm.promiseDeferredTimer->addPendingPromise(vm, promise, WTFMove(dependencies)); 397 398 // FIXME: <http://webkit.org/b/184888> if there's an importObject and it contains a Memory, then we can compile the module with the right memory type (fast or not) by looking at the memory's type. 399 globalObject->globalObjectMethodTable()->instantiateStreaming(globalObject, exec, promise, exec->argument(0), importObject); 400 } else { 401 // InstantiateStreaming is not supported in jsc, only in browser environment. 402 ASSERT_NOT_REACHED(); 403 } 404 } 405 CLEAR_AND_RETURN_IF_EXCEPTION(catchScope, JSValue::encode(promise->promise())); 406 407 return JSValue::encode(promise->promise()); 408 } 409 } 410 92 411 } // namespace JSC 93 412 -
trunk/Source/JavaScriptCore/wasm/js/JSWebAssembly.h
r243011 r247440 29 29 30 30 #include "JSObject.h" 31 #include "JSWebAssemblyCompileError.h" 32 #include "JSWebAssemblyInstance.h" 33 #include "JSWebAssemblyLinkError.h" 34 #include "JSWebAssemblyMemory.h" 35 #include "JSWebAssemblyModule.h" 36 #include "JSWebAssemblyRuntimeError.h" 37 #include "JSWebAssemblyTable.h" 38 #include "WebAssemblyCompileErrorConstructor.h" 39 #include "WebAssemblyCompileErrorPrototype.h" 40 #include "WebAssemblyFunction.h" 41 #include "WebAssemblyInstanceConstructor.h" 42 #include "WebAssemblyInstancePrototype.h" 43 #include "WebAssemblyLinkErrorConstructor.h" 44 #include "WebAssemblyLinkErrorPrototype.h" 45 #include "WebAssemblyMemoryConstructor.h" 46 #include "WebAssemblyMemoryPrototype.h" 47 #include "WebAssemblyModuleConstructor.h" 48 #include "WebAssemblyModulePrototype.h" 49 #include "WebAssemblyModuleRecord.h" 50 #include "WebAssemblyPrototype.h" 51 #include "WebAssemblyRuntimeErrorConstructor.h" 52 #include "WebAssemblyRuntimeErrorPrototype.h" 53 #include "WebAssemblyTableConstructor.h" 54 #include "WebAssemblyTablePrototype.h" 55 #include "WebAssemblyToJSCallee.h" 31 #include "JSPromiseDeferred.h" 56 32 57 33 namespace JSC { … … 67 43 DECLARE_INFO; 68 44 45 JS_EXPORT_PRIVATE static void webAssemblyModuleValidateAsync(ExecState*, JSPromiseDeferred*, Vector<uint8_t>&&); 46 JS_EXPORT_PRIVATE static void webAssemblyModuleInstantinateAsync(ExecState*, JSPromiseDeferred*, Vector<uint8_t>&&, JSObject*); 47 static JSValue instantiate(ExecState*, JSPromiseDeferred*, const Identifier&, JSValue); 48 69 49 protected: 70 void finishCreation(VM& );50 void finishCreation(VM&, JSGlobalObject*); 71 51 72 52 private: … … 74 54 }; 75 55 56 EncodedJSValue JSC_HOST_CALL webAssemblyCompileStreamingInternal(ExecState*); 57 EncodedJSValue JSC_HOST_CALL webAssemblyInstantiateStreamingInternal(ExecState*); 58 76 59 } // namespace JSC 77 60 -
trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyHelpers.h
r247102 r247440 40 40 VM& vm = exec->vm(); 41 41 auto throwScope = DECLARE_THROW_SCOPE(vm); 42 double doubleValue = value.toInteger(exec); 42 43 if (value.isUInt32()) 44 return value.asUInt32(); 45 46 double doubleValue = value.toNumber(exec); 43 47 RETURN_IF_EXCEPTION(throwScope, { }); 44 if (doubleValue < 0 || doubleValue > UINT_MAX) { 45 throwException(exec, throwScope, 46 createRangeError(exec, "Expect an integer argument in the range: [0, 2^32 - 1]"_s)); 47 return { }; 48 49 if (!std::isnan(doubleValue) && !std::isinf(doubleValue)) { 50 double truncedValue = trunc(doubleValue); 51 if (truncedValue >= 0 && truncedValue <= UINT_MAX) 52 return static_cast<uint32_t>(truncedValue); 48 53 } 49 54 50 return static_cast<uint32_t>(doubleValue); 55 throwException(exec, throwScope, createTypeError(exec, "Expect an integer argument in the range: [0, 2^32 - 1]"_s)); 56 return { }; 51 57 } 52 58 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp
r243051 r247440 78 78 Base::finishCreation(vm, "CompileError"_s, NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition); 79 79 putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete); 80 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);80 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum); 81 81 } 82 82 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp
r243051 r247440 109 109 Base::finishCreation(vm, "Instance"_s, NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition); 110 110 putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); 111 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);111 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum); 112 112 } 113 113 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstancePrototype.cpp
r246780 r247440 46 46 /* Source for WebAssemblyInstancePrototype.lut.h 47 47 @begin prototypeTableWebAssemblyInstance 48 exports webAssemblyInstanceProtoFuncExports DontEnum|Accessor 048 exports webAssemblyInstanceProtoFuncExports Accessor 0 49 49 @end 50 50 */ -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.cpp
r243386 r247440 78 78 Base::finishCreation(vm, "LinkError"_s, NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition); 79 79 putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete); 80 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);80 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum); 81 81 } 82 82 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyMemoryConstructor.cpp
r243051 r247440 80 80 Wasm::PageCount maximumPageCount; 81 81 { 82 // In WebIDL, "present" means that [[Get]] result is undefined, not [[HasProperty]] result. 83 // https://heycam.github.io/webidl/#idl-dictionaries 82 84 Identifier maximum = Identifier::fromString(&vm, "maximum"); 83 bool hasProperty = memoryDescriptor->hasProperty(exec, maximum);85 JSValue maxSizeValue = memoryDescriptor->get(exec, maximum); 84 86 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 85 if (hasProperty) { 86 JSValue maxSizeValue = memoryDescriptor->get(exec, maximum); 87 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 87 if (!maxSizeValue.isUndefined()) { 88 88 uint32_t size = toNonWrappingUint32(exec, maxSizeValue); 89 89 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); … … 137 137 Base::finishCreation(vm, "Memory"_s, NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition); 138 138 putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); 139 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);139 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum); 140 140 } 141 141 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyMemoryPrototype.cpp
r246780 r247440 49 49 /* Source for WebAssemblyMemoryPrototype.lut.h 50 50 @begin prototypeTableWebAssemblyMemory 51 grow webAssemblyMemoryProtoFuncGrow DontEnum|Function 152 buffer webAssemblyMemoryProtoFuncBuffer DontEnum|Accessor 051 grow webAssemblyMemoryProtoFuncGrow Function 1 52 buffer webAssemblyMemoryProtoFuncBuffer Accessor 0 53 53 @end 54 54 */ -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp
r243051 r247440 60 60 /* Source for WebAssemblyModuleConstructor.lut.h 61 61 @begin constructorTableWebAssemblyModule 62 customSections webAssemblyModuleCustomSections DontEnum|Function 263 imports webAssemblyModuleImports DontEnum|Function 164 exports webAssemblyModuleExports DontEnum|Function 162 customSections webAssemblyModuleCustomSections Function 2 63 imports webAssemblyModuleImports Function 1 64 exports webAssemblyModuleExports Function 1 65 65 @end 66 66 */ … … 72 72 auto throwScope = DECLARE_THROW_SCOPE(vm); 73 73 74 JSWebAssemblyModule* module = jsDynamicCast<JSWebAssemblyModule*>(vm, exec->argument(0)); 74 if (UNLIKELY(exec->argumentCount() < 2)) 75 return JSValue::encode(throwException(exec, throwScope, createNotEnoughArgumentsError(exec))); 76 77 JSWebAssemblyModule* module = jsDynamicCast<JSWebAssemblyModule*>(vm, exec->uncheckedArgument(0)); 75 78 if (!module) 76 79 return JSValue::encode(throwException(exec, throwScope, createTypeError(exec, "WebAssembly.Module.customSections called with non WebAssembly.Module argument"_s))); 77 80 78 const String sectionNameString = exec-> argument(1).getString(exec);81 const String sectionNameString = exec->uncheckedArgument(1).getString(exec); 79 82 RETURN_IF_EXCEPTION(throwScope, { }); 80 83 … … 204 207 Base::finishCreation(vm, "Module"_s, NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition); 205 208 putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); 206 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);209 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum); 207 210 } 208 211 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp
r244040 r247440 80 80 Base::finishCreation(vm, "RuntimeError"_s, NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition); 81 81 putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete); 82 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);82 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum); 83 83 } 84 84 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp
r246589 r247440 80 80 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 81 81 82 // In WebIDL, "present" means that [[Get]] result is undefined, not [[HasProperty]] result. 83 // https://heycam.github.io/webidl/#idl-dictionaries 82 84 Optional<uint32_t> maximum; 83 85 Identifier maximumIdent = Identifier::fromString(&vm, "maximum"); 84 bool hasProperty = memoryDescriptor->hasProperty(exec, maximumIdent);86 JSValue maxSizeValue = memoryDescriptor->get(exec, maximumIdent); 85 87 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 86 if (hasProperty) { 87 JSValue maxSizeValue = memoryDescriptor->get(exec, maximumIdent); 88 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 88 if (!maxSizeValue.isUndefined()) { 89 89 maximum = toNonWrappingUint32(exec, maxSizeValue); 90 90 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); … … 128 128 Base::finishCreation(vm, "Table"_s, NameVisibility::Visible, NameAdditionMode::WithoutStructureTransition); 129 129 putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly); 130 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum | PropertyAttribute::DontDelete);130 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum); 131 131 } 132 132 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyTablePrototype.cpp
r246780 r247440 49 49 /* Source for WebAssemblyTablePrototype.lut.h 50 50 @begin prototypeTableWebAssemblyTable 51 length webAssemblyTableProtoFuncLength DontEnum|Accessor 052 grow webAssemblyTableProtoFuncGrow DontEnum|Function 153 get webAssemblyTableProtoFuncGet DontEnum|Function 154 set webAssemblyTableProtoFuncSet DontEnum|Function 251 length webAssemblyTableProtoFuncLength Accessor 0 52 grow webAssemblyTableProtoFuncGrow Function 1 53 get webAssemblyTableProtoFuncGet Function 1 54 set webAssemblyTableProtoFuncSet Function 2 55 55 @end 56 56 */ -
trunk/Source/WebCore/ChangeLog
r247438 r247440 1 2019-07-15 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Improve wasm wpt test results by fixing miscellaneous issues 4 https://bugs.webkit.org/show_bug.cgi?id=199783 5 6 Reviewed by Mark Lam. 7 8 Remove WebAssemblyPrototype. 9 10 Tests: imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.html 11 imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.worker.html 12 imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.html 13 imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.worker.html 14 imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.html 15 imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.worker.html 16 imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.html 17 imported/w3c/web-platform-tests/wasm/jsapi/global/value-set.any.worker.html 18 imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.html 19 imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.worker.html 20 imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.html 21 imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.worker.html 22 imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.html 23 imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker.html 24 imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.html 25 imported/w3c/web-platform-tests/wasm/jsapi/instance/exports.any.worker.html 26 imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.html 27 imported/w3c/web-platform-tests/wasm/jsapi/instance/toString.any.worker.html 28 imported/w3c/web-platform-tests/wasm/jsapi/interface.any.html 29 imported/w3c/web-platform-tests/wasm/jsapi/interface.any.worker.html 30 imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.html 31 imported/w3c/web-platform-tests/wasm/jsapi/memory/buffer.any.worker.html 32 imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.html 33 imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.worker.html 34 imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.html 35 imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.worker.html 36 imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.html 37 imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.worker.html 38 imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.html 39 imported/w3c/web-platform-tests/wasm/jsapi/module/constructor.any.worker.html 40 imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.html 41 imported/w3c/web-platform-tests/wasm/jsapi/module/customSections.any.worker.html 42 imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.html 43 imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.worker.html 44 imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.html 45 imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.worker.html 46 imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.html 47 imported/w3c/web-platform-tests/wasm/jsapi/module/toString.any.worker.html 48 imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.html 49 imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.worker.html 50 imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.html 51 imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.worker.html 52 imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.html 53 imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.worker.html 54 imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.html 55 imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.worker.html 56 imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.html 57 imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.worker.html 58 59 * bindings/js/JSDOMWindowBase.cpp: 60 (WebCore::JSDOMWindowBase::compileStreaming): 61 (WebCore::JSDOMWindowBase::instantiateStreaming): 62 1 63 2019-07-15 Youenn Fablet <youenn@apple.com> 2 64 -
trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
r240237 r247440 51 51 #include <JavaScriptCore/JSInternalPromise.h> 52 52 #include <JavaScriptCore/JSInternalPromiseDeferred.h> 53 #include <JavaScriptCore/JSWebAssembly.h> 53 54 #include <JavaScriptCore/Microtask.h> 54 55 #include <JavaScriptCore/PromiseDeferredTimer.h> 55 56 #include <JavaScriptCore/StrongInlines.h> 56 #include <JavaScriptCore/WebAssemblyPrototype.h>57 57 #include <wtf/Language.h> 58 58 #include <wtf/MainThread.h> … … 447 447 handleResponseOnStreamingAction(globalObject, exec, inputResponse, promise, [promise] (JSC::ExecState* exec, const char* data, size_t byteSize) mutable { 448 448 if (auto arrayBuffer = tryAllocate(exec, promise, data, byteSize)) 449 JSC:: WebAssemblyPrototype::webAssemblyModuleValidateAsync(exec, promise, WTFMove(*arrayBuffer));449 JSC::JSWebAssembly::webAssemblyModuleValidateAsync(exec, promise, WTFMove(*arrayBuffer)); 450 450 }); 451 451 } else … … 466 466 handleResponseOnStreamingAction(globalObject, exec, inputResponse, promise, [promise, importedObject] (JSC::ExecState* exec, const char* data, size_t byteSize) mutable { 467 467 if (auto arrayBuffer = tryAllocate(exec, promise, data, byteSize)) 468 JSC:: WebAssemblyPrototype::webAssemblyModuleInstantinateAsync(exec, promise, WTFMove(*arrayBuffer), importedObject);468 JSC::JSWebAssembly::webAssemblyModuleInstantinateAsync(exec, promise, WTFMove(*arrayBuffer), importedObject); 469 469 }); 470 470 } else
Note: See TracChangeset
for help on using the changeset viewer.