Ignore:
Timestamp:
Sep 21, 2011, 4:36:35 PM (14 years ago)
Author:
[email protected]
Message:

DFG should support continuous optimization
https://bugs.webkit.org/show_bug.cgi?id=68329

Reviewed by Geoffrey Garen.

This adds the ability to reoptimize a code block if speculation
failures happen frequently. 6% speed-up on Kraken, 1% slow-down
on V8, neutral on SunSpider.

(JSC::CodeBlock::CodeBlock):
(JSC::ProgramCodeBlock::jettison):
(JSC::EvalCodeBlock::jettison):
(JSC::FunctionCodeBlock::jettison):
(JSC::CodeBlock::shouldOptimizeNow):
(JSC::CodeBlock::dumpValueProfiles):

  • bytecode/CodeBlock.h:
  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::getStrongPrediction):

  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::exitSpeculativeWithOSR):
(JSC::DFG::JITCompiler::compileEntry):
(JSC::DFG::JITCompiler::compileBody):

  • dfg/DFGJITCompiler.h:

(JSC::DFG::JITCompiler::noticeOSREntry):

  • dfg/DFGOSREntry.cpp:

(JSC::DFG::prepareOSREntry):

  • dfg/DFGOSREntry.h:

(JSC::DFG::getOSREntryDataBytecodeIndex):

  • dfg/DFGSpeculativeJIT.cpp:

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

  • heap/ConservativeRoots.cpp:

(JSC::ConservativeRoots::ConservativeRoots):
(JSC::ConservativeRoots::~ConservativeRoots):
(JSC::DummyMarkHook::mark):
(JSC::ConservativeRoots::genericAddPointer):
(JSC::ConservativeRoots::genericAddSpan):
(JSC::ConservativeRoots::add):

  • heap/ConservativeRoots.h:
  • heap/Heap.cpp:

(JSC::Heap::addJettisonCodeBlock):
(JSC::Heap::markRoots):

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

(JSC::JettisonedCodeBlocks::JettisonedCodeBlocks):
(JSC::JettisonedCodeBlocks::~JettisonedCodeBlocks):
(JSC::JettisonedCodeBlocks::addCodeBlock):
(JSC::JettisonedCodeBlocks::clearMarks):
(JSC::JettisonedCodeBlocks::deleteUnmarkedCodeBlocks):
(JSC::JettisonedCodeBlocks::traceCodeBlocks):

  • heap/JettisonedCodeBlocks.h: Added.

(JSC::JettisonedCodeBlocks::mark):

  • interpreter/RegisterFile.cpp:

(JSC::RegisterFile::gatherConservativeRoots):

  • interpreter/RegisterFile.h:
  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/Executable.cpp:

(JSC::jettisonCodeBlock):
(JSC::EvalExecutable::jettisonOptimizedCode):
(JSC::ProgramExecutable::jettisonOptimizedCode):
(JSC::FunctionExecutable::jettisonOptimizedCodeForCall):
(JSC::FunctionExecutable::jettisonOptimizedCodeForConstruct):

  • runtime/Executable.h:

(JSC::FunctionExecutable::jettisonOptimizedCodeFor):

  • wtf/BitVector.h: Added.

(WTF::BitVector::BitVector):
(WTF::BitVector::~BitVector):
(WTF::BitVector::operator=):
(WTF::BitVector::size):
(WTF::BitVector::ensureSize):
(WTF::BitVector::resize):
(WTF::BitVector::clearAll):
(WTF::BitVector::get):
(WTF::BitVector::set):
(WTF::BitVector::clear):
(WTF::BitVector::bitsInPointer):
(WTF::BitVector::maxInlineBits):
(WTF::BitVector::byteCount):
(WTF::BitVector::makeInlineBits):
(WTF::BitVector::OutOfLineBits::numBits):
(WTF::BitVector::OutOfLineBits::numWords):
(WTF::BitVector::OutOfLineBits::bits):
(WTF::BitVector::OutOfLineBits::create):
(WTF::BitVector::OutOfLineBits::destroy):
(WTF::BitVector::OutOfLineBits::OutOfLineBits):
(WTF::BitVector::isInline):
(WTF::BitVector::outOfLineBits):
(WTF::BitVector::resizeOutOfLine):
(WTF::BitVector::bits):

File:
1 edited

Legend:

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

    r95559 r95681  
    395395}
    396396
     397void Heap::addJettisonedCodeBlock(PassOwnPtr<CodeBlock> codeBlock)
     398{
     399    m_jettisonedCodeBlocks.addCodeBlock(codeBlock);
     400}
     401
    397402void Heap::pushTempSortVector(Vector<ValueStringPair>* tempVector)
    398403{
     
    457462
    458463    void* dummy;
    459 
     464   
    460465    // We gather conservative roots before clearing mark bits because conservative
    461466    // gathering uses the mark bits to determine whether a reference is valid.
     
    464469
    465470    ConservativeRoots registerFileRoots(&m_objectSpace.blocks());
    466     registerFile().gatherConservativeRoots(registerFileRoots);
     471    m_jettisonedCodeBlocks.clearMarks();
     472    registerFile().gatherConservativeRoots(registerFileRoots, m_jettisonedCodeBlocks);
     473    m_jettisonedCodeBlocks.deleteUnmarkedCodeBlocks();
    467474
    468475    clearMarks();
     
    470477    SlotVisitor& visitor = m_slotVisitor;
    471478    HeapRootVisitor heapRootVisitor(visitor);
    472 
     479   
    473480    visitor.append(machineThreadRoots);
    474481    visitor.drain();
     
    493500
    494501    m_handleStack.visit(heapRootVisitor);
     502    visitor.drain();
     503   
     504    m_jettisonedCodeBlocks.traceCodeBlocks(visitor);
    495505    visitor.drain();
    496506
Note: See TracChangeset for help on using the changeset viewer.