Ignore:
Timestamp:
Oct 27, 2021, 12:28:58 PM (4 years ago)
Author:
dbezhetskov
Message:

[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):

  • wasm/wasm.json:

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):

  • wasm/WasmFormat.h:

(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):

  • wasm/WasmGlobal.cpp:

(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):

  • wasm/WasmOperations.cpp:

(JSC::Wasm::JSC_DEFINE_JIT_OPERATION):

  • wasm/WasmParser.h:

(JSC::Wasm::Parser<SuccessType>::parseValueType):

  • wasm/WasmSectionParser.cpp:

(JSC::Wasm::SectionParser::parseInitExpr):

  • wasm/WasmTable.cpp:

(JSC::Wasm::Table::wasmType const):

  • wasm/js/JSToWasm.cpp:

(JSC::Wasm::marshallJSResult):

  • wasm/js/JSWebAssemblyGlobal.cpp:

(JSC::JSWebAssemblyGlobal::type):

  • wasm/js/JSWebAssemblyHelpers.h:

(JSC::defaultValueForReferenceType):

  • wasm/js/WasmToJS.cpp:

(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):

  • wasm/wasm.json:

Tools:

Reviewed by Yusuke Suzuki.

Add a new routine to run typed function references spec tests.

  • Scripts/run-jsc-stress-tests:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/wasm/WasmTable.cpp

    r284467 r284935  
    180180{
    181181    if (isExternrefTable())
    182         return Types::Externref;
     182        return externrefType();
    183183    ASSERT(isFuncrefTable());
    184     return Types::Funcref;
     184    return funcrefType();
    185185}
    186186
Note: See TracChangeset for help on using the changeset viewer.