Ignore:
Timestamp:
Feb 12, 2020, 6:30:05 PM (5 years ago)
Author:
[email protected]
Message:

[JSC] Compact JITCodeMap by storing BytecodeIndex and CodeLocation separately
https://bugs.webkit.org/show_bug.cgi?id=207673

Reviewed by Mark Lam.

Source/JavaScriptCore:

While BytecodeIndex is 4 bytes, CodeLocation is 8 bytes. So the tuple of them "JITCodeMap::Entry"
becomes 16 bytes because it adds 4 bytes padding. We should store BytecodeIndex and CodeLocation separately
to avoid this padding.

This patch introduces JITCodeMapBuilder. We use this to build JITCodeMap data structure as a immutable final result.

  • jit/JIT.cpp:

(JSC::JIT::link):

  • jit/JITCodeMap.h:

(JSC::JITCodeMap::JITCodeMap):
(JSC::JITCodeMap::find const):
(JSC::JITCodeMap::operator bool const):
(JSC::JITCodeMap::codeLocations const):
(JSC::JITCodeMap::indexes const):
(JSC::JITCodeMapBuilder::append):
(JSC::JITCodeMapBuilder::finalize):
(JSC::JITCodeMap::Entry::Entry): Deleted.
(JSC::JITCodeMap::Entry::bytecodeIndex const): Deleted.
(JSC::JITCodeMap::Entry::codeLocation): Deleted.
(JSC::JITCodeMap::append): Deleted.
(JSC::JITCodeMap::finish): Deleted.

Source/WTF:

  • wtf/MallocPtr.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/JIT.cpp

    r256015 r256498  
    913913    }
    914914
    915     JITCodeMap jitCodeMap;
    916     for (unsigned bytecodeOffset = 0; bytecodeOffset < m_labels.size(); ++bytecodeOffset) {
    917         if (m_labels[bytecodeOffset].isSet())
    918             jitCodeMap.append(BytecodeIndex(bytecodeOffset), patchBuffer.locationOf<JSEntryPtrTag>(m_labels[bytecodeOffset]));
    919     }
    920     jitCodeMap.finish();
    921     m_codeBlock->setJITCodeMap(WTFMove(jitCodeMap));
     915    {
     916        JITCodeMapBuilder jitCodeMapBuilder;
     917        for (unsigned bytecodeOffset = 0; bytecodeOffset < m_labels.size(); ++bytecodeOffset) {
     918            if (m_labels[bytecodeOffset].isSet())
     919                jitCodeMapBuilder.append(BytecodeIndex(bytecodeOffset), patchBuffer.locationOf<JSEntryPtrTag>(m_labels[bytecodeOffset]));
     920        }
     921        m_codeBlock->setJITCodeMap(jitCodeMapBuilder.finalize());
     922    }
    922923
    923924    MacroAssemblerCodePtr<JSEntryPtrTag> withArityCheck = patchBuffer.locationOf<JSEntryPtrTag>(m_arityCheck);
Note: See TracChangeset for help on using the changeset viewer.