[webkit-changes] [WebKit/WebKit] 2b9318: [Wasm-GC] Add support for new constant expressions
Asumu Takikawa
noreply at github.com
Wed Oct 18 12:59:38 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 2b9318e65c51add3e3d798360a05960524b9fa92
https://github.com/WebKit/WebKit/commit/2b9318e65c51add3e3d798360a05960524b9fa92
Author: Asumu Takikawa <asumu at igalia.com>
Date: 2023-10-18 (Wed, 18 Oct 2023)
Changed paths:
M JSTests/wasm/gc-spec-harness.js
M JSTests/wasm/gc-spec-harness/async_index.js
M JSTests/wasm/gc-spec-harness/sync_index.js
A JSTests/wasm/gc-spec-harness/wasm-constants.js
A JSTests/wasm/gc-spec-tests/array.wast.js
A JSTests/wasm/gc-spec-tests/i31.wast.js
A JSTests/wasm/gc/const-exprs-flag-off.js
A JSTests/wasm/gc/const-exprs.js
M Source/JavaScriptCore/wasm/WasmConstExprGenerator.cpp
M Source/JavaScriptCore/wasm/WasmConstExprGenerator.h
M Source/JavaScriptCore/wasm/WasmFunctionParser.h
M Source/JavaScriptCore/wasm/WasmSectionParser.cpp
M Tools/Scripts/run-jsc-stress-tests
Log Message:
-----------
[Wasm-GC] Add support for new constant expressions
https://bugs.webkit.org/show_bug.cgi?id=254696
Reviewed by Justin Michaud.
Enables new constant expressions used in the GC proposal: array.new (normal,
default, and fixed), struct.new (normal, default),
extern.internalize/externalize, and i31.new. Both GC and extended constant expr
flags need to be turned on to use these.
The representation of ExpressionType used in the constant expression generator
is changed to potentially hold a Strong<JSObject> reference in order to keep
allocated objects live.
This enables most GC array spec tests to run, so this patch also adds
those tests to the suite. The remaining test failure is blocked on
parsing element vector items.
Running these spec tests also required updating part of the GC spec test
harness to match the upstream JS test helpers.
This patch also fixes a minor bug in parsing `array.new_data` that's exposed by
these tests.
* JSTests/wasm/gc-spec-harness.js:
* JSTests/wasm/gc-spec-harness/async_index.js:
(hostref):
(eq_ref):
(reinitializeRegistry.get promise_test):
(reinitializeRegistry):
(externref): Deleted.
(is_externref): Deleted.
(is_funcref): Deleted.
(eq_externref): Deleted.
(eq_funcref): Deleted.
* JSTests/wasm/gc-spec-harness/sync_index.js:
(hostref):
(eq_ref):
(externref): Deleted.
(is_externref): Deleted.
(is_funcref): Deleted.
(eq_externref): Deleted.
(eq_funcref): Deleted.
* JSTests/wasm/gc-spec-harness/wasm-constants.js: Added.
(bytes):
(bytesWithHeader):
(makeSig):
(makeSig_v_x):
(makeSig_v_xx):
(makeSig_r_v):
(makeSig_r_x):
(makeSig_r_xx):
(assertTraps):
(assertWasmThrows):
* JSTests/wasm/gc-spec-tests/array.wast.js: Added.
* JSTests/wasm/gc-spec-tests/i31.wast.js: Added.
* JSTests/wasm/gc/const-exprs-flag-off.js: Added.
(async testInvalidGCConstExprs):
* JSTests/wasm/gc/const-exprs.js: Added.
(async testGCConstExprs):
(async testInvalidConstExprs):
* Source/JavaScriptCore/wasm/WasmConstExprGenerator.cpp:
(JSC::Wasm::ConstExprGenerator::ConstExprValue::ConstExprValue):
(JSC::Wasm::ConstExprGenerator::ConstExprValue::getValue):
(JSC::Wasm::ConstExprGenerator::ConstExprValue::type):
(JSC::Wasm::ConstExprGenerator::ConstExprValue::operator+):
(JSC::Wasm::ConstExprGenerator::ConstExprValue::operator-):
(JSC::Wasm::ConstExprGenerator::ConstExprValue::operator*):
(JSC::Wasm::ConstExprGenerator::result const):
(JSC::Wasm::ConstExprGenerator::addConstant):
(JSC::Wasm::ConstExprGenerator::getGlobal):
(JSC::Wasm::ConstExprGenerator::addRefI31):
(JSC::Wasm::ConstExprGenerator::createNewArray):
(JSC::Wasm::ConstExprGenerator::addArrayNew):
(JSC::Wasm::ConstExprGenerator::addArrayNewDefault):
(JSC::Wasm::ConstExprGenerator::addArrayNewFixed):
(JSC::Wasm::ConstExprGenerator::createNewStruct):
(JSC::Wasm::ConstExprGenerator::addStructNewDefault):
(JSC::Wasm::ConstExprGenerator::addStructNew):
(JSC::Wasm::ConstExprGenerator::addAnyConvertExtern):
(JSC::Wasm::ConstExprGenerator::addExternConvertAny):
(JSC::Wasm::ConstExprGenerator::addRefFunc):
(JSC::Wasm::evaluateExtendedConstExpr):
* Source/JavaScriptCore/wasm/WasmConstExprGenerator.h:
* Source/JavaScriptCore/wasm/WasmFunctionParser.h:
(JSC::Wasm::FunctionParser<Context>::parseExpression):
* Source/JavaScriptCore/wasm/WasmSectionParser.cpp:
(JSC::Wasm::SectionParser::parseInitExpr):
* Tools/Scripts/run-jsc-stress-tests:
Canonical link: https://commits.webkit.org/269484@main
More information about the webkit-changes
mailing list