Changeset 271039 in webkit
- Timestamp:
- Dec 21, 2020 1:31:23 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/wasm/js-api/table.js
r248833 r271039 365 365 assert.truthy(instance.exports.table instanceof WebAssembly.Table); 366 366 } 367 368 { 369 const args = {minimum: 5, element: "funcref"} 370 let minimum = false 371 const proxy = new Proxy(args, { 372 get(target, prop, receiver) { 373 if (prop === "minimum") { 374 minimum = true; 375 } 376 return Reflect.get(...arguments); 377 } 378 }) 379 const table = new WebAssembly.Table(proxy); 380 assert.eq(table.length, 5); 381 assert.truthy(minimum); 382 383 let threw = false; 384 try { 385 new WebAssembly.Table({minimum: 5, initial: 5, element: "funcref"}); 386 } catch (e) { 387 assert.truthy(e instanceof TypeError); 388 assert.eq(e.message, "WebAssembly.Table 'initial' and 'minimum' options are specified at the same time") 389 threw = true; 390 } 391 assert.truthy(threw); 392 } -
trunk/JSTests/wasm/js-api/test_memory_constructor.js
r220265 r271039 82 82 assert(threw); 83 83 } 84 85 { 86 const args = {minimum: 5}; 87 let minimum = false; 88 const proxy = new Proxy(args, { 89 get(target, prop, receiver) { 90 if (prop === "minimum") { 91 minimum = true; 92 } 93 return Reflect.get(...arguments); 94 } 95 }) 96 const mem = new WebAssembly.Memory(proxy); 97 assert(mem.buffer.byteLength === 5 * pageSize); 98 assert(minimum); 99 100 let threw = false; 101 try { 102 new WebAssembly.Memory({minimum: 5, initial: 5}); 103 } catch (e) { 104 assert(e instanceof TypeError); 105 assert(e.message === "WebAssembly.Memory 'initial' and 'minimum' options are specified at the same time"); 106 threw = true; 107 } 108 assert(threw); 109 } -
trunk/LayoutTests/ChangeLog
r271024 r271039 1 2020-12-21 Jessica Tallon <jtallon@igalia.com> 2 3 [JSC] Fix expectation for WASM JS-type reflection WPTs 4 https://bugs.webkit.org/show_bug.cgi?id=219600 5 6 Reviewed by Yusuke Suzuki. 7 8 Changed the expectations for the WASM JS-Type reflections constructor 9 tests as we now support the minimum parameter. 10 11 * LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor-types.tentative.any-expected.txt: 12 * LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-types.tentative.any-expected.txt: 13 * LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor-types.tentative.any.worker-expected.txt: 14 * LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-types.tentative.any.worker-expected.txt: 15 1 16 2020-12-21 Alicia Boya García <aboya@igalia.com> 2 17 -
trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor-types.tentative.any-expected.txt
r269866 r271039 1 1 2 FAIL Initializing with both initial and minimum assert_throws_js: function "() => new WebAssembly.Memory(argument)" did not throw 3 FAIL Zero minimum Expect an integer argument in the range: [0, 2^32 - 1] 4 FAIL Non-zero minimum Expect an integer argument in the range: [0, 2^32 - 1] 2 PASS Initializing with both initial and minimum 3 PASS Zero minimum 4 PASS Non-zero minimum 5 5 -
trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor-types.tentative.any.worker-expected.txt
r269866 r271039 1 1 2 FAIL Initializing with both initial and minimum assert_throws_js: function "() => new WebAssembly.Memory(argument)" did not throw 3 FAIL Zero minimum Expect an integer argument in the range: [0, 2^32 - 1] 4 FAIL Non-zero minimum Expect an integer argument in the range: [0, 2^32 - 1] 2 PASS Initializing with both initial and minimum 3 PASS Zero minimum 4 PASS Non-zero minimum 5 5 -
trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-types.tentative.any-expected.txt
r269866 r271039 1 1 2 FAIL Initializing with both initial and minimum assert_throws_js: function "() => new WebAssembly.Table(argument)" did not throw 3 FAIL Zero minimum Expect an integer argument in the range: [0, 2^32 - 1] 4 FAIL Non-zero minimum Expect an integer argument in the range: [0, 2^32 - 1] 2 PASS Initializing with both initial and minimum 3 PASS Zero minimum 4 PASS Non-zero minimum 5 5 -
trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-types.tentative.any.worker-expected.txt
r269866 r271039 1 1 2 FAIL Initializing with both initial and minimum assert_throws_js: function "() => new WebAssembly.Table(argument)" did not throw 3 FAIL Zero minimum Expect an integer argument in the range: [0, 2^32 - 1] 4 FAIL Non-zero minimum Expect an integer argument in the range: [0, 2^32 - 1] 2 PASS Initializing with both initial and minimum 3 PASS Zero minimum 4 PASS Non-zero minimum 5 5 -
trunk/Source/JavaScriptCore/ChangeLog
r271034 r271039 1 2020-12-21 Jessica Tallon <jtallon@igalia.com> 2 3 [JSC] Add minimum parameter to the WASM JS-API for Memory & Table. 4 https://bugs.webkit.org/show_bug.cgi?id=219600 5 6 Reviewed by Yusuke Suzuki. 7 8 This patch adds a "minimum" perameter to the constructor of both WebAssembly.Memory and 9 WebAssembly.Table. This represents the same value as the "initial" perameter. The new 10 perameter name is outlined here [1]. It is part of the JS type reflection proposal. 11 12 [1]: https://github.com/WebAssembly/js-types/blob/master/proposals/js-types/Overview.md#naming-of-size-limits 13 14 * JSTests/wasm/js-api/table.js: 15 * JSTests/wasm/js-api/test_memory_constructor.js: 16 * Source/JavaScriptCore/wasm/js/WebAssemblyMemoryConstructor.cpp: 17 * Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp: 18 1 19 2020-12-21 Keith Miller <keith_miller@apple.com> 2 20 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyMemoryConstructor.cpp
r269974 r271039 69 69 { 70 70 Identifier initial = Identifier::fromString(vm, "initial"); 71 JSValue minSizeValue = memoryDescriptor->get(globalObject, initial);71 JSValue initSizeValue = memoryDescriptor->get(globalObject, initial); 72 72 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 73 Identifier minimum = Identifier::fromString(vm, "minimum"); 74 JSValue minSizeValue = memoryDescriptor->get(globalObject, minimum); 75 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 76 if (!minSizeValue.isUndefined() && !initSizeValue.isUndefined()) { 77 // Error because both specified. 78 return throwVMTypeError(globalObject, throwScope, "WebAssembly.Memory 'initial' and 'minimum' options are specified at the same time"); 79 } 80 if (!initSizeValue.isUndefined()) 81 minSizeValue = initSizeValue; 82 73 83 uint32_t size = toNonWrappingUint32(globalObject, minSizeValue); 74 84 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp
r269552 r271039 82 82 JSValue initialSizeValue = memoryDescriptor->get(globalObject, initialIdent); 83 83 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 84 Identifier minimumIdent = Identifier::fromString(vm, "minimum"); 85 JSValue minSizeValue = memoryDescriptor->get(globalObject, minimumIdent); 86 RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); 87 if (!initialSizeValue.isUndefined() && !minSizeValue.isUndefined()) 88 return throwVMTypeError(globalObject, throwScope, "WebAssembly.Table 'initial' and 'minimum' options are specified at the same time"); 89 90 if (!minSizeValue.isUndefined()) 91 initialSizeValue = minSizeValue; 92 84 93 uint32_t initial = toNonWrappingUint32(globalObject, initialSizeValue); 85 94 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
Note: See TracChangeset
for help on using the changeset viewer.