Ignore:
Timestamp:
Dec 21, 2010, 8:18:58 PM (14 years ago)
Author:
[email protected]
Message:

Reviewed by Geoff Garen.


<rdar://problem/8765333> CRASH running out of executable memory, loading io9.com
https://bugs.webkit.org/show_bug.cgi?id=51443

The problem here is that each page uses a reasonable amount of memory, (~4Mb),
and that when miultiple pages are open we keep all JIT code for all functions
in all pages alive.

Add a check to detect high memory pressure situations in the executable allocator
(>50% of available memory allocated), and upon a top level entry into JSC (no code
running on the stack) in this situation throw away all JIT code.

(JSC::Debugger::recompileAllJSFunctions): stop passing exec to recompile.

  • jit/ExecutableAllocator.h:
  • jit/ExecutableAllocatorFixedVMPool.cpp:

(JSC::ExecutablePool::systemAlloc): Count allocations.
(JSC::ExecutablePool::systemRelease): Count deallocations.
(JSC::ExecutablePool::underMemoryPressure): Check memory pressure.

  • jit/ExecutableAllocatorPosix.cpp:

(JSC::ExecutablePool::underMemoryPressure): Stub out; only meaningful with FixedVMPool.

  • jit/ExecutableAllocatorWin.cpp:

(JSC::ExecutablePool::underMemoryPressure): Stub out; only meaningful with FixedVMPool.

  • runtime/Executable.cpp:

(JSC::FunctionExecutable::recompile): Remove ExecState argument to recompile.

  • runtime/Executable.h:
  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::recompileAllJSFunctions): throws away all JIT code.

  • runtime/JSGlobalData.h:
  • runtime/JSGlobalObject.h:

(JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): add check / call to throw away.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSGlobalObject.cpp

    r70496 r74454  
    456456}
    457457
     458DynamicGlobalObjectScope::DynamicGlobalObjectScope(CallFrame* callFrame, JSGlobalObject* dynamicGlobalObject)
     459    : m_dynamicGlobalObjectSlot(callFrame->globalData().dynamicGlobalObject)
     460    , m_savedDynamicGlobalObject(m_dynamicGlobalObjectSlot)
     461{
     462    if (!m_dynamicGlobalObjectSlot) {
     463#if ENABLE(ASSEMBLER)
     464        if (ExecutableAllocator::underMemoryPressure())
     465            callFrame->globalData().recompileAllJSFunctions();
     466#endif
     467
     468        m_dynamicGlobalObjectSlot = dynamicGlobalObject;
     469
     470        // Reset the date cache between JS invocations to force the VM
     471        // to observe time zone changes.
     472        callFrame->globalData().resetDateCache();
     473    }
     474}
     475
    458476} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.