Changeset 37563 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Oct 13, 2008, 2:41:40 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2008-10-13 Sam Weinig <[email protected]>

Reviewed by Dan Bernstein.

Fix for https://bugs.webkit.org/show_bug.cgi?id=21577
5 false positive StructureID leaks

  • Add leak ignore set to StructureID to selectively ignore leaking some StructureIDs.
  • Add create method to JSGlolalData to be used when the data will be intentionally leaked and ignore all leaks caused the StructureIDs stored in it.
  • JavaScriptCore.exp:
  • kjs/JSGlobalData.cpp: (JSC::JSGlobalData::createLeaked):
  • kjs/JSGlobalData.h:
  • kjs/StructureID.cpp: (JSC::StructureID::StructureID): (JSC::StructureID::~StructureID): (JSC::StructureID::startIgnoringLeaks): (JSC::StructureID::stopIgnoringLeaks):
  • kjs/StructureID.h:

WebCore:

2008-10-13 Sam Weinig <[email protected]>

Reviewed by Dan Bernstein.

Fix for https://bugs.webkit.org/show_bug.cgi?id=21577
5 false positive StructureID leaks

In WebCore, we intentionally leak the common JSGlobalData which in turn
leaks 5 StructureIDs. Use the new JSGlobalData::createLeaked in order to
ignore the StructureIDs leaked within.

  • bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::commonJSGlobalData):
Location:
trunk/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r37556 r37563  
     12008-10-13  Sam Weinig  <[email protected]>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        Fix for https://bugs.webkit.org/show_bug.cgi?id=21577
     6        5 false positive StructureID leaks
     7
     8        - Add leak ignore set to StructureID to selectively ignore leaking some StructureIDs.
     9        - Add create method to JSGlolalData to be used when the data will be intentionally
     10          leaked and ignore all leaks caused the StructureIDs stored in it.
     11
     12        * JavaScriptCore.exp:
     13        * kjs/JSGlobalData.cpp:
     14        (JSC::JSGlobalData::createLeaked):
     15        * kjs/JSGlobalData.h:
     16        * kjs/StructureID.cpp:
     17        (JSC::StructureID::StructureID):
     18        (JSC::StructureID::~StructureID):
     19        (JSC::StructureID::startIgnoringLeaks):
     20        (JSC::StructureID::stopIgnoringLeaks):
     21        * kjs/StructureID.h:
     22
    1232008-10-13  Marco Barisione  <[email protected]>
    224
  • trunk/JavaScriptCore/JavaScriptCore.exp

    r37388 r37563  
    121121__ZN3JSC12DateInstance4infoE
    122122__ZN3JSC12JSGlobalData10ClientDataD2Ev
     123__ZN3JSC12JSGlobalData12createLeakedEv
    123124__ZN3JSC12JSGlobalData6createEv
    124125__ZN3JSC12JSGlobalDataD1Ev
  • trunk/JavaScriptCore/kjs/JSGlobalData.cpp

    r37323 r37563  
    147147}
    148148
     149PassRefPtr<JSGlobalData> JSGlobalData::createLeaked()
     150{
     151#ifndef NDEBUG
     152    StructureID::startIgnoringLeaks();
     153    RefPtr<JSGlobalData> data = create();
     154    StructureID::stopIgnoringLeaks();
     155    return data.release();
     156#else
     157    return create();
     158#endif
     159}
     160
    149161bool JSGlobalData::sharedInstanceExists()
    150162{
  • trunk/JavaScriptCore/kjs/JSGlobalData.h

    r37323 r37563  
    6161
    6262        static PassRefPtr<JSGlobalData> create();
     63        static PassRefPtr<JSGlobalData> createLeaked();
    6364        ~JSGlobalData();
    6465
  • trunk/JavaScriptCore/kjs/StructureID.cpp

    r37508 r37563  
    4040#ifndef NDEBUG   
    4141static WTF::RefCountedLeakCounter structureIDCounter("StructureID");
     42
     43static bool shouldIgnoreLeaks;
     44static HashSet<StructureID*> ignoreSet;
    4245#endif
    4346
     
    5861
    5962#ifndef NDEBUG
    60     structureIDCounter.increment();
     63    if (shouldIgnoreLeaks)
     64        ignoreSet.add(this);
     65    else
     66        structureIDCounter.increment();
    6167#endif
    6268}
     
    7379
    7480#ifndef NDEBUG
    75     structureIDCounter.decrement();
     81    HashSet<StructureID*>::iterator it = ignoreSet.find(this);
     82    if (it != ignoreSet.end())
     83        ignoreSet.remove(it);
     84    else
     85        structureIDCounter.decrement();
     86#endif
     87}
     88
     89void StructureID::startIgnoringLeaks()
     90{
     91#ifndef NDEBUG
     92    shouldIgnoreLeaks = true;
     93#endif
     94}
     95
     96void StructureID::stopIgnoringLeaks()
     97{
     98#ifndef NDEBUG
     99    shouldIgnoreLeaks = false;
    76100#endif
    77101}
  • trunk/JavaScriptCore/kjs/StructureID.h

    r37400 r37563  
    8282            return adoptRef(new StructureID(prototype, typeInfo));
    8383        }
     84
     85        static void startIgnoringLeaks();
     86        static void stopIgnoringLeaks();
    8487
    8588        static PassRefPtr<StructureID> changePrototypeTransition(StructureID*, JSValue* prototype);
Note: See TracChangeset for help on using the changeset viewer.