[WASM-Function-References] Add call_ref spec tests
https://bugs.webkit.org/show_bug.cgi?id=229710
JSTests:
Reviewed by Yusuke Suzuki.
Add tests for call_ref instruction from the spec repo:
https://github.com/WebAssembly/function-references/blob/master/test/core/call_ref.wast.
Also added tests for Funcref/Externref in Wasm tables and globals to test
new internal representation of Funcref = (ref null funcref).
- wasm.yaml:
- wasm/function-references-spec-tests/call_ref.wast.js: Added.
- wasm/function-references/ref_types.js:
(async testRefGlobalCheck):
(async testNonNullExternrefIncompatible):
(async testNonNullFuncrefIncompatible):
(async testWasmJSGlobals):
(async testRefTypesInTables):
Source/JavaScriptCore:
Reviewed by Yusuke Suzuki.
Removed redundand TypeKind::TypeIdx because new Ref and RefNull opcodes cover
the same cases.
Also use new internal representation of Funcref/Externref when typed
function references proposal is enabled.
- bytecode/BytecodeDumper.cpp:
(JSC::Wasm::BytecodeDumper::formatConstant const):
- wasm/WasmAirIRGenerator.cpp:
(JSC::Wasm::AirIRGenerator::gRef):
(JSC::Wasm::AirIRGenerator::tmpForType):
(JSC::Wasm::AirIRGenerator::emitCCall):
(JSC::Wasm::AirIRGenerator::moveOpForValueType):
(JSC::Wasm::AirIRGenerator::AirIRGenerator):
(JSC::Wasm::AirIRGenerator::addLocal):
(JSC::Wasm::AirIRGenerator::addConstant):
(JSC::Wasm::AirIRGenerator::addRefFunc):
(JSC::Wasm::AirIRGenerator::gTypeIdx): Deleted.
- wasm/WasmCallingConvention.h:
(JSC::Wasm::WasmCallingConvention::marshallLocation const):
(JSC::Wasm::JSCallingConvention::marshallLocation const):
(JSC::Wasm::isValueType):
(JSC::Wasm::isRefType):
(JSC::Wasm::isExternref):
(JSC::Wasm::isFuncref):
(JSC::Wasm::FuncrefType):
(JSC::Wasm::ExternrefType):
(JSC::Wasm::isRefWithTypeIndex):
(JSC::Wasm::isSubtype):
(JSC::Wasm::isDefaultableType):
(JSC::Wasm::TableInformation::wasmType const):
- wasm/WasmFunctionParser.h:
(JSC::Wasm::FunctionParser<Context>::parseExpression):
(JSC::Wasm::Global::get const):
(JSC::Wasm::Global::set):
(JSC::Wasm::Global::visitAggregateImpl):
- wasm/WasmLLIntGenerator.cpp:
(JSC::Wasm::LLIntGenerator::callInformationForCaller):
(JSC::Wasm::LLIntGenerator::callInformationForCallee):
(JSC::Wasm::LLIntGenerator::addArguments):
(JSC::Wasm::LLIntGenerator::addLocal):
(JSC::Wasm::JSC_DEFINE_JIT_OPERATION):
(JSC::Wasm::Parser<SuccessType>::parseValueType):
- wasm/WasmSectionParser.cpp:
(JSC::Wasm::SectionParser::parseInitExpr):
(JSC::Wasm::Table::wasmType const):
(JSC::Wasm::marshallJSResult):
- wasm/js/JSWebAssemblyGlobal.cpp:
(JSC::JSWebAssemblyGlobal::type):
- wasm/js/JSWebAssemblyHelpers.h:
(JSC::defaultValueForReferenceType):
(JSC::Wasm::wasmToJS):
- wasm/js/WebAssemblyFunction.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::WebAssemblyFunction::jsCallEntrypointSlow):
- wasm/js/WebAssemblyGlobalConstructor.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
- wasm/js/WebAssemblyModuleRecord.cpp:
(JSC::WebAssemblyModuleRecord::linkImpl):
Tools:
Reviewed by Yusuke Suzuki.
Add a new routine to run typed function references spec tests.
- Scripts/run-jsc-stress-tests: