Skip to content

Commit 551c2eb

Browse files
committed
wasm.yaml/wasm/lowExecutableMemory/imports-oom.js.default-wasm is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=244122 rdar://98882300 Reviewed by Justin Michaud. Fixed two issues. 1) If we run out of memory when creating a LLIntPlan in the CalleeGroup constructor, we now error out. 2) If we run out of memory when compiling / linking the JS to Wasm IC callee, we error out instead of creating a JSToWasmICCallee that doesn't have and entrypoint. Re-enabled exports-oom.js and imports-oom.js tests. * JSTests/wasm/lowExecutableMemory/exports-oom.js: * JSTests/wasm/lowExecutableMemory/imports-oom.js: * Source/JavaScriptCore/wasm/WasmCalleeGroup.cpp: (JSC::Wasm::CalleeGroup::CalleeGroup): * Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp: (JSC::WebAssemblyFunction::jsCallEntrypointSlow): Canonical link: https://commits.webkit.org/269682@main
1 parent f5b5a33 commit 551c2eb

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

JSTests/wasm/lowExecutableMemory/exports-oom.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// FIXME: Consider making jump islands work with Options::jitMemoryReservationSize
22
// https://bugs.webkit.org/show_bug.cgi?id=209037
3-
//@ skip
43

54
import * as assert from '../assert.js'
65
import Builder from '../Builder.js'

JSTests/wasm/lowExecutableMemory/imports-oom.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// FIXME: Consider making jump islands work with Options::jitMemoryReservationSize
22
// https://bugs.webkit.org/show_bug.cgi?id=209037
3-
//@ skip
43

54
import * as assert from '../assert.js'
65
import Builder from '../Builder.js'

Source/JavaScriptCore/wasm/WasmCalleeGroup.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ CalleeGroup::CalleeGroup(VM& vm, MemoryMode mode, ModuleInformation& moduleInfor
7676
RefPtr<CalleeGroup> protectedThis = this;
7777
if (Options::useWasmLLInt()) {
7878
m_plan = adoptRef(*new LLIntPlan(vm, moduleInformation, m_llintCallees->data(), createSharedTask<Plan::CallbackType>([this, protectedThis = WTFMove(protectedThis)] (Plan&) {
79+
if (!m_plan) {
80+
m_errorMessage = makeString("Out of memory while creating LLInt CalleeGroup"_s);
81+
setCompilationFinished();
82+
return;
83+
}
7984
Locker locker { m_lock };
8085
if (m_plan->failed()) {
8186
m_errorMessage = m_plan->errorMessage();

Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ CodePtr<JSEntryPtrTag> WebAssemblyFunction::jsCallEntrypointSlow()
388388
// 1. We need to know where to get callee saves.
389389
// 2. We need to know to restore the previous wasm context.
390390
ASSERT(!m_jsToWasmICCallee);
391-
m_jsToWasmICCallee = Wasm::JSToWasmICCallee::create();
392-
jit.move(CCallHelpers::TrustedImmPtr(CalleeBits::boxNativeCallee(m_jsToWasmICCallee.get())), scratchJSR.payloadGPR());
391+
RefPtr<Wasm::JSToWasmICCallee> jsToWasmICCallee = Wasm::JSToWasmICCallee::create();
392+
jit.move(CCallHelpers::TrustedImmPtr(CalleeBits::boxNativeCallee(jsToWasmICCallee.get())), scratchJSR.payloadGPR());
393393
// We do not need to set up |this| in this IC since the caller of this IC itself already set up arguments and its |this| should be WebAssemblyFunction,
394394
// which anchors JSWebAssemblyInstance correctly from GC.
395395
#if USE(JSVALUE32_64)
@@ -433,7 +433,11 @@ CodePtr<JSEntryPtrTag> WebAssemblyFunction::jsCallEntrypointSlow()
433433

434434
linkBuffer.link(jumpToHostCallThunk, CodeLocationLabel<JSEntryPtrTag>(executable()->entrypointFor(CodeForCall, MustCheckArity)));
435435
auto compilation = makeUnique<Compilation>(FINALIZE_WASM_CODE(linkBuffer, JITCompilationPtrTag, "JS->Wasm IC"), nullptr);
436-
m_jsToWasmICCallee->setEntrypoint({ WTFMove(compilation), WTFMove(registersToSpill) });
436+
jsToWasmICCallee->setEntrypoint({ WTFMove(compilation), WTFMove(registersToSpill) });
437+
438+
// Successfully compiled and linked the IC.
439+
m_jsToWasmICCallee = jsToWasmICCallee;
440+
437441
return m_jsToWasmICCallee->entrypoint().retagged<JSEntryPtrTag>();
438442
}
439443
#endif // ENABLE(JIT)

0 commit comments

Comments
 (0)