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

Changeset 259424 in webkit


Ignore:
Timestamp:
Apr 2, 2020, 4:22:55 PM (6 years ago)
Author:
ysuzuki@apple.com
Message:

[JSC] RecordedStatuses's assignment should be guarded by CodeBlock's lock
https://bugs.webkit.org/show_bug.cgi?id=209935
<rdar://problem/59443383>

Reviewed by Mark Lam.

Previously RecordedStatuses are not touched by GC. But now, GC visits RecordedStatuses.
This means that modifying RecordedStatuses should be guarded by CodeBlock's lock if
it is reachable from CodeBlock.
In DFG::Plan::reallyAdd, we already installed DFG::JITCode into the CodeBlock so that
RecordedStatuses is reachable from CodeBlock. We should lock CodeBlock's lock while
performing WTFMove(RecordedStatuses).

We do not need to emit write-barrier here because (1) DFG::Plan::reallyAdd is executed
while GC is deferred and (2) we emit write-barrier to CodeBlock before deferred GC is executed.

  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::reallyAdd):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r259418 r259424  
     12020-04-02  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] RecordedStatuses's assignment should be guarded by CodeBlock's lock
     4        https://bugs.webkit.org/show_bug.cgi?id=209935
     5        <rdar://problem/59443383>
     6
     7        Reviewed by Mark Lam.
     8
     9        Previously RecordedStatuses are not touched by GC. But now, GC visits RecordedStatuses.
     10        This means that modifying RecordedStatuses should be guarded by CodeBlock's lock if
     11        it is reachable from CodeBlock.
     12        In DFG::Plan::reallyAdd, we already installed DFG::JITCode into the CodeBlock so that
     13        RecordedStatuses is reachable from CodeBlock. We should lock CodeBlock's lock while
     14        performing `WTFMove(RecordedStatuses)`.
     15
     16        We do not need to emit write-barrier here because (1) DFG::Plan::reallyAdd is executed
     17        while GC is deferred and (2) we emit write-barrier to CodeBlock before deferred GC is executed.
     18
     19        * dfg/DFGPlan.cpp:
     20        (JSC::DFG::Plan::reallyAdd):
     21
    1222020-04-02  Mark Lam  <mark.lam@apple.com>
    223
  • trunk/Source/JavaScriptCore/dfg/DFGPlan.cpp

    r256015 r259424  
    570570void Plan::reallyAdd(CommonData* commonData)
    571571{
     572    ASSERT(m_vm->heap.isDeferred());
    572573    m_watchpoints.reallyAdd(m_codeBlock, *commonData);
    573574    m_identifiers.reallyAdd(*m_vm, commonData);
     
    575576    m_transitions.reallyAdd(*m_vm, commonData);
    576577    m_globalProperties.reallyAdd(m_codeBlock, m_identifiers, *commonData);
    577     commonData->recordedStatuses = WTFMove(m_recordedStatuses);
     578    {
     579        ConcurrentJSLocker locker(m_codeBlock->m_lock);
     580        commonData->recordedStatuses = WTFMove(m_recordedStatuses);
     581    }
    578582}
    579583
Note: See TracChangeset for help on using the changeset viewer.