⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 286802 in webkit


Ignore:
Timestamp:
Dec 9, 2021, 1:49:45 PM (5 years ago)
Author:
sbarati@apple.com
Message:

Procedure::setNeedsPCToOriginMap should call Code::forcePreservationOfB3Origins
https://bugs.webkit.org/show_bug.cgi?id=234093

Reviewed by Yusuke Suzuki.

We need to do this to ensure the sampling profiler works in FTL.
The reason this was sometimes working was Air::Code's constructor
was looking at Procedure's m_needsPCToOriginMap before it was initialized,
in its constructor. This is because Procedure was constructing Code
before all its fields were initialized. This patch fixes that bug to
construct Code after Procedure has all its fields initialized.

  • b3/B3Procedure.cpp:

(JSC::B3::Procedure::Procedure):
(JSC::B3::Procedure::setNeedsPCToOriginMap):

  • b3/B3Procedure.h:

(JSC::B3::Procedure::setNeedsPCToOriginMap): Deleted.

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r286790 r286802  
     12021-12-09  Saam Barati  <sbarati@apple.com>
     2
     3        Procedure::setNeedsPCToOriginMap should call Code::forcePreservationOfB3Origins
     4        https://bugs.webkit.org/show_bug.cgi?id=234093
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        We need to do this to ensure the sampling profiler works in FTL.
     9        The reason this was sometimes working was Air::Code's constructor
     10        was looking at Procedure's m_needsPCToOriginMap before it was initialized,
     11        in its constructor. This is because Procedure was constructing Code
     12        before all its fields were initialized. This patch fixes that bug to
     13        construct Code after Procedure has all its fields initialized.
     14
     15        * b3/B3Procedure.cpp:
     16        (JSC::B3::Procedure::Procedure):
     17        (JSC::B3::Procedure::setNeedsPCToOriginMap):
     18        * b3/B3Procedure.h:
     19        (JSC::B3::Procedure::setNeedsPCToOriginMap): Deleted.
     20
    1212021-12-09  Saam Barati  <sbarati@apple.com>
    222
  • trunk/Source/JavaScriptCore/b3/B3Procedure.cpp

    r286790 r286802  
    4949    , m_lastPhaseName("initial")
    5050    , m_byproducts(makeUnique<OpaqueByproducts>())
    51     , m_code(new Air::Code(*this))
    52 {
     51{
     52    // Initialize all our fields before constructing Air::Code since
     53    // it looks into our fields.
     54    m_code = std::unique_ptr<Air::Code>(new Air::Code(*this));
    5355    m_code->setNumEntrypoints(m_numEntrypoints);
    5456}
     
    487489}
    488490
     491void Procedure::setNeedsPCToOriginMap()
     492{
     493    m_needsPCToOriginMap = true;
     494    m_code->forcePreservationOfB3Origins();
     495}
     496
    489497} } // namespace JSC::B3
    490498
  • trunk/Source/JavaScriptCore/b3/B3Procedure.h

    r286790 r286802  
    276276    JS_EXPORT_PRIVATE RegisterSet mutableFPRs();
    277277
    278     void setNeedsPCToOriginMap() { m_needsPCToOriginMap = true; }
     278    void setNeedsPCToOriginMap();
    279279    bool needsPCToOriginMap() { return m_needsPCToOriginMap; }
    280280
  • trunk/Source/JavaScriptCore/b3/air/AirCode.cpp

    r280650 r286802  
    5757    : m_proc(proc)
    5858    , m_cfg(new CFG(*this))
    59     , m_preserveB3Origins(proc.needsPCToOriginMap() || Options::dumpAirGraphAtEachPhase() || Options::dumpFTLDisassembly())
     59    , m_preserveB3Origins(Options::dumpAirGraphAtEachPhase() || Options::dumpFTLDisassembly())
    6060    , m_lastPhaseName("initial")
    6161    , m_defaultPrologueGenerator(createSharedTask<PrologueGeneratorFunction>(&defaultPrologueGenerator))
Note: See TracChangeset for help on using the changeset viewer.