Ignore:
Timestamp:
Nov 16, 2011, 7:58:48 PM (14 years ago)
Author:
[email protected]
Message:

Code block jettisoning should be part of the GC's transitive closure
https://bugs.webkit.org/show_bug.cgi?id=72467

Reviewed by Geoff Garen.

Replaced JettisonedCodeBlocks with DFGCodeBlocks. The latter knows about all
DFG code blocks (i.e. those that may be jettisoned, and may have inlined weak
references) and helps track what state each of those code blocks is in during
GC. The state consists of two flags; mayBeExecuting, which tells if the code block
is live from call frames; and isJettisoned, which tells if the code block is
not owned by any executable and thus should be deleted as soon as it is not
mayBeExecuting.

  • Not executing, Not jettisoned: The code block may or may not be reachable from any executables, but it is owned by an executable, and hence should be kept alive if its executable is live and if all of its weak references are live. Otherwise it should be deleted during the current GC cycle, and its outgoing references should not be scanned.


  • Not executing but jettisoned: The code block should be deleted as soon as possible and none of its outgoing references should be scanned.


  • Executing but not jettisoned: The code block should be kept alive during this GC cycle, and all of its outgoing references (including the weak ones) should be scanned and marked strongly. The mayBeExecuting bit will be cleared at the end of the GC cycle.


  • Executing and jettisoned: The code block should be kept alive during this GC cycle, and all of its outgoing references (including the weak ones) should be scanned and marked strongly. However, on the next GC cycle, it will have its mayBeExecuting bit cleared and hence it will become a candidate for immediate deletion provided it is not executing again.

This is performance-neutral.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • Target.pri:
  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::~CodeBlock):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::setJITCode):
(JSC::CodeBlock::DFGData::DFGData):
(JSC::DFGCodeBlocks::mark):

  • heap/ConservativeRoots.cpp:

(JSC::ConservativeRoots::add):

  • heap/ConservativeRoots.h:
  • heap/DFGCodeBlocks.cpp: Added.

(JSC::DFGCodeBlocks::DFGCodeBlocks):
(JSC::DFGCodeBlocks::~DFGCodeBlocks):
(JSC::DFGCodeBlocks::jettison):
(JSC::DFGCodeBlocks::clearMarks):
(JSC::DFGCodeBlocks::deleteUnmarkedJettisonedCodeBlocks):
(JSC::DFGCodeBlocks::traceMarkedCodeBlocks):

  • heap/DFGCodeBlocks.h: Added.
  • heap/Heap.cpp:

(JSC::Heap::jettisonDFGCodeBlock):
(JSC::Heap::markRoots):
(JSC::Heap::collect):

  • heap/Heap.h:
  • heap/JettisonedCodeBlocks.cpp: Removed.
  • heap/JettisonedCodeBlocks.h: Removed.
  • interpreter/RegisterFile.cpp:

(JSC::RegisterFile::gatherConservativeRoots):

  • interpreter/RegisterFile.h:
  • runtime/Executable.cpp:

(JSC::jettisonCodeBlock):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/heap/Heap.h

    r99898 r100556  
    2424
    2525#include "AllocationSpace.h"
     26#include "DFGCodeBlocks.h"
    2627#include "HandleHeap.h"
    2728#include "HandleStack.h"
    28 #include "JettisonedCodeBlocks.h"
    2929#include "MarkedBlock.h"
    3030#include "MarkedBlockSet.h"
     
    3838namespace JSC {
    3939
     40    class CodeBlock;
    4041    class GCActivityCallback;
    4142    class GlobalCodeBlock;
     
    104105        bool unprotect(JSValue); // True when the protect count drops to 0.
    105106       
    106         void addJettisonedCodeBlock(PassOwnPtr<CodeBlock>);
     107        void jettisonDFGCodeBlock(PassOwnPtr<CodeBlock>);
    107108
    108109        size_t size();
     
    132133        friend class AllocationSpace;
    133134        friend class SlotVisitor;
     135        friend class CodeBlock;
    134136
    135137        static const size_t minExtraCost = 256;
     
    205207        HandleHeap m_handleHeap;
    206208        HandleStack m_handleStack;
    207         JettisonedCodeBlocks m_jettisonedCodeBlocks;
     209        DFGCodeBlocks m_dfgCodeBlocks;
    208210        FinalizerOwner m_finalizerOwner;
    209211       
Note: See TracChangeset for help on using the changeset viewer.