Changeset 181310 in webkit


Ignore:
Timestamp:
Mar 9, 2015 10:32:49 PM (9 years ago)
Author:
Chris Dumez
Message:

[iOS] Sweep all collected objects on critical memory pressure
https://bugs.webkit.org/show_bug.cgi?id=142457
<rdar://problem/20044440>

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

All fullSweep() API to IncrementalSweeper so that we can call it in the
memory pressure handler.

  • heap/IncrementalSweeper.cpp:

(JSC::IncrementalSweeper::fullSweep):

  • heap/IncrementalSweeper.h:

(JSC::IncrementalSweeper::hasWork):

Source/WebCore:

Do a full sweep of objects marked for destruction on critical memory
pressure to free up memory.

  • platform/cocoa/MemoryPressureHandlerCocoa.mm:

(WebCore::MemoryPressureHandler::platformReleaseMemory):

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r181309 r181310  
     12015-03-09  Chris Dumez  <cdumez@apple.com>
     2
     3        [iOS] Sweep all collected objects on critical memory pressure
     4        https://bugs.webkit.org/show_bug.cgi?id=142457
     5        <rdar://problem/20044440>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        All fullSweep() API to IncrementalSweeper so that we can call it in the
     10        memory pressure handler.
     11
     12        * heap/IncrementalSweeper.cpp:
     13        (JSC::IncrementalSweeper::fullSweep):
     14        * heap/IncrementalSweeper.h:
     15        (JSC::IncrementalSweeper::hasWork):
     16
    1172015-03-09  Mark Lam  <mark.lam@apple.com>
    218
  • trunk/Source/JavaScriptCore/heap/IncrementalSweeper.cpp

    r179728 r181310  
    5959{
    6060    CFRunLoopTimerSetNextFireDate(m_timer.get(), CFAbsoluteTimeGetCurrent() + s_decade);
     61}
     62
     63void IncrementalSweeper::fullSweep()
     64{
     65    while (hasWork())
     66        doWork();
    6167}
    6268
  • trunk/Source/JavaScriptCore/heap/IncrementalSweeper.h

    r176533 r181310  
    3939#if USE(CF)
    4040    JS_EXPORT_PRIVATE IncrementalSweeper(Heap*, CFRunLoopRef);
     41    JS_EXPORT_PRIVATE void fullSweep();
    4142#else
    4243    explicit IncrementalSweeper(VM*);
     
    5354    void scheduleTimer();
    5455    void cancelTimer();
     56    bool hasWork() const { return !m_blocksToSweep.isEmpty(); }
    5557   
    5658    unsigned m_currentBlockToSweepIndex;
  • trunk/Source/WebCore/ChangeLog

    r181302 r181310  
     12015-03-09  Chris Dumez  <cdumez@apple.com>
     2
     3        [iOS] Sweep all collected objects on critical memory pressure
     4        https://bugs.webkit.org/show_bug.cgi?id=142457
     5        <rdar://problem/20044440>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        Do a full sweep of objects marked for destruction on critical memory
     10        pressure to free up memory.
     11
     12        * platform/cocoa/MemoryPressureHandlerCocoa.mm:
     13        (WebCore::MemoryPressureHandler::platformReleaseMemory):
     14
    1152015-03-09  Andy Estes  <aestes@apple.com>
    216
  • trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm

    r181215 r181310  
    3030#import "IOSurfacePool.h"
    3131#import "GCController.h"
     32#import "JSDOMWindow.h"
    3233#import "JSDOMWindowBase.h"
    3334#import "LayerPool.h"
    3435#import "Logging.h"
    3536#import "WebCoreSystemInterface.h"
     37#import <JavaScriptCore/IncrementalSweeper.h>
    3638#import <mach/mach.h>
    3739#import <mach/task_info.h>
     
    8890        ReliefLogger log("Collecting JavaScript garbage");
    8991        gcController().garbageCollectNow();
     92    }
     93
     94    // Do a full sweep of collected objects.
     95    {
     96        ReliefLogger log("Full JavaScript garbage sweep");
     97        JSC::JSLockHolder lock(JSDOMWindow::commonVM());
     98        JSDOMWindow::commonVM().heap.sweeper()->fullSweep();
    9099    }
    91100#endif
Note: See TracChangeset for help on using the changeset viewer.