2008-10-13 Sam Weinig <sam@webkit.org>
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 <sam@webkit.org>
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):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37563
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2008-10-13 Sam Weinig <sam@webkit.org>
+
+ 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:
+
2008-10-13 Marco Barisione <marco.barisione@collabora.co.uk>
Reviewed by Darin Adler. Landed by Jan Alonzo.
__ZN3JSC11StructureIDD1Ev
__ZN3JSC12DateInstance4infoE
__ZN3JSC12JSGlobalData10ClientDataD2Ev
+__ZN3JSC12JSGlobalData12createLeakedEv
__ZN3JSC12JSGlobalData6createEv
__ZN3JSC12JSGlobalDataD1Ev
__ZN3JSC12SamplingTool4dumpEPNS_9ExecStateE
return adoptRef(new JSGlobalData);
}
+PassRefPtr<JSGlobalData> JSGlobalData::createLeaked()
+{
+#ifndef NDEBUG
+ StructureID::startIgnoringLeaks();
+ RefPtr<JSGlobalData> data = create();
+ StructureID::stopIgnoringLeaks();
+ return data.release();
+#else
+ return create();
+#endif
+}
+
bool JSGlobalData::sharedInstanceExists()
{
return sharedInstanceInternal();
static JSGlobalData& sharedInstance();
static PassRefPtr<JSGlobalData> create();
+ static PassRefPtr<JSGlobalData> createLeaked();
~JSGlobalData();
Machine* machine;
#ifndef NDEBUG
static WTF::RefCountedLeakCounter structureIDCounter("StructureID");
+
+static bool shouldIgnoreLeaks;
+static HashSet<StructureID*> ignoreSet;
#endif
StructureID::StructureID(JSValue* prototype, const TypeInfo& typeInfo)
ASSERT(m_prototype->isObject() || m_prototype->isNull());
#ifndef NDEBUG
- structureIDCounter.increment();
+ if (shouldIgnoreLeaks)
+ ignoreSet.add(this);
+ else
+ structureIDCounter.increment();
#endif
}
m_cachedPropertyNameArrayData->setCachedStructureID(0);
#ifndef NDEBUG
- structureIDCounter.decrement();
+ HashSet<StructureID*>::iterator it = ignoreSet.find(this);
+ if (it != ignoreSet.end())
+ ignoreSet.remove(it);
+ else
+ structureIDCounter.decrement();
+#endif
+}
+
+void StructureID::startIgnoringLeaks()
+{
+#ifndef NDEBUG
+ shouldIgnoreLeaks = true;
+#endif
+}
+
+void StructureID::stopIgnoringLeaks()
+{
+#ifndef NDEBUG
+ shouldIgnoreLeaks = false;
#endif
}
return adoptRef(new StructureID(prototype, typeInfo));
}
+ static void startIgnoringLeaks();
+ static void stopIgnoringLeaks();
+
static PassRefPtr<StructureID> changePrototypeTransition(StructureID*, JSValue* prototype);
static PassRefPtr<StructureID> addPropertyTransition(StructureID*, const Identifier& propertyName, unsigned attributes, size_t& offset);
static PassRefPtr<StructureID> getterSetterTransition(StructureID*);
+2008-10-13 Sam Weinig <sam@webkit.org>
+
+ 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):
+
2008-10-13 David Hyatt <hyatt@apple.com>
Add support for the :corner-present pseudoclass, which enables scrollbar pieces to change their
JSGlobalData* JSDOMWindowBase::commonJSGlobalData()
{
- static JSGlobalData* globalData = JSGlobalData::create().releaseRef();
+ static JSGlobalData* globalData = JSGlobalData::createLeaked().releaseRef();
return globalData;
}