[webkit-changes] [WebKit/WebKit] 6880a8: [JSC] Supports Type Reflection for `WebAssembly.Mo...

SUZUKI Sosuke noreply at github.com
Wed Aug 7 19:37:26 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6880a8bf71b04bf75da5ecb783a1dcea6dd08e20
      https://github.com/WebKit/WebKit/commit/6880a8bf71b04bf75da5ecb783a1dcea6dd08e20
  Author: Sosuke Suzuki <aosukeke at gmail.com>
  Date:   2024-08-07 (Wed, 07 Aug 2024)

  Changed paths:
    M JSTests/wasm/js-api/Module.exports.js
    M JSTests/wasm/js-api/Module.imports.js
    A JSTests/wasm/js-api/type-reflection-concrete-types.js
    A JSTests/wasm/js-api/type-reflection-exports.js
    A JSTests/wasm/js-api/type-reflection-imports.js
    M Source/JavaScriptCore/wasm/WasmModuleInformation.h
    M Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp

  Log Message:
  -----------
  [JSC] Supports Type Reflection for `WebAssembly.Module.imports` and `WebAssembly.Module.exports`
https://bugs.webkit.org/show_bug.cgi?id=277608

Reviewed by Yusuke Suzuki.

The current JSC implements part of the WebAssembly Type Reflection proposal[1]. It allows to get
type informations through methods like `WebAssembly.Memory.prototype.type()` and
`WebAssembly.Table.prototype.type()`.

The Type Reflection API should also add a new `type` field to the elements of the arrays returned by
`WebAssembly.Module.imports` and `WebAssembly.Module.exports`[2]. However, this feature is not
currently implemented in JSC. This feature has been implemented to V8[3] and SpiderMonkey[4].

This patch implements Type Reflection for `WebAssembly.Module.imports` and
`WebAssembly.Module.exports`.

[1]: https://github.com/WebAssembly/js-types
[2]: https://webassembly.github.io/js-types/js-api/#modules
[3]: https://chromium-review.googlesource.com/c/v8/v8/+/1763527
[4]: https://hg.mozilla.org/mozilla-central/rev/91e0c6d26de8ba365ec3d462f98d28c75055a89b

* JSTests/wasm/js-api/Module.exports.js:
(assert.truthy):
* JSTests/wasm/js-api/Module.imports.js:
(assert.truthy):
* JSTests/wasm/js-api/type-reflection-concrete-types.js: Added.
(import.as.assert.from.string_appeared_here.assert.throws):
(WebAssembly.Module.exports):
(assert.throws):
* JSTests/wasm/js-api/type-reflection-exports.js: Added.
(import.as.assert.from.string_appeared_here.sameValue):
(async test):
* JSTests/wasm/js-api/type-reflection-imports.js: Added.
(import.as.assert.from.string_appeared_here.sameValue):
* Source/JavaScriptCore/wasm/WasmModuleInformation.h:
(JSC::Wasm::ModuleInformation::global const):
* Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp:
(JSC::createTypeReflectionObject):
(JSC::JSC_DEFINE_HOST_FUNCTION):

Canonical link: https://commits.webkit.org/281974@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list