JavaScriptCore:
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jul 2007 12:09:08 +0000 (12:09 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jul 2007 12:09:08 +0000 (12:09 +0000)
commit8c5d510af1d64f6a22dc21022d859e466d8e0c14
tree2a49923a519708918e1fe1469326efaec7ccfc54
parent2070fa74f0cc075c87221e32db7601f0b8c6eb37
JavaScriptCore:

        Reviewed by Antti.

        - <rdar://problem/5311093> JavaScriptCore fails to build with strict-aliasing warnings

        * Configurations/Base.xcconfig: Re-enable -Wstrict-aliasing
        * bindings/jni/jni_utility.cpp:
        (KJS::Bindings::getJNIEnv): Type-pun via a union instead of a pointer cast.
        * wtf/HashMap.h:
        (WTF::): Instead of doing type-punned assignments via pointer cast, do one of three things:
        (1) assign directly w/o cast if storage type matches real type; (2) assign using cast
        via union if type does not need reffing; (3) copy with memcpy and ref/deref manually if type
        needs reffing. This is ok peref-wise because memcpy of a constant length gets optomized.
        HashTraits are now expected to make ref()/deref() take the storage type, not the true type.
        * wtf/HashSet.h:
        (WTF::): Same basic idea.
        * wtf/HashTable.h:
        (WTF::): Added Assigner template for use by HashMap/HashSet. Change RefCounter to call ref()
        and deref() via storage type, avoiding the need to
        type-pun.
        (WTF::RefCounter::ref): ditto
        (WTF::RefCounter::deref): ditto
        * wtf/HashTraits.h:
        (WTF::): Change ref() and deref() for RefPtr HashTraits to take the storage type; cast
        via union to pointer type.
        * wtf/FastMalloc.cpp:
        (WTF::TCMalloc_PageHeap::init): Changed from constructor to init function so this can go in a union.
        (WTF::): redefine pageheap macro in terms of getPageHeap().
        (WTF::getPageHeap): new inline function, helper for pageheap macro. This hides the cast in a union.
        (WTF::TCMalloc_ThreadCache::InitModule): Call init() instead of using placement new to initialize page
        heap.
        * wtf/TCPageMap.h:
        (TCMalloc_PageMap1::init): Changed from constructor to init function.
        (TCMalloc_PageMap2::init): ditto
        (TCMalloc_PageMap3::init): ditto

WebCore:

        Reviewed by Antti.

        - <rdar://problem/5311093> JavaScriptCore fails to build with strict-aliasing warnings

        * platform/StringHash.h:
        (WTF::): Adapt to newer way to do storage types.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@24059 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/Configurations/Base.xcconfig
JavaScriptCore/bindings/jni/jni_utility.cpp
JavaScriptCore/wtf/FastMalloc.cpp
JavaScriptCore/wtf/HashMap.h
JavaScriptCore/wtf/HashSet.h
JavaScriptCore/wtf/HashTable.h
JavaScriptCore/wtf/HashTraits.h
JavaScriptCore/wtf/TCPageMap.h
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/platform/StringHash.h