Ignore:
Timestamp:
May 20, 2012, 10:42:56 PM (13 years ago)
Author:
[email protected]
Message:

JSGlobalData ScratchBuffers Are Not Visited During Garbage Collection
https://bugs.webkit.org/show_bug.cgi?id=86553

Reviewed by Gavin Barraclough.

Scratch buffers can contain the only reference to live objects.
Therefore visit scratch buffer contents as conservative roots.
Changed the scratch buffers to be a struct with an "active"
length and the actual buffer. The users of the scratch
buffer emit code where needed to set and clear the active
length as appropriate. During marking, the active count is
used for conservative marking.

  • dfg/DFGAssemblyHelpers.h:

(JSC::DFG::AssemblyHelpers::debugCall):

  • dfg/DFGOSRExitCompiler32_64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGOSRExitCompiler64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGThunks.cpp:

(JSC::DFG::osrExitGenerationThunkGenerator):

  • heap/Heap.cpp:

(JSC::Heap::markRoots):

  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::gatherConservativeRoots):

  • runtime/JSGlobalData.h:

(JSC::ScratchBuffer::ScratchBuffer):
(ScratchBuffer):
(JSC::ScratchBuffer::allocationSize):
(JSC::ScratchBuffer::setActiveLength):
(JSC::ScratchBuffer::activeLength):
(JSC::ScratchBuffer::activeLengthPtr):
(JSC::ScratchBuffer::dataBuffer):
(JSGlobalData):
(JSC::JSGlobalData::scratchBufferForSize):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp

    r116818 r117729  
    5757#include <wtf/Threading.h>
    5858#include <wtf/WTFThreadData.h>
     59
     60#if ENABLE(DFG_JIT)
     61#include "ConservativeRoots.h"
     62#endif
    5963
    6064#if ENABLE(REGEXP_TRACING)
     
    451455}
    452456
     457#if ENABLE(DFG_JIT)
     458void JSGlobalData::gatherConservativeRoots(ConservativeRoots& conservativeRoots)
     459{
     460    for (size_t i = 0; i < scratchBuffers.size(); i++) {
     461        ScratchBuffer* scratchBuffer = scratchBuffers[i];
     462        if (scratchBuffer->activeLength()) {
     463            void* bufferStart = scratchBuffer->dataBuffer();
     464            conservativeRoots.add(bufferStart, static_cast<void*>(static_cast<char*>(bufferStart) + scratchBuffer->activeLength()));
     465        }
     466    }
     467}
     468#endif
     469
    453470#if ENABLE(REGEXP_TRACING)
    454471void JSGlobalData::addRegExpToTrace(RegExp* regExp)
Note: See TracChangeset for help on using the changeset viewer.