[WASM-References] Rename anyfunc to funcref
https://bugs.webkit.org/show_bug.cgi?id=198983

Reviewed by Yusuke Suzuki.

JSTests:

* wasm/function-tests/basic-element.js:
* wasm/function-tests/context-switch.js:
(import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.makeInstance):
(makeInstance):
(assert.eq.makeInstance):
* wasm/function-tests/exceptions.js:
(import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.makeInstance):
* wasm/function-tests/grow-memory-2.js:
(assert.eq.instance.exports.foo):
* wasm/function-tests/nameSection.js:
(const.compile):
* wasm/function-tests/stack-overflow.js:
(import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.makeInstance):
(assertOverflows.makeInstance):
* wasm/function-tests/table-basic-2.js:
(import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.makeInstance):
* wasm/function-tests/table-basic.js:
(import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.makeInstance):
* wasm/function-tests/trap-from-start-async.js:
* wasm/function-tests/trap-from-start.js:
* wasm/js-api/Module.exports.js:
(assert.truthy):
* wasm/js-api/Module.imports.js:
(assert.truthy):
* wasm/js-api/call-indirect.js:
(const.oneTable):
(const.multiTable):
(multiTable.const.makeTable):
(multiTable):
(multiTable.Polyphic2Import):
(multiTable.VirtualImport):
* wasm/js-api/element-data.js:
* wasm/js-api/element.js:
(assert.throws.new.WebAssembly.Module.builder.WebAssembly):
(assert.throws):
(badInstantiation.makeModule):
(badInstantiation.test):
(badInstantiation):
* wasm/js-api/extension-MemoryMode.js:
* wasm/js-api/table.js:
(new.WebAssembly.Module):
(assert.throws):
(assertBadTableImport):
(assert.throws.WebAssembly.Table.prototype.grow):
(new.WebAssembly.Table):
(assertBadTable):
(assert.truthy):
* wasm/js-api/test_basic_api.js:
(const.c.in.constructorProperties.switch):
* wasm/js-api/unique-signature.js:
(CallIndirectWithDuplicateSignatures):
* wasm/js-api/wrapper-function.js:
* wasm/modules/table.wat:
* wasm/modules/wasm-imports-js-re-exports-wasm-exports/imports.wat:
* wasm/modules/wasm-imports-js-re-exports-wasm-exports/sum.wat:
* wasm/modules/wasm-imports-wasm-exports/imports.wat:
* wasm/modules/wasm-imports-wasm-exports/sum.wat:
* wasm/references/anyref_table.js:
* wasm/references/anyref_table_import.js:
(doSet):
(assert.throws):
* wasm/references/func_ref.js:
(makeFuncrefIdent):
(assert.eq.instance.exports.fix):
(GetLocal.0.I32Const.0.TableSet.0.End.End.WebAssembly.assert.throws):
(GetLocal.0.I32Const.0.TableSet.0.End.End.WebAssembly):
(let.importedFun.of):
(makeAnyfuncIdent): Deleted.
(makeAnyfuncIdent.fun): Deleted.
* wasm/references/multitable.js:
(assert.eq):
(assert.throws):
* wasm/references/table_misc.js:
(GetLocal.0.TableFill.0.End.End.WebAssembly):
* wasm/references/validation.js:
(assert.throws.new.WebAssembly.Module.bin):
(assert.throws):
* wasm/spec-harness/index.js:
* wasm/spec-harness/wasm-constants.js:
* wasm/spec-harness/wasm-module-builder.js:
(WasmModuleBuilder.prototype.toArray):
* wasm/spec-harness/wast.js:
(elem_type):
(string_of_elem_type):
(string_of_table_type):
* wasm/spec-tests/jsapi.js:
* wasm/stress/wasm-table-grow-initialize.js:
* wasm/wasm.json:

Source/JavaScriptCore:

Anyfunc should become funcref since it was renamed in the spec. We should also support the string 'anyfunc' in the table constructor since this is
the only non-binary-format place where it is exposed to users.

* wasm/WasmAirIRGenerator.cpp:
(JSC::Wasm::AirIRGenerator::gFuncref):
(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::addReturn):
(JSC::Wasm::AirIRGenerator::gAnyfunc): Deleted.
* wasm/WasmCallingConvention.h:
(JSC::Wasm::CallingConventionAir::marshallArgument const):
(JSC::Wasm::CallingConventionAir::setupCall const):
* wasm/WasmExceptionType.h:
* wasm/WasmFormat.h:
(JSC::Wasm::isValueType):
(JSC::Wasm::isSubtype):
(JSC::Wasm::TableInformation::wasmType const):
* wasm/WasmFunctionParser.h:
(JSC::Wasm::FunctionParser<Context>::parseExpression):
* wasm/WasmSectionParser.cpp:
(JSC::Wasm::SectionParser::parseTableHelper):
(JSC::Wasm::SectionParser::parseElement):
(JSC::Wasm::SectionParser::parseInitExpr):
* wasm/WasmValidate.cpp:
(JSC::Wasm::Validate::addRefFunc):
* wasm/js/JSToWasm.cpp:
(JSC::Wasm::createJSToWasmWrapper):
* wasm/js/WasmToJS.cpp:
(JSC::Wasm::wasmToJS):
* wasm/js/WebAssemblyFunction.cpp:
(JSC::callWebAssemblyFunction):
(JSC::WebAssemblyFunction::jsCallEntrypointSlow):
* wasm/js/WebAssemblyModuleRecord.cpp:
(JSC::WebAssemblyModuleRecord::link):
* wasm/js/WebAssemblyTableConstructor.cpp:
(JSC::constructJSWebAssemblyTable):
* wasm/wasm.json:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@246589 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JSTests/wasm/js-api/test_basic_api.js b/JSTests/wasm/js-api/test_basic_api.js
index 1a2d222..2158743 100644
--- a/JSTests/wasm/js-api/test_basic_api.js
+++ b/JSTests/wasm/js-api/test_basic_api.js
@@ -93,9 +93,9 @@
         new WebAssembly.Memory({initial: 20});
         break;
     case "Table":
-        new WebAssembly.Table({initial: 20, element: "anyfunc"});
-        new WebAssembly.Table({initial: 20, maximum: 20, element: "anyfunc"});
-        new WebAssembly.Table({initial: 20, maximum: 25, element: "anyfunc"});
+        new WebAssembly.Table({initial: 20, element: "funcref"});
+        new WebAssembly.Table({initial: 20, maximum: 20, element: "funcref"});
+        new WebAssembly.Table({initial: 20, maximum: 25, element: "funcref"});
         break;
     case "CompileError":
     case "LinkError":