Ignore:
Timestamp:
Jun 27, 2011, 6:32:01 PM (14 years ago)
Author:
[email protected]
Message:

2011-06-27 Oliver Hunt <[email protected]>

Reviewed by Geoffrey Garen.

Support throwing away non-running code even while other code is running
https://bugs.webkit.org/show_bug.cgi?id=63485

Add a function to CodeBlock to support unlinking direct linked callsites,
and then with that in place add logic to discard code from any function
that is not currently on the stack.

The unlinking completely reverts any optimized call sites, such that they
may be relinked again in future.

  • JavaScriptCore.exp:
  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::unlinkCalls): (JSC::CodeBlock::clearEvalCache):
  • bytecode/CodeBlock.h: (JSC::CallLinkInfo::CallLinkInfo): (JSC::CallLinkInfo::unlink):
  • bytecode/EvalCodeCache.h: (JSC::EvalCodeCache::clear):
  • heap/Heap.cpp: (JSC::Heap::getConservativeRegisterRoots):
  • heap/Heap.h:
  • jit/JIT.cpp: (JSC::JIT::privateCompile):
  • jit/JIT.h:
  • jit/JITCall.cpp: (JSC::JIT::compileOpCall):
  • jit/JITWriteBarrier.h: (JSC::JITWriteBarrierBase::clear):
  • jsc.cpp: (GlobalObject::GlobalObject): (functionReleaseExecutableMemory):
  • runtime/Executable.cpp: (JSC::EvalExecutable::unlinkCalls): (JSC::ProgramExecutable::unlinkCalls): (JSC::FunctionExecutable::discardCode): (JSC::FunctionExecutable::unlinkCalls):
  • runtime/Executable.h:
  • runtime/JSGlobalData.cpp: (JSC::SafeRecompiler::returnValue): (JSC::SafeRecompiler::operator()): (JSC::JSGlobalData::releaseExecutableMemory):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r89630 r89885  
    3939#include "JSStaticScopeObject.h"
    4040#include "JSValue.h"
     41#include "RepatchBuffer.h"
    4142#include "UStringConcatenate.h"
    4243#include <stdio.h>
     
    16771678    callFrame->setScopeChain(callFrame->scopeChain()->push(activation));
    16781679}
     1680   
     1681#if ENABLE(JIT)
     1682void CodeBlock::unlinkCalls()
     1683{
     1684    if (!(m_callLinkInfos.size() || m_methodCallLinkInfos.size()))
     1685        return;
     1686    RepatchBuffer repatchBuffer(this);
     1687    for (size_t i = 0; i < m_callLinkInfos.size(); i++) {
     1688        if (!m_callLinkInfos[i].isLinked())
     1689            continue;
     1690        repatchBuffer.relink(m_callLinkInfos[i].callReturnLocation, m_callLinkInfos[i].isCall ? m_globalData->jitStubs->ctiVirtualCallLink() : m_globalData->jitStubs->ctiVirtualConstructLink());
     1691        m_callLinkInfos[i].unlink();
     1692    }
     1693}
     1694#endif
     1695
     1696void CodeBlock::clearEvalCache()
     1697{
     1698    if (!m_rareData)
     1699        return;
     1700    m_rareData->m_evalCodeCache.clear();
     1701}
    16791702
    16801703} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.