Ignore:
Timestamp:
Sep 9, 2019, 10:03:13 PM (6 years ago)
Author:
[email protected]
Message:

[JSC] CodeBlock::m_constantRegisters should be guarded by ConcurrentJSLock when Vector reallocate memory
https://bugs.webkit.org/show_bug.cgi?id=201622

Reviewed by Mark Lam.

CodeBlock::visitChildren takes ConcurrentJSLock while iterating m_constantRegisters, some of the places reallocate
this Vector without taking a lock. If a Vector memory is reallocated while iterating it in concurrent collector,
the concurrent collector can see a garbage. This patch guards m_constantRegisters reallocation with ConcurrentJSLock.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::finishCreation):
(JSC::CodeBlock::setConstantRegisters):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::addConstant):
(JSC::CodeBlock::addConstantLazily):

  • dfg/DFGDesiredWatchpoints.cpp:

(JSC::DFG::ArrayBufferViewWatchpointAdaptor::add):
(JSC::DFG::SymbolTableAdaptor::add):
(JSC::DFG::FunctionExecutableAdaptor::add):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::registerFrozenValues):

  • dfg/DFGJITFinalizer.cpp:

(JSC::DFG::JITFinalizer::finalizeCommon):

  • dfg/DFGLazyJSValue.cpp:

(JSC::DFG::LazyJSValue::emit const):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp

    r244764 r249706  
    8383{
    8484    // Some JIT finalizers may have added more constants. Shrink-to-fit those things now.
    85     m_plan.codeBlock()->constants().shrinkToFit();
    86     m_plan.codeBlock()->constantsSourceCodeRepresentation().shrinkToFit();
     85    {
     86        ConcurrentJSLocker locker(m_plan.codeBlock()->m_lock);
     87        m_plan.codeBlock()->constants().shrinkToFit();
     88        m_plan.codeBlock()->constantsSourceCodeRepresentation().shrinkToFit();
     89    }
    8790
    8891#if ENABLE(FTL_JIT)
Note: See TracChangeset for help on using the changeset viewer.