Ignore:
Timestamp:
Jul 24, 2013, 8:59:31 PM (12 years ago)
Author:
[email protected]
Message:

fourthTier: Profiler should be thread-safe
https://bugs.webkit.org/show_bug.cgi?id=115445

Reviewed by Geoffrey Garen.

Change the Profiler::Database API for Compilation creation so that we don't add
it to the Database until it's completely constructed. This prevents the Database
from seeing Compilations that are being concurrently constructed.

Change the Profiler::Database itself to do locking for creation of Bytecodes and
for modifying the map. This map may be consulted by both the main thread and the
concurrent thread.

  • dfg/DFGGraph.cpp:

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

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::linkFunction):

  • jit/JIT.cpp:

(JSC::JIT::privateCompile):

  • profiler/ProfilerBytecodes.h:
  • profiler/ProfilerDatabase.cpp:

(JSC::Profiler::Database::ensureBytecodesFor):
(JSC::Profiler::Database::notifyDestruction):
(JSC::Profiler::Database::addCompilation):

  • profiler/ProfilerDatabase.h:

(Database):

File:
1 edited

Legend:

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

    r153113 r153143  
    595595        m_disassembler = adoptPtr(new JITDisassembler(m_codeBlock));
    596596    if (m_vm->m_perBytecodeProfiler) {
    597         m_compilation = m_vm->m_perBytecodeProfiler->newCompilation(m_codeBlock, Profiler::Baseline);
     597        m_compilation = adoptRef(
     598            new Profiler::Compilation(
     599                m_vm->m_perBytecodeProfiler->ensureBytecodesFor(m_codeBlock),
     600                Profiler::Baseline));
    598601        m_compilation->addProfiledBytecodes(*m_vm->m_perBytecodeProfiler, m_codeBlock);
    599602    }
     
    785788    if (Options::showDisassembly())
    786789        m_disassembler->dump(patchBuffer);
    787     if (m_compilation)
     790    if (m_compilation) {
    788791        m_disassembler->reportToProfiler(m_compilation.get(), patchBuffer);
     792        m_vm->m_perBytecodeProfiler->addCompilation(m_compilation);
     793    }
    789794   
    790795    CodeRef result = patchBuffer.finalizeCodeWithoutDisassembly();
Note: See TracChangeset for help on using the changeset viewer.