Ignore:
Timestamp:
Oct 5, 2015, 4:31:53 PM (10 years ago)
Author:
[email protected]
Message:

Unreviewed, rolling back in r190450
https://bugs.webkit.org/show_bug.cgi?id=149727

The cause of the leak was VM shutdown, which happens in workers.

The fix is for CodeBlockSet to participate in lastChanceToFinalize,
since it's responsible for running CodeBlock destructors.

I ran the leaks tests locally and did not see any CodeBlock-related leaks.

Restored changesets:

"CodeBlock should be a GC object"
https://bugs.webkit.org/show_bug.cgi?id=149727
http://trac.webkit.org/changeset/190450

File:
1 edited

Legend:

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

    r190546 r190589  
    132132} // anonymous namespace
    133133
    134 Plan::Plan(PassRefPtr<CodeBlock> passedCodeBlock, CodeBlock* profiledDFGCodeBlock,
     134Plan::Plan(CodeBlock* passedCodeBlock, CodeBlock* profiledDFGCodeBlock,
    135135    CompilationMode mode, unsigned osrEntryBytecodeIndex,
    136136    const Operands<JSValue>& mustHandleValues)
     
    141141    , osrEntryBytecodeIndex(osrEntryBytecodeIndex)
    142142    , mustHandleValues(mustHandleValues)
    143     , compilation(codeBlock->vm()->m_perBytecodeProfiler ? adoptRef(new Profiler::Compilation(codeBlock->vm()->m_perBytecodeProfiler->ensureBytecodesFor(codeBlock.get()), profilerCompilationKindForMode(mode))) : 0)
     143    , compilation(codeBlock->vm()->m_perBytecodeProfiler ? adoptRef(new Profiler::Compilation(codeBlock->vm()->m_perBytecodeProfiler->ensureBytecodesFor(codeBlock), profilerCompilationKindForMode(mode))) : 0)
    144144    , inlineCallFrames(adoptRef(new InlineCallFrameSet()))
    145     , identifiers(codeBlock.get())
    146     , weakReferences(codeBlock.get())
     145    , identifiers(codeBlock)
     146    , weakReferences(codeBlock)
    147147    , willTryToTierUp(false)
    148148    , stage(Preparing)
     
    536536void Plan::reallyAdd(CommonData* commonData)
    537537{
    538     watchpoints.reallyAdd(codeBlock.get(), *commonData);
     538    watchpoints.reallyAdd(codeBlock, *commonData);
    539539    identifiers.reallyAdd(vm, commonData);
    540540    weakReferences.reallyAdd(vm, commonData);
     
    554554void Plan::notifyReady()
    555555{
    556     callback->compilationDidBecomeReadyAsynchronously(codeBlock.get());
     556    callback->compilationDidBecomeReadyAsynchronously(codeBlock, profiledDFGCodeBlock);
    557557    stage = Ready;
    558558}
     
    561561{
    562562    // We will establish new references from the code block to things. So, we need a barrier.
    563     vm.heap.writeBarrier(codeBlock->ownerExecutable());
     563    vm.heap.writeBarrier(codeBlock);
    564564   
    565565    if (!isStillValid())
     
    597597void Plan::finalizeAndNotifyCallback()
    598598{
    599     callback->compilationDidComplete(codeBlock.get(), finalizeWithoutNotifyingCallback());
     599    callback->compilationDidComplete(codeBlock, profiledDFGCodeBlock, finalizeWithoutNotifyingCallback());
    600600}
    601601
     
    605605}
    606606
    607 void Plan::clearCodeBlockMarks()
     607void Plan::rememberCodeBlocks()
    608608{
    609609    // Compilation writes lots of values to a CodeBlock without performing
     
    611611    // all our CodeBlocks must be visited during GC.
    612612
    613     codeBlock->clearMarks();
    614     codeBlock->alternative()->clearMarks();
     613    Heap::heap(codeBlock)->writeBarrier(codeBlock);
    615614    if (profiledDFGCodeBlock)
    616         profiledDFGCodeBlock->clearMarks();
     615        Heap::heap(profiledDFGCodeBlock)->writeBarrier(profiledDFGCodeBlock);
    617616}
    618617
     
    625624        visitor.appendUnbarrieredValue(&mustHandleValues[i]);
    626625
    627     codeBlock->visitStrongly(visitor);
    628     codeBlock->alternative()->visitStrongly(visitor);
    629     if (profiledDFGCodeBlock)
    630         profiledDFGCodeBlock->visitStrongly(visitor);
     626    visitor.appendUnbarrieredReadOnlyPointer(codeBlock);
     627    visitor.appendUnbarrieredReadOnlyPointer(profiledDFGCodeBlock);
    631628
    632629    if (inlineCallFrames) {
    633630        for (auto* inlineCallFrame : *inlineCallFrames) {
    634             ASSERT(inlineCallFrame->baselineCodeBlock());
    635             inlineCallFrame->baselineCodeBlock()->visitStrongly(visitor);
     631            ASSERT(inlineCallFrame->baselineCodeBlock.get());
     632            visitor.appendUnbarrieredReadOnlyPointer(inlineCallFrame->baselineCodeBlock.get());
    636633        }
    637634    }
Note: See TracChangeset for help on using the changeset viewer.