Ignore:
Timestamp:
Dec 18, 2021, 3:19:18 AM (3 years ago)
Author:
[email protected]
Message:

[JSC] Do not allocate m_bbqCallee and m_omgCallee until it becomes necessary
https://bugs.webkit.org/show_bug.cgi?id=234457

Reviewed by Saam Barati.

WebAssembly memory import will require initializing both Wasm::CalleeGroup.
So, we should shrink memory size of Wasm::CalleeGroup as much as possible
to avoid memory regression. This patch allocates m_bbqCallee and m_omgCallee
only when it becomes available.

  • wasm/WasmBBQPlan.cpp:

(JSC::Wasm::BBQPlan::work):

  • wasm/WasmCalleeGroup.cpp:

(JSC::Wasm::CalleeGroup::CalleeGroup):

  • wasm/WasmCalleeGroup.h:

(JSC::Wasm::CalleeGroup::compilationFinished): Deleted.
(JSC::Wasm::CalleeGroup::runnable): Deleted.
(JSC::Wasm::CalleeGroup::errorMessage): Deleted.
(JSC::Wasm::CalleeGroup::functionImportCount const): Deleted.
(JSC::Wasm::CalleeGroup::embedderEntrypointCalleeFromFunctionIndexSpace): Deleted.
(JSC::Wasm::CalleeGroup::wasmEntrypointCalleeFromFunctionIndexSpace): Deleted.
(JSC::Wasm::CalleeGroup::wasmBBQCalleeFromFunctionIndexSpace): Deleted.
(JSC::Wasm::CalleeGroup::entrypointLoadLocationFromFunctionIndexSpace): Deleted.
(JSC::Wasm::CalleeGroup::wasmToWasmExitStub): Deleted.
(JSC::Wasm::CalleeGroup::mode const): Deleted.

  • wasm/WasmOMGForOSREntryPlan.cpp:

(JSC::Wasm::OMGForOSREntryPlan::work):

  • wasm/WasmOMGPlan.cpp:

(JSC::Wasm::OMGPlan::work):

  • wasm/WasmPlan.cpp:

(JSC::Wasm::Plan::updateCallSitesToCallUs):

  • wasm/WasmPlan.h:
File:
1 edited

Legend:

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

    r287122 r287221  
    128128        Ref<BBQCallee> callee = BBQCallee::create(WTFMove(function->entrypoint), functionIndexSpace, m_moduleInformation->nameSection->get(functionIndexSpace), WTFMove(tierUp), WTFMove(unlinkedWasmToWasmCalls), WTFMove(function->stackmaps), WTFMove(function->exceptionHandlers), WTFMove(exceptionHandlerLocations));
    129129        MacroAssembler::repatchPointer(function->calleeMoveLocation, CalleeBits::boxWasm(callee.ptr()));
    130         ASSERT(!m_calleeGroup->m_bbqCallees[m_functionIndex]);
    131130        entrypoint = callee->entrypoint();
    132131
     
    140139        Locker locker { m_calleeGroup->m_lock };
    141140
    142         m_calleeGroup->m_bbqCallees[m_functionIndex] = callee.copyRef();
     141        m_calleeGroup->setBBQCallee(locker, m_functionIndex, callee.copyRef());
    143142
    144143        for (auto& call : callee->wasmToWasmCallsites()) {
     
    147146                entrypoint = m_calleeGroup->m_wasmToWasmExitStubs[call.functionIndexSpace].code();
    148147            else
    149                 entrypoint = m_calleeGroup->wasmEntrypointCalleeFromFunctionIndexSpace(call.functionIndexSpace).entrypoint().retagged<WasmEntryPtrTag>();
     148                entrypoint = m_calleeGroup->wasmEntrypointCalleeFromFunctionIndexSpace(locker, call.functionIndexSpace).entrypoint().retagged<WasmEntryPtrTag>();
    150149
    151150            MacroAssembler::repatchNearCall(call.callLocation, CodeLocationLabel<WasmEntryPtrTag>(entrypoint));
    152151        }
    153152
    154         Plan::updateCallSitesToCallUs(*m_calleeGroup, CodeLocationLabel<WasmEntryPtrTag>(entrypoint), m_functionIndex, functionIndexSpace);
     153        Plan::updateCallSitesToCallUs(locker, *m_calleeGroup, CodeLocationLabel<WasmEntryPtrTag>(entrypoint), m_functionIndex, functionIndexSpace);
    155154
    156155        {
Note: See TracChangeset for help on using the changeset viewer.