Diff
Modified: trunk/JSTests/ChangeLog (287902 => 287903)
--- trunk/JSTests/ChangeLog 2022-01-11 23:45:13 UTC (rev 287902)
+++ trunk/JSTests/ChangeLog 2022-01-11 23:48:35 UTC (rev 287903)
@@ -1,3 +1,17 @@
+2022-01-11 Asumu Takikawa <[email protected]>
+
+ [Wasm] Unify memory import handling in module loader and JS cases
+ https://bugs.webkit.org/show_bug.cgi?id=234116
+
+ Reviewed by Yusuke Suzuki.
+
+ Add an instantiation test case that tests that instantiating the same
+ binary module twice will not crash.
+
+ * wasm/js-api/web-assembly-instantiate.js:
+ (assert.asyncTest.async test):
+ (assert.asyncTest):
+
2022-01-10 Yusuke Suzuki <[email protected]>
Unreviewed, add a bit more Intl.Locale hourCycle tests to investigate flakiness
Modified: trunk/JSTests/wasm/js-api/web-assembly-instantiate.js (287902 => 287903)
--- trunk/JSTests/wasm/js-api/web-assembly-instantiate.js 2022-01-11 23:45:13 UTC (rev 287902)
+++ trunk/JSTests/wasm/js-api/web-assembly-instantiate.js 2022-01-11 23:48:35 UTC (rev 287903)
@@ -190,3 +190,30 @@
assert.asyncTest(test());
}
+
+{
+ const builder = (new Builder())
+ .Type().End()
+ .Import().Memory("imp", "memory", {initial:100}).End()
+ .Function().End()
+ .Export()
+ .Function("foo")
+ .End()
+ .Code()
+ .Function("foo", { params: [], ret: "i32" })
+ .I32Const(1)
+ .End()
+ .End();
+
+ const bin = builder.WebAssembly().get();
+
+ async function test() {
+ let module = new WebAssembly.Module(bin);
+ let instance1 = await WebAssembly.instantiate(module, { imp: { memory: new WebAssembly.Memory({ initial: 100 }) } });
+ assert.truthy(instance1 instanceof WebAssembly.Instance);
+ let instance2 = await WebAssembly.instantiate(module, { imp: { memory: new WebAssembly.Memory({ initial: 100 }) } });
+ assert.truthy(instance2 instanceof WebAssembly.Instance);
+ }
+
+ assert.asyncTest(test());
+}
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (287902 => 287903)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-01-11 23:45:13 UTC (rev 287902)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-01-11 23:48:35 UTC (rev 287903)
@@ -1,3 +1,20 @@
+2022-01-11 Asumu Takikawa <[email protected]>
+
+ [Wasm] Unify memory import handling in module loader and JS cases
+ https://bugs.webkit.org/show_bug.cgi?id=234116
+
+ Reviewed by Yusuke Suzuki.
+
+ Adjust Wasm WPT test expectations now that getter ordering tests
+ should pass.
+
+ * web-platform-tests/wasm/jsapi/constructor/instantiate.any-expected.txt:
+ * web-platform-tests/wasm/jsapi/constructor/instantiate.any.worker-expected.txt:
+ * web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt:
+ * web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt:
+ * web-platform-tests/wasm/webapi/instantiateStreaming.any-expected.txt:
+ * web-platform-tests/wasm/webapi/instantiateStreaming.any.worker-expected.txt:
+
2022-01-11 Antoine Quint <[email protected]>
css/css-transitions/KeyframeEffect-setKeyframes.tentative.html is a failure (part 2)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate.any-expected.txt (287902 => 287903)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate.any-expected.txt 2022-01-11 23:45:13 UTC (rev 287902)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate.any-expected.txt 2022-01-11 23:48:35 UTC (rev 287903)
@@ -9,8 +9,8 @@
PASS Empty module with undefined imports argument: Module argument
PASS Empty module with empty imports argument: BufferSource argument
PASS Empty module with empty imports argument: Module argument
-FAIL getter order for imports object: BufferSource argument assert_array_equals: expected property 1 to be "global1 getter" but got "memory getter" (expected array ["module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "memory getter", "module getter", "global2 getter"] got ["module getter", "memory getter", "module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "global2 getter"])
-FAIL getter order for imports object: Module argument assert_array_equals: expected property 1 to be "global1 getter" but got "memory getter" (expected array ["module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "memory getter", "module getter", "global2 getter"] got ["module getter", "memory getter", "module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "global2 getter"])
+PASS getter order for imports object: BufferSource argument
+PASS getter order for imports object: Module argument
PASS imports: BufferSource argument
PASS imports: Module argument
PASS imports with empty module names: BufferSource argument
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate.any.worker-expected.txt (287902 => 287903)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate.any.worker-expected.txt 2022-01-11 23:45:13 UTC (rev 287902)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate.any.worker-expected.txt 2022-01-11 23:48:35 UTC (rev 287903)
@@ -9,8 +9,8 @@
PASS Empty module with undefined imports argument: Module argument
PASS Empty module with empty imports argument: BufferSource argument
PASS Empty module with empty imports argument: Module argument
-FAIL getter order for imports object: BufferSource argument assert_array_equals: expected property 1 to be "global1 getter" but got "memory getter" (expected array ["module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "memory getter", "module getter", "global2 getter"] got ["module getter", "memory getter", "module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "global2 getter"])
-FAIL getter order for imports object: Module argument assert_array_equals: expected property 1 to be "global1 getter" but got "memory getter" (expected array ["module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "memory getter", "module getter", "global2 getter"] got ["module getter", "memory getter", "module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "global2 getter"])
+PASS getter order for imports object: BufferSource argument
+PASS getter order for imports object: Module argument
PASS imports: BufferSource argument
PASS imports: Module argument
PASS imports with empty module names: BufferSource argument
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt (287902 => 287903)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt 2022-01-11 23:45:13 UTC (rev 287902)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt 2022-01-11 23:48:35 UTC (rev 287903)
@@ -7,7 +7,7 @@
PASS Empty module without imports argument
PASS Empty module with undefined imports argument
PASS Empty module with empty imports argument
-FAIL getter order for imports object assert_array_equals: expected property 1 to be "global1 getter" but got "memory getter" (expected array ["module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "memory getter", "module getter", "global2 getter"] got ["module getter", "memory getter", "module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "global2 getter"])
+PASS getter order for imports object
PASS imports
PASS imports with empty module names
PASS imports with empty names
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt (287902 => 287903)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt 2022-01-11 23:45:13 UTC (rev 287902)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt 2022-01-11 23:48:35 UTC (rev 287903)
@@ -7,7 +7,7 @@
PASS Empty module without imports argument
PASS Empty module with undefined imports argument
PASS Empty module with empty imports argument
-FAIL getter order for imports object assert_array_equals: expected property 1 to be "global1 getter" but got "memory getter" (expected array ["module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "memory getter", "module getter", "global2 getter"] got ["module getter", "memory getter", "module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "global2 getter"])
+PASS getter order for imports object
PASS imports
PASS imports with empty module names
PASS imports with empty names
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/instantiateStreaming.any-expected.txt (287902 => 287903)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/instantiateStreaming.any-expected.txt 2022-01-11 23:45:13 UTC (rev 287902)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/instantiateStreaming.any-expected.txt 2022-01-11 23:48:35 UTC (rev 287903)
@@ -2,7 +2,7 @@
PASS Empty module without imports argument
PASS Empty module with undefined imports argument
PASS Empty module with empty imports argument
-FAIL getter order for imports object assert_array_equals: expected property 1 to be "global1 getter" but got "memory getter" (expected array ["module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "memory getter", "module getter", "global2 getter"] got ["module getter", "memory getter", "module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "global2 getter"])
+PASS getter order for imports object
PASS imports
PASS imports with empty module names
PASS imports with empty names
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/instantiateStreaming.any.worker-expected.txt (287902 => 287903)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/instantiateStreaming.any.worker-expected.txt 2022-01-11 23:45:13 UTC (rev 287902)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/instantiateStreaming.any.worker-expected.txt 2022-01-11 23:48:35 UTC (rev 287903)
@@ -2,7 +2,7 @@
PASS Empty module without imports argument
PASS Empty module with undefined imports argument
PASS Empty module with empty imports argument
-FAIL getter order for imports object assert_array_equals: expected property 1 to be "global1 getter" but got "memory getter" (expected array ["module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "memory getter", "module getter", "global2 getter"] got ["module getter", "memory getter", "module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "global2 getter"])
+PASS getter order for imports object
PASS imports
PASS imports with empty module names
PASS imports with empty names
Modified: trunk/Source/_javascript_Core/ChangeLog (287902 => 287903)
--- trunk/Source/_javascript_Core/ChangeLog 2022-01-11 23:45:13 UTC (rev 287902)
+++ trunk/Source/_javascript_Core/ChangeLog 2022-01-11 23:48:35 UTC (rev 287903)
@@ -1,3 +1,22 @@
+2022-01-11 Asumu Takikawa <[email protected]>
+
+ [Wasm] Unify memory import handling in module loader and JS cases
+ https://bugs.webkit.org/show_bug.cgi?id=234116
+
+ Reviewed by Yusuke Suzuki.
+
+ Moves the memory import handling code to the Wasm module record and
+ use the strategy used by the module loader to handle memory in all
+ cases.
+
+ * wasm/WasmModule.cpp:
+ (JSC::Wasm::Module::copyInitialCalleeGroupToAllMemoryModes):
+ * wasm/js/JSWebAssemblyInstance.cpp:
+ (JSC::JSWebAssemblyInstance::finalizeCreation):
+ (JSC::JSWebAssemblyInstance::tryCreate):
+ * wasm/js/WebAssemblyModuleRecord.cpp:
+ (JSC::WebAssemblyModuleRecord::initializeImportsAndExports):
+
2022-01-11 Yusuke Suzuki <[email protected]>
[JSC] Fix kind of error thrown by wasm module creation
Modified: trunk/Source/_javascript_Core/wasm/WasmModule.cpp (287902 => 287903)
--- trunk/Source/_javascript_Core/wasm/WasmModule.cpp 2022-01-11 23:45:13 UTC (rev 287902)
+++ trunk/Source/_javascript_Core/wasm/WasmModule.cpp 2022-01-11 23:48:35 UTC (rev 287903)
@@ -113,13 +113,16 @@
void Module::copyInitialCalleeGroupToAllMemoryModes(MemoryMode initialMode)
{
+ Locker locker { m_lock };
ASSERT(m_calleeGroups[static_cast<uint8_t>(initialMode)]);
const CalleeGroup& initialBlock = *m_calleeGroups[static_cast<uint8_t>(initialMode)];
for (unsigned i = 0; i < Wasm::NumberOfMemoryModes; i++) {
if (i == static_cast<uint8_t>(initialMode))
continue;
- Ref<CalleeGroup> newBlock = CalleeGroup::createFromExisting(static_cast<MemoryMode>(i), initialBlock);
- m_calleeGroups[i] = WTFMove(newBlock);
+ // We should only try to copy the group here if it hasn't already been created.
+ // If it exists but is not runnable, it should get compiled during module evaluation.
+ if (auto& group = m_calleeGroups[i]; !group)
+ group = CalleeGroup::createFromExisting(static_cast<MemoryMode>(i), initialBlock);
}
}
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyInstance.cpp (287902 => 287903)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyInstance.cpp 2022-01-11 23:45:13 UTC (rev 287902)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyInstance.cpp 2022-01-11 23:48:35 UTC (rev 287903)
@@ -117,11 +117,12 @@
RELEASE_ASSERT(wasmCalleeGroup->isSafeToRun(memoryMode()));
- // In the module loader case, we will initialize all memory modes with the initial LLInt compilation
+ // When memory is imported, we will initialize all memory modes with the initial LLInt compilation
// results, so that later when memory imports become available, the appropriate CalleeGroup can be used.
// If LLInt is disabled, we instead defer compilation to module evaluation.
+ // If the code is already compiled, e.g. the module was already instantiated before, we do not re-initialize.
bool hasMemoryImport = module()->moduleInformation().memory.isImport();
- if (creationMode == Wasm::CreationMode::FromModuleLoader && Options::useWasmLLInt() && hasMemoryImport) {
+ if (Options::useWasmLLInt() && hasMemoryImport) {
Wasm::MemoryMode initialMode = Wasm::MemoryMode::BoundsChecking;
ASSERT(memoryMode() == initialMode);
module()->module().copyInitialCalleeGroupToAllMemoryModes(initialMode);
@@ -172,10 +173,6 @@
if (!globalObject->webAssemblyEnabled())
return exception(createEvalError(globalObject, globalObject->webAssemblyDisabledErrorMessage()));
- auto importFailMessage = [&] (const Wasm::Import& import, const char* before, const char* after) {
- return makeString(before, " ", String::fromUTF8(import.module), ":", String::fromUTF8(import.field), " ", after);
- };
-
WebAssemblyModuleRecord* moduleRecord = WebAssemblyModuleRecord::create(globalObject, vm, globalObject->webAssemblyModuleRecordStructure(), moduleKey, moduleInformation);
RETURN_IF_EXCEPTION(throwScope, nullptr);
@@ -189,10 +186,6 @@
jsInstance->finishCreation(vm, jsModule, moduleRecord);
RETURN_IF_EXCEPTION(throwScope, nullptr);
- // Let funcs, memories and tables be initially-empty lists of callable _javascript_ objects, WebAssembly.Memory objects and WebAssembly.Table objects, respectively.
- // Let imports be an initially-empty list of external values.
- bool hasMemoryImport = false;
-
if (creationMode == Wasm::CreationMode::FromJS) {
// If the list of module.imports is not empty and Type(importObject) is not Object, a TypeError is thrown.
if (moduleInformation.imports.size() && !importObject)
@@ -210,112 +203,31 @@
fieldName,
Identifier::fromUid(PrivateName(PrivateName::Description, "WebAssemblyImportName")),
});
-
- // Validation for most types are done in WebAssemblyModuleRecord::initializeImportsAndExports and skipped here.
- // Eventually we will move all the linking code here to WebAssemblyModuleRecord::initializeImportsAndExports.
- switch (import.kind) {
- case Wasm::ExternalKind::Function:
- case Wasm::ExternalKind::Global:
- case Wasm::ExternalKind::Table:
- case Wasm::ExternalKind::Exception:
- continue;
- case Wasm::ExternalKind::Memory:
- break;
- }
-
- JSValue value;
- if (creationMode == Wasm::CreationMode::FromJS) {
- // 1. Let o be the resultant value of performing Get(importObject, i.module_name).
- JSValue importModuleValue = importObject->get(globalObject, moduleName);
- RETURN_IF_EXCEPTION(throwScope, nullptr);
- // 2. If Type(o) is not Object, throw a TypeError.
- if (!importModuleValue.isObject())
- return exception(createTypeError(globalObject, importFailMessage(import, "import", "must be an object"), defaultSourceAppender, runtimeTypeForValue(vm, importModuleValue)));
-
- // 3. Let v be the value of performing Get(o, i.item_name)
- JSObject* object = jsCast<JSObject*>(importModuleValue);
- value = object->get(globalObject, fieldName);
- RETURN_IF_EXCEPTION(throwScope, nullptr);
- }
- if (!value)
- value = jsUndefined();
-
- switch (import.kind) {
- case Wasm::ExternalKind::Function:
- case Wasm::ExternalKind::Global:
- case Wasm::ExternalKind::Table:
- case Wasm::ExternalKind::Exception:
- break;
-
- case Wasm::ExternalKind::Memory: {
- // 6. If i is a memory import:
- RELEASE_ASSERT(!hasMemoryImport); // This should be guaranteed by a validation failure.
- RELEASE_ASSERT(moduleInformation.memory);
- hasMemoryImport = true;
- // For the module loader, we cannot initialize the memory here so we delay this
- // until WebAssemblyModuleRecord's initialization operation.
- if (creationMode == Wasm::CreationMode::FromModuleLoader)
- break;
- JSWebAssemblyMemory* memory = jsDynamicCast<JSWebAssemblyMemory*>(vm, value);
- // i. If v is not a WebAssembly.Memory object, throw a WebAssembly.LinkError.
- if (!memory)
- return exception(createJSWebAssemblyLinkError(globalObject, vm, importFailMessage(import, "Memory import", "is not an instance of WebAssembly.Memory")));
-
- Wasm::PageCount declaredInitial = moduleInformation.memory.initial();
- Wasm::PageCount importedInitial = memory->memory().initial();
- if (importedInitial < declaredInitial)
- return exception(createJSWebAssemblyLinkError(globalObject, vm, importFailMessage(import, "Memory import", "provided an 'initial' that is smaller than the module's declared 'initial' import memory size")));
-
- if (Wasm::PageCount declaredMaximum = moduleInformation.memory.maximum()) {
- Wasm::PageCount importedMaximum = memory->memory().maximum();
- if (!importedMaximum)
- return exception(createJSWebAssemblyLinkError(globalObject, vm, importFailMessage(import, "Memory import", "did not have a 'maximum' but the module requires that it does")));
-
- if (importedMaximum > declaredMaximum)
- return exception(createJSWebAssemblyLinkError(globalObject, vm, importFailMessage(import, "Memory import", "provided a 'maximum' that is larger than the module's declared 'maximum' import memory size")));
- }
-
- if ((memory->memory().sharingMode() == Wasm::MemorySharingMode::Shared) != moduleInformation.memory.isShared())
- return exception(createJSWebAssemblyLinkError(globalObject, vm, importFailMessage(import, "Memory import", "provided a 'shared' that is differnt from the module's declared 'shared' import memory attribute")));
-
- // ii. Append v to memories.
- // iii. Append v.[[Memory]] to imports.
- jsInstance->setMemory(vm, memory);
- RETURN_IF_EXCEPTION(throwScope, nullptr);
- break;
- }
- }
}
ASSERT(moduleRecord->importEntries().size() == moduleInformation.imports.size());
- {
- if (!!moduleInformation.memory && moduleInformation.memory.isImport()) {
- // We should either have a Memory import or we should have thrown an exception.
- RELEASE_ASSERT(hasMemoryImport);
- }
+ bool hasMemoryImport = moduleInformation.memory.isImport();
+ if (moduleInformation.memory && !hasMemoryImport) {
+ // We create a memory when it's a memory definition.
+ auto* jsMemory = JSWebAssemblyMemory::tryCreate(globalObject, vm, globalObject->webAssemblyMemoryStructure());
+ RETURN_IF_EXCEPTION(throwScope, nullptr);
- if (moduleInformation.memory && !hasMemoryImport) {
- // We create a memory when it's a memory definition.
- RELEASE_ASSERT(!moduleInformation.memory.isImport());
+ RefPtr<Wasm::Memory> memory = Wasm::Memory::tryCreate(moduleInformation.memory.initial(), moduleInformation.memory.maximum(), moduleInformation.memory.isShared() ? Wasm::MemorySharingMode::Shared: Wasm::MemorySharingMode::Default,
+ [&vm](Wasm::Memory::NotifyPressure) { vm.heap.collectAsync(CollectionScope::Full); },
+ [&vm](Wasm::Memory::SyncTryToReclaim) { vm.heap.collectSync(CollectionScope::Full); },
+ [&vm, jsMemory](Wasm::Memory::GrowSuccess, Wasm::PageCount oldPageCount, Wasm::PageCount newPageCount) { jsMemory->growSuccessCallback(vm, oldPageCount, newPageCount); }
+ );
+ if (!memory)
+ return exception(createOutOfMemoryError(globalObject));
- auto* jsMemory = JSWebAssemblyMemory::tryCreate(globalObject, vm, globalObject->webAssemblyMemoryStructure());
- RETURN_IF_EXCEPTION(throwScope, nullptr);
+ jsMemory->adopt(memory.releaseNonNull());
+ jsInstance->setMemory(vm, jsMemory);
+ RETURN_IF_EXCEPTION(throwScope, nullptr);
+ }
- RefPtr<Wasm::Memory> memory = Wasm::Memory::tryCreate(moduleInformation.memory.initial(), moduleInformation.memory.maximum(), moduleInformation.memory.isShared() ? Wasm::MemorySharingMode::Shared: Wasm::MemorySharingMode::Default,
- [&vm] (Wasm::Memory::NotifyPressure) { vm.heap.collectAsync(CollectionScope::Full); },
- [&vm] (Wasm::Memory::SyncTryToReclaim) { vm.heap.collectSync(CollectionScope::Full); },
- [&vm, jsMemory] (Wasm::Memory::GrowSuccess, Wasm::PageCount oldPageCount, Wasm::PageCount newPageCount) { jsMemory->growSuccessCallback(vm, oldPageCount, newPageCount); });
- if (!memory)
- return exception(createOutOfMemoryError(globalObject));
-
- jsMemory->adopt(memory.releaseNonNull());
- jsInstance->setMemory(vm, jsMemory);
- RETURN_IF_EXCEPTION(throwScope, nullptr);
- }
- }
-
if (!jsInstance->memory()) {
// Make sure we have a dummy memory, so that wasm -> wasm thunks avoid checking for a nullptr Memory when trying to set pinned registers.
+ // When there is a memory import, this will be replaced later in the module record import initialization.
auto* jsMemory = JSWebAssemblyMemory::tryCreate(globalObject, vm, globalObject->webAssemblyMemoryStructure());
RETURN_IF_EXCEPTION(throwScope, nullptr);
jsMemory->adopt(Wasm::Memory::create());
Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp (287902 => 287903)
--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp 2022-01-11 23:45:13 UTC (rev 287902)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyModuleRecord.cpp 2022-01-11 23:48:35 UTC (rev 287903)
@@ -133,20 +133,6 @@
};
for (const auto& import : moduleInformation.imports) {
- // Validation and linking other than Wasm::ExternalKind::Function is already done in JSWebAssemblyInstance.
- // Eventually we will move all the linking code in JSWebAssemblyInstance here and remove this switch statement.
- switch (import.kind) {
- case Wasm::ExternalKind::Function:
- case Wasm::ExternalKind::Global:
- case Wasm::ExternalKind::Table:
- case Wasm::ExternalKind::Exception:
- break;
- case Wasm::ExternalKind::Memory:
- if (creationMode == Wasm::CreationMode::FromJS)
- continue;
- break;
- }
-
Identifier moduleName = Identifier::fromString(vm, String::fromUTF8(import.module));
Identifier fieldName = Identifier::fromString(vm, String::fromUTF8(import.field));
JSValue value;
@@ -409,7 +395,6 @@
break;
}
- // Memory initialization will only occur here if the creation mode was through the module loader.
case Wasm::ExternalKind::Memory:
JSWebAssemblyMemory* memory = jsDynamicCast<JSWebAssemblyMemory*>(vm, value);
// i. If v is not a WebAssembly.Memory object, throw a WebAssembly.LinkError.