Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information