Changeset 117015 in webkit


Ignore:
Timestamp:
May 14, 2012 4:47:53 PM (12 years ago)
Author:
msaboff@apple.com
Message:

Enh: Add the Ability to Disable / Enable JavaScript GC Timer
https://bugs.webkit.org/show_bug.cgi?id=86382

Reviewed by Darin Adler.

Source/JavaScriptCore:

Add flag to GCActivityCallback to enable / disable activity timer.
Add api via Heap to set the flag's value.

  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Windows export
  • heap/Heap.cpp:

(JSC::Heap::setGarbageCollectionTimerEnabled):

  • heap/Heap.h:
  • runtime/GCActivityCallback.h:

(JSC::GCActivityCallback::isEnabled):
(JSC::GCActivityCallback::setEnabled):
(JSC::GCActivityCallback::GCActivityCallback):

  • runtime/GCActivityCallbackCF.cpp:

(JSC::DefaultGCActivityCallbackPlatformData::timerDidFire):

Source/WebCore:

Plumbing to set / clear JS GC activity timer enable flag.

  • WebCore.exp.in:
  • bindings/js/GCController.cpp:

(WebCore::GCController::setJavaScriptGarbageCollectorTimerEnabled):

  • bindings/js/GCController.h:

Source/WebKit/mac:

Plumbing to set / clear JS GC activity timer enable flag.

  • Misc/WebCoreStatistics.h:
  • Misc/WebCoreStatistics.mm:

(+[WebCoreStatistics setJavaScriptGarbageCollectorTimerEnabled:]):

Source/WebKit2:

Plumbing to set / clear JS GC activity timer enable flag.

  • UIProcess/API/C/WKContext.cpp:

(WKContextSetJavaScriptGarbageCollectorTimerEnabled):

  • UIProcess/API/C/WKContext.h:
  • UIProcess/WebContext.cpp:

(WebKit::WebContext::setJavaScriptGarbageCollectorTimerEnabled):

  • UIProcess/WebContext.h:
  • WebProcess/WebProcess.cpp:

(WebKit::WebProcess::setJavaScriptGarbageCollectorTimerEnabled):

  • WebProcess/WebProcess.h:
  • WebProcess/WebProcess.messages.in:
Location:
trunk/Source
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r117013 r117015  
     12012-05-14  Michael Saboff  <msaboff@apple.com>
     2
     3        Enh: Add the Ability to Disable / Enable JavaScript GC Timer
     4        https://bugs.webkit.org/show_bug.cgi?id=86382
     5
     6        Reviewed by Darin Adler.
     7
     8        Add flag to GCActivityCallback to enable / disable activity timer.
     9        Add api via Heap to set the flag's value.
     10
     11        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Windows export
     12        * heap/Heap.cpp:
     13        (JSC::Heap::setGarbageCollectionTimerEnabled):
     14        * heap/Heap.h:
     15        * runtime/GCActivityCallback.h:
     16        (JSC::GCActivityCallback::isEnabled):
     17        (JSC::GCActivityCallback::setEnabled):
     18        (JSC::GCActivityCallback::GCActivityCallback):
     19        * runtime/GCActivityCallbackCF.cpp:
     20        (JSC::DefaultGCActivityCallbackPlatformData::timerDidFire):
     21
    1222012-05-14  Michael Saboff  <msaboff@apple.com>
    223
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def

    r116828 r117015  
    295295    ?setDumpsGeneratedCode@BytecodeGenerator@JSC@@SAX_N@Z
    296296    ?setEnumerable@PropertyDescriptor@JSC@@QAEX_N@Z
     297    ?setGarbageCollectionTimerEnabled@Heap@JSC@@QAEX_N@Z
    297298    ?setGetter@PropertyDescriptor@JSC@@QAEXVJSValue@2@@Z
    298299    ?setLoc@StatementNode@JSC@@QAEXHH@Z
  • trunk/Source/JavaScriptCore/heap/Heap.cpp

    r116822 r117015  
    833833}
    834834
     835void Heap::setGarbageCollectionTimerEnabled(bool enable)
     836{
     837    activityCallback()->setEnabled(enable);
     838}
     839
    835840void Heap::didAllocate(size_t bytes)
    836841{
  • trunk/Source/JavaScriptCore/heap/Heap.h

    r116025 r117015  
    101101        JS_EXPORT_PRIVATE GCActivityCallback* activityCallback();
    102102        JS_EXPORT_PRIVATE void setActivityCallback(PassOwnPtr<GCActivityCallback>);
     103        JS_EXPORT_PRIVATE void setGarbageCollectionTimerEnabled(bool);
    103104
    104105        // true if an allocation or collection is in progress
  • trunk/Source/JavaScriptCore/runtime/GCActivityCallback.h

    r115915 r117015  
    4848    virtual void synchronize() { }
    4949    virtual void cancel() { }
     50    bool isEnabled() const { return m_enabled; }
     51    void setEnabled(bool enabled) { m_enabled = enabled; }
    5052
    5153protected:
    52     GCActivityCallback() {}
     54    GCActivityCallback()
     55        : m_enabled(true)
     56    {
     57    }
     58
     59    bool m_enabled;
    5360};
    5461
  • trunk/Source/JavaScriptCore/runtime/GCActivityCallbackCF.cpp

    r116043 r117015  
    6464{
    6565    Heap* heap = static_cast<Heap*>(info);
     66    if (!heap->activityCallback()->isEnabled())
     67        return;
     68
    6669    APIEntryShim shim(heap->globalData());
    6770#if !PLATFORM(IOS)
  • trunk/Source/WebCore/ChangeLog

    r117012 r117015  
     12012-05-14  Michael Saboff  <msaboff@apple.com>
     2
     3        Enh: Add the Ability to Disable / Enable JavaScript GC Timer
     4        https://bugs.webkit.org/show_bug.cgi?id=86382
     5
     6        Reviewed by Darin Adler.
     7
     8        Plumbing to set / clear JS GC activity timer enable flag.
     9
     10        * WebCore.exp.in:
     11        * bindings/js/GCController.cpp:
     12        (WebCore::GCController::setJavaScriptGarbageCollectorTimerEnabled):
     13        * bindings/js/GCController.h:
     14
    1152012-05-14  Nate Chapin  <japhet@chromium.org>
    216
  • trunk/Source/WebCore/WebCore.exp.in

    r116828 r117015  
    251251__ZN7WebCore12GCController17garbageCollectNowEv
    252252__ZN7WebCore12GCController18garbageCollectSoonEv
     253__ZN7WebCore12GCController41setJavaScriptGarbageCollectorTimerEnabledEb
    253254__ZN7WebCore12GCController43garbageCollectOnAlternateThreadForDebuggingEb
    254255__ZN7WebCore12PopupMenuMacC1EPNS_15PopupMenuClientE
  • trunk/Source/WebCore/bindings/js/GCController.cpp

    r115383 r117015  
    9898}
    9999
     100void GCController::setJavaScriptGarbageCollectorTimerEnabled(bool enable)
     101{
     102    JSDOMWindow::commonJSGlobalData()->heap.setGarbageCollectionTimerEnabled(enable);
     103}
     104
    100105void GCController::discardAllCompiledCode()
    101106{
  • trunk/Source/WebCore/bindings/js/GCController.h

    r115383 r117015  
    4545
    4646        void garbageCollectOnAlternateThreadForDebugging(bool waitUntilDone); // Used for stress testing.
    47 
     47        void setJavaScriptGarbageCollectorTimerEnabled(bool);
    4848        void discardAllCompiledCode();
    4949
  • trunk/Source/WebKit/mac/ChangeLog

    r116828 r117015  
     12012-05-14  Michael Saboff  <msaboff@apple.com>
     2
     3        Enh: Add the Ability to Disable / Enable JavaScript GC Timer
     4        https://bugs.webkit.org/show_bug.cgi?id=86382
     5
     6        Reviewed by Darin Adler.
     7
     8        Plumbing to set / clear JS GC activity timer enable flag.
     9
     10        * Misc/WebCoreStatistics.h:
     11        * Misc/WebCoreStatistics.mm:
     12        (+[WebCoreStatistics setJavaScriptGarbageCollectorTimerEnabled:]):
     13
    1142012-05-11  Gavin Barraclough  <barraclough@apple.com>
    215
  • trunk/Source/WebKit/mac/Misc/WebCoreStatistics.h

    r63521 r117015  
    4848+ (void)garbageCollectJavaScriptObjects;
    4949+ (void)garbageCollectJavaScriptObjectsOnAlternateThreadForDebugging:(BOOL)waitUntilDone;
     50+ (void)setJavaScriptGarbageCollectorTimerEnabled:(BOOL)enabled;
    5051
    5152+ (size_t)iconPageURLMappingCount;
  • trunk/Source/WebKit/mac/Misc/WebCoreStatistics.mm

    r80299 r117015  
    121121}
    122122
     123+ (void)setJavaScriptGarbageCollectorTimerEnabled:(BOOL)enable
     124{
     125    gcController().setJavaScriptGarbageCollectorTimerEnabled(enable);
     126}
     127
    123128+ (size_t)iconPageURLMappingCount
    124129{
  • trunk/Source/WebKit2/ChangeLog

    r116993 r117015  
     12012-05-14  Michael Saboff  <msaboff@apple.com>
     2
     3        Enh: Add the Ability to Disable / Enable JavaScript GC Timer
     4        https://bugs.webkit.org/show_bug.cgi?id=86382
     5
     6        Reviewed by Darin Adler.
     7
     8        Plumbing to set / clear JS GC activity timer enable flag.
     9
     10        * UIProcess/API/C/WKContext.cpp:
     11        (WKContextSetJavaScriptGarbageCollectorTimerEnabled):
     12        * UIProcess/API/C/WKContext.h:
     13        * UIProcess/WebContext.cpp:
     14        (WebKit::WebContext::setJavaScriptGarbageCollectorTimerEnabled):
     15        * UIProcess/WebContext.h:
     16        * WebProcess/WebProcess.cpp:
     17        (WebKit::WebProcess::setJavaScriptGarbageCollectorTimerEnabled):
     18        * WebProcess/WebProcess.h:
     19        * WebProcess/WebProcess.messages.in:
     20
    1212012-05-14  Anders Carlsson  <andersca@apple.com>
    222
  • trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp

    r110425 r117015  
    266266}
    267267
     268void WKContextSetJavaScriptGarbageCollectorTimerEnabled(WKContextRef contextRef, bool enable)
     269{
     270    toImpl(contextRef)->setJavaScriptGarbageCollectorTimerEnabled(enable);
     271}
    268272// Deprecated functions.
    269273void _WKContextSetAdditionalPluginsDirectory(WKContextRef context, WKStringRef pluginsDirectory)
  • trunk/Source/WebKit2/UIProcess/API/C/WKContext.h

    r101307 r117015  
    157157   
    158158WK_EXPORT void WKContextGarbageCollectJavaScriptObjects(WKContextRef context);
     159WK_EXPORT void WKContextSetJavaScriptGarbageCollectorTimerEnabled(WKContextRef context, bool enable);
    159160
    160161#ifdef __cplusplus
  • trunk/Source/WebKit2/UIProcess/WebContext.cpp

    r116971 r117015  
    957957}
    958958
     959void WebContext::setJavaScriptGarbageCollectorTimerEnabled(bool flag)
     960{
     961    sendToAllProcesses(Messages::WebProcess::SetJavaScriptGarbageCollectorTimerEnabled(flag));
     962}
     963
    959964void WebContext::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments, bool& didHandleMessage)
    960965{
  • trunk/Source/WebKit2/UIProcess/WebContext.h

    r116796 r117015  
    195195    void getWebCoreStatistics(PassRefPtr<DictionaryCallback>);
    196196    void garbageCollectJavaScriptObjects();
     197    void setJavaScriptGarbageCollectorTimerEnabled(bool flag);
    197198
    198199#if PLATFORM(MAC)
  • trunk/Source/WebKit2/WebProcess/WebProcess.cpp

    r116796 r117015  
    963963}
    964964
     965void WebProcess::setJavaScriptGarbageCollectorTimerEnabled(bool flag)
     966{
     967    gcController().setJavaScriptGarbageCollectorTimerEnabled(flag);
     968}
     969
    965970#if ENABLE(PLUGIN_PROCESS)
    966971void WebProcess::pluginProcessCrashed(CoreIPC::Connection*, const String& pluginPath)
  • trunk/Source/WebKit2/WebProcess/WebProcess.h

    r116796 r117015  
    217217    void getWebCoreStatistics(uint64_t callbackID);
    218218    void garbageCollectJavaScriptObjects();
     219    void setJavaScriptGarbageCollectorTimerEnabled(bool flag);
    219220
    220221#if PLATFORM(MAC)
  • trunk/Source/WebKit2/WebProcess/WebProcess.messages.in

    r116796 r117015  
    7878    GetWebCoreStatistics(uint64_t callbackID)
    7979    GarbageCollectJavaScriptObjects()
     80    SetJavaScriptGarbageCollectorTimerEnabled(bool enable)
    8081
    8182#if PLATFORM(MAC)
Note: See TracChangeset for help on using the changeset viewer.