Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5aa61e8c766a711e9f030173339991f19f5e5d6f
      
https://github.com/WebKit/WebKit/commit/5aa61e8c766a711e9f030173339991f19f5e5d6f
  Author: Asumu Takikawa <as...@igalia.com>
  Date:   2023-11-09 (Thu, 09 Nov 2023)

  Changed paths:
    M JSTests/wasm/gc-spec-harness/sync_index.js
    A JSTests/wasm/gc-spec-tests/extern.wast.js
    M JSTests/wasm/gc/arrays.js
    M JSTests/wasm/gc/const-exprs.js
    M JSTests/wasm/gc/i31.js
    M JSTests/wasm/gc/js-api.js
    M JSTests/wasm/gc/structs.js
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/basic.tentative.any.js
    A 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/casts.tentative.any-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/casts.tentative.any.html
    A 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/casts.tentative.any.js
    A 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/exported-object.tentative.any-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/exported-object.tentative.any.html
    A 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/exported-object.tentative.any.js
    A 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/i31.tentative.any-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/i31.tentative.any.html
    A 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/i31.tentative.any.js
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instanceTestFactory.js
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.js
    M 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/wasm-module-builder.js
    M Source/JavaScriptCore/llint/WebAssembly32_64.asm
    M Source/JavaScriptCore/llint/WebAssembly64.asm
    M Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmBBQJIT.cpp
    M Source/JavaScriptCore/wasm/WasmConstExprGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmFormat.h
    M Source/JavaScriptCore/wasm/WasmGlobal.cpp
    M Source/JavaScriptCore/wasm/WasmOperations.cpp
    M Source/JavaScriptCore/wasm/WasmOperations.h
    M Source/JavaScriptCore/wasm/WasmTypeDefinition.cpp
    M Source/JavaScriptCore/wasm/js/JSWebAssemblyHelpers.h
    M Source/JavaScriptCore/wasm/js/WasmToJS.cpp
    M Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp

  Log Message:
  -----------
  [Wasm-GC] Implement casts at Wasm-JS function call boundaries
https://bugs.webkit.org/show_bug.cgi?id=254693

Reviewed by Justin Michaud.

Allows Wasm GC values to be passed in from JS to Wasm with the
appropriate casts used at the boundary for safety.

These casts are added for setting globals and for function calls between
JS and Wasm. Casts for table mutation were added in a previous patch.

Also adds the WPT tests for the JS API, which are set to run using the
experimental GC flags. This requires modifying some existing tests as
well, due to the test helper changing.

Upstream WPT tests are from commit
5c087e6ad3cfaa1dc38dd93edb3b05e3a9efe5f1 of the GC proposal repo.

Some additional fixes were needed to pass all the JS API tests:
  * ref.i31 was modified to create the i31 canonically in signed format,
    so that it can be passed to JS without changes.
  * when GC is off and typed funcrefs are on, we need to use a different
    code path to check types at the boundary because functions will not
    have an RTT without GC on.

* JSTests/wasm/gc-spec-harness/sync_index.js:
* JSTests/wasm/gc-spec-tests/extern.wast.js: Added.
* JSTests/wasm/gc/arrays.js:
* JSTests/wasm/gc/const-exprs.js:
(async testGCConstExprs):
* JSTests/wasm/gc/i31.js:
* JSTests/wasm/gc/js-api.js:
(testI31):
(testCastFailure):
(testTable):
(testImport):
* JSTests/wasm/gc/structs.js:
* 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/exception/basic.tentative.any.js:
(promise_test.async const):
(promise_test):
* 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/casts.tentative.any-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/casts.tentative.any.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/casts.tentative.any.js:
 Added.
(setup):
(test):
* 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/exported-object.tentative.any-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/exported-object.tentative.any.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/exported-object.tentative.any.js:
 Added.
(setup):
(test):
(set string_appeared_here):
* 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/i31.tentative.any-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/i31.tentative.any.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/gc/i31.tentative.any.js: 
Added.
(setup):
(test):
* LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instanceTestFactory.js:
* LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.js:
(test):
* LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/wasm-module-builder.js:
(wasmRefNullType):
(wasmRefType):
(GCInstr):
(Binary.prototype.emit_heap_type):
(Binary.prototype.emit_type):
(Binary.prototype.emit_init_expr):
(WasmGlobalBuilder):
(checkExpr):
(WasmTableBuilder):
(makeField):
(WasmStruct):
(WasmArray):
(WasmModuleBuilder):
(WasmModuleBuilder.prototype.addType):
(WasmModuleBuilder.prototype.addStruct):
(WasmModuleBuilder.prototype.addArray):
(WasmModuleBuilder.defaultFor):
(WasmModuleBuilder.prototype.addGlobal):
(WasmModuleBuilder.prototype.addTable):
(WasmModuleBuilder.prototype.addTag):
(WasmModuleBuilder.prototype.addImportedTag):
(WasmModuleBuilder.prototype.startRecGroup):
(WasmModuleBuilder.prototype.endRecGroup):
(WasmModuleBuilder.prototype.toBuffer):
(WasmModuleBuilder.prototype.addException): Deleted.
(WasmModuleBuilder.prototype.addImportedException): Deleted.
* Source/JavaScriptCore/llint/WebAssembly32_64.asm:
* Source/JavaScriptCore/llint/WebAssembly64.asm:
* Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::addRefI31):
(JSC::Wasm::B3IRGenerator::addI31GetS):
(JSC::Wasm::B3IRGenerator::addI31GetU):
* Source/JavaScriptCore/wasm/WasmBBQJIT.cpp:
(JSC::Wasm::BBQJIT::getGlobal):
(JSC::Wasm::BBQJIT::setGlobal):
(JSC::Wasm::BBQJIT::addRefI31):
(JSC::Wasm::BBQJIT::addI31GetS):
(JSC::Wasm::BBQJIT::addI31GetU):
* Source/JavaScriptCore/wasm/WasmConstExprGenerator.cpp:
(JSC::Wasm::ConstExprGenerator::addRefI31):
* Source/JavaScriptCore/wasm/WasmFormat.h:
(JSC::Wasm::isSubtype):
* Source/JavaScriptCore/wasm/WasmGlobal.cpp:
(JSC::Wasm::Global::set):
* Source/JavaScriptCore/wasm/WasmOperations.cpp:
(JSC::Wasm::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/wasm/WasmOperations.h:
* Source/JavaScriptCore/wasm/WasmTypeDefinition.cpp:
(JSC::Wasm::TypeInformation::castReference):
* Source/JavaScriptCore/wasm/js/JSWebAssemblyHelpers.h:
(JSC::fromJSValue):
* Source/JavaScriptCore/wasm/js/WasmToJS.cpp:
(JSC::Wasm::wasmToJS):
* Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp:
(JSC::WebAssemblyFunction::jsCallEntrypointSlow):

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to