Ignore:
Timestamp:
May 13, 2021, 7:03:43 PM (4 years ago)
Author:
[email protected]
Message:

m_calleeSaveRegisters should not be a pointer to a pointer
https://bugs.webkit.org/show_bug.cgi?id=225787

Reviewed by Keith Miller.

Ben found this through memory stress testing.

RegisterAtOffsetList is effectively just a pointer. unique_ptr<RegisterAtOffsetList>
is a pointer to a pointer. RegisterAtOffsetList is long-lived, so it
creates heap page fragmentation.

Worth 3MB on Ben's test.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::setCalleeSaveRegisters):
(JSC::CodeBlock::calleeSaveRegisters const): Use a fence before setting
m_hasCalleeSaveRegisters to ensure that all writes have completed before
the struct becomes visible.

  • bytecode/CodeBlock.h: Use RegisterAtOffsetList directly instead of

unique_ptr<RegisterAtOffsetList> to avoid a long-lived lonely 8 byte
allocation.

  • ftl/FTLCompile.cpp:

(JSC::FTL::compile): Updated for type change.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ftl/FTLCompile.cpp

    r277383 r277475  
    7272        return;
    7373   
    74     std::unique_ptr<RegisterAtOffsetList> registerOffsets =
    75         makeUnique<RegisterAtOffsetList>(state.proc->calleeSaveRegisterAtOffsetList());
     74    RegisterAtOffsetList registerOffsets = state.proc->calleeSaveRegisterAtOffsetList();
    7675    if (shouldDumpDisassembly())
    77         dataLog(tierName, "Unwind info for ", CodeBlockWithJITType(codeBlock, JITType::FTLJIT), ": ", *registerOffsets, "\n");
     76        dataLog(tierName, "Unwind info for ", CodeBlockWithJITType(codeBlock, JITType::FTLJIT), ": ", registerOffsets, "\n");
    7877    codeBlock->setCalleeSaveRegisters(WTFMove(registerOffsets));
    7978    ASSERT(!(state.proc->frameSize() % sizeof(EncodedJSValue)));
Note: See TracChangeset for help on using the changeset viewer.