Ignore:
Timestamp:
May 27, 2011, 11:30:08 AM (14 years ago)
Author:
[email protected]
Message:

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

Reviewed by Geoffrey Garen.

Try to release unused executable memory when the FixedVMPool allocator is under pressure
https://bugs.webkit.org/show_bug.cgi?id=61651

Rather than crashing when full the FixedVMPool allocator now returns a null
allocation. We replace the code that used to CRASH() on null allocations
with logic that asks the provided globalData to release any executable memory
that it can. Currently this just means throwing away all regexp code, but
in future we'll try to be more aggressive.

  • assembler/ARMAssembler.cpp: (JSC::ARMAssembler::executableCopy):
  • assembler/ARMAssembler.h:
  • assembler/AssemblerBuffer.h: (JSC::AssemblerBuffer::executableCopy):
  • assembler/AssemblerBufferWithConstantPool.h:
  • assembler/LinkBuffer.h: (JSC::LinkBuffer::LinkBuffer): (JSC::LinkBuffer::linkCode):
  • assembler/MIPSAssembler.h: (JSC::MIPSAssembler::executableCopy):
  • assembler/SH4Assembler.h: (JSC::SH4Assembler::executableCopy):
  • assembler/X86Assembler.h: (JSC::X86Assembler::executableCopy): (JSC::X86Assembler::X86InstructionFormatter::executableCopy):
  • dfg/DFGJITCompiler.cpp: (JSC::DFG::JITCompiler::compileFunction):
  • jit/ExecutableAllocator.h: (JSC::ExecutablePool::create): (JSC::ExecutablePool::alloc): (JSC::ExecutableAllocator::ExecutableAllocator): (JSC::ExecutableAllocator::poolForSize): (JSC::ExecutablePool::ExecutablePool): (JSC::ExecutablePool::poolAllocate):
  • jit/ExecutableAllocatorFixedVMPool.cpp: (JSC::FixedVMPoolAllocator::alloc):
  • jit/JIT.cpp: (JSC::JIT::privateCompile):
  • jit/JITOpcodes.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines):
  • jit/JITOpcodes32_64.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC::JIT::privateCompileCTINativeCall):
  • jit/JITPropertyAccess.cpp: (JSC::JIT::stringGetByValStubGenerator): (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::privateCompilePatchGetArrayLength): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdSelfList): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain):
  • jit/JITPropertyAccess32_64.cpp: (JSC::JIT::stringGetByValStubGenerator): (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::privateCompilePatchGetArrayLength): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdSelfList): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain):
  • jit/SpecializedThunkJIT.h: (JSC::SpecializedThunkJIT::finalize):
  • jit/ThunkGenerators.cpp: (JSC::charCodeAtThunkGenerator): (JSC::charAtThunkGenerator): (JSC::fromCharCodeThunkGenerator): (JSC::sqrtThunkGenerator): (JSC::powThunkGenerator):
  • runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData): (JSC::JSGlobalData::releaseExecutableMemory): (JSC::releaseExecutableMemory):
  • runtime/JSGlobalData.h:
  • runtime/RegExpCache.cpp: (JSC::RegExpCache::invalidateCode):
  • runtime/RegExpCache.h:
  • yarr/YarrJIT.cpp: (JSC::Yarr::YarrGenerator::compile):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/assembler/LinkBuffer.h

    r87356 r87527  
    3636
    3737namespace JSC {
     38
     39class JSGlobalData;
    3840
    3941// LinkBuffer:
     
    6870
    6971public:
    70     LinkBuffer(MacroAssembler* masm, PassRefPtr<ExecutablePool> executablePool)
     72    LinkBuffer(JSGlobalData& globalData, MacroAssembler* masm, PassRefPtr<ExecutablePool> executablePool)
    7173        : m_executablePool(executablePool)
    7274        , m_size(0)
    7375        , m_code(0)
    7476        , m_assembler(masm)
     77        , m_globalData(&globalData)
    7578#ifndef NDEBUG
    7679        , m_completed(false)
     
    8083    }
    8184
    82     LinkBuffer(MacroAssembler* masm, ExecutableAllocator& allocator)
    83         : m_executablePool(allocator.poolForSize(masm->m_assembler.codeSize()))
     85    LinkBuffer(JSGlobalData& globalData, MacroAssembler* masm, ExecutableAllocator& allocator)
     86        : m_executablePool(allocator.poolForSize(globalData, masm->m_assembler.codeSize()))
    8487        , m_size(0)
    8588        , m_code(0)
    8689        , m_assembler(masm)
     90        , m_globalData(&globalData)
    8791#ifndef NDEBUG
    8892        , m_completed(false)
     
    224228        ASSERT(!m_code);
    225229#if !ENABLE(BRANCH_COMPACTION)
    226         m_code = m_assembler->m_assembler.executableCopy(m_executablePool.get());
     230        m_code = m_assembler->m_assembler.executableCopy(*m_globalData, m_executablePool.get());
    227231        m_size = m_assembler->m_assembler.codeSize();
    228232        ASSERT(m_code);
     
    355359    void* m_code;
    356360    MacroAssembler* m_assembler;
     361    JSGlobalData* m_globalData;
    357362#ifndef NDEBUG
    358363    bool m_completed;
Note: See TracChangeset for help on using the changeset viewer.