2011-04-04 Sheriff Bot <webkit.review.bot@gmail.com>

        Unreviewed, rolling out r82876.
        http://trac.webkit.org/changeset/82876
        https://bugs.webkit.org/show_bug.cgi?id=57816

        Caused a lot of test crashes (Requested by tkent on #webkit).

        * JavaScriptCore.exp:
        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
        * wtf/FastMalloc.cpp:
        (WTF::tryFastMalloc):
        (WTF::fastMalloc):
        (WTF::tryFastCalloc):
        (WTF::fastCalloc):
        (WTF::fastFree):
        (WTF::tryFastRealloc):
        (WTF::fastRealloc):
        (WTF::fastMallocSize):
        (WTF::TCMalloc_PageHeap::isScavengerSuspended):
        (WTF::TCMalloc_PageHeap::scheduleScavenger):
        (WTF::TCMalloc_PageHeap::suspendScavenger):
        (WTF::TCMalloc_PageHeap::signalScavenger):
        (WTF::TCMallocStats::malloc):
        (WTF::TCMallocStats::free):
        (WTF::TCMallocStats::fastCalloc):
        (WTF::TCMallocStats::tryFastCalloc):
        (WTF::TCMallocStats::calloc):
        (WTF::TCMallocStats::fastRealloc):
        (WTF::TCMallocStats::tryFastRealloc):
        (WTF::TCMallocStats::realloc):
        (WTF::TCMallocStats::fastMallocSize):
        * wtf/FastMalloc.h:
        (WTF::Internal::fastMallocMatchValidationType):
        (WTF::Internal::fastMallocMatchValidationValue):
        (WTF::Internal::setFastMallocMatchValidationType):
        (WTF::fastMallocMatchValidateFree):
        * wtf/Platform.h:

git-svn-id: svn://svn.chromium.org/blink/trunk@82905 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 0071135f
2011-04-04 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r82876.
http://trac.webkit.org/changeset/82876
https://bugs.webkit.org/show_bug.cgi?id=57816
Caused a lot of test crashes (Requested by tkent on #webkit).
* JavaScriptCore.exp:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
* wtf/FastMalloc.cpp:
(WTF::tryFastMalloc):
(WTF::fastMalloc):
(WTF::tryFastCalloc):
(WTF::fastCalloc):
(WTF::fastFree):
(WTF::tryFastRealloc):
(WTF::fastRealloc):
(WTF::fastMallocSize):
(WTF::TCMalloc_PageHeap::isScavengerSuspended):
(WTF::TCMalloc_PageHeap::scheduleScavenger):
(WTF::TCMalloc_PageHeap::suspendScavenger):
(WTF::TCMalloc_PageHeap::signalScavenger):
(WTF::TCMallocStats::malloc):
(WTF::TCMallocStats::free):
(WTF::TCMallocStats::fastCalloc):
(WTF::TCMallocStats::tryFastCalloc):
(WTF::TCMallocStats::calloc):
(WTF::TCMallocStats::fastRealloc):
(WTF::TCMallocStats::tryFastRealloc):
(WTF::TCMallocStats::realloc):
(WTF::TCMallocStats::fastMallocSize):
* wtf/FastMalloc.h:
(WTF::Internal::fastMallocMatchValidationType):
(WTF::Internal::fastMallocMatchValidationValue):
(WTF::Internal::setFastMallocMatchValidationType):
(WTF::fastMallocMatchValidateFree):
* wtf/Platform.h:
2011-04-04 Oliver Hunt <oliver@apple.com>
Reviewed by Antti Koivisto.
......
......@@ -492,7 +492,6 @@ __ZN3WTF7xmlAtomE
__ZN3WTF8Collator18setOrderLowerFirstEb
__ZN3WTF8CollatorC1EPKc
__ZN3WTF8CollatorD1Ev
__ZN3WTF8Internal21fastMallocMatchFailedEPv
__ZN3WTF8fastFreeEPv
__ZN3WTF8msToYearEd
__ZN3WTF8nullAtomE
......
......@@ -161,7 +161,6 @@ EXPORTS
?fastCalloc@WTF@@YAPAXII@Z
?fastFree@WTF@@YAXPAX@Z
?fastMalloc@WTF@@YAPAXI@Z
?fastMallocMatchFailed@Internal@WTF@@YAXPAX@Z
?fastMallocSize@WTF@@YAIPBX@Z
?fastRealloc@WTF@@YAPAXPAXI@Z
?fastStrDup@WTF@@YAPADPBD@Z
......
......@@ -103,25 +103,9 @@ namespace WTF {
AllocTypeNew, // Encompasses global operator new.
AllocTypeNewArray // Encompasses global operator new[].
};
enum {
ValidationPrefix = 0xf00df00d,
ValidationSuffix = 0x0badf00d
};
typedef unsigned ValidationTag;
struct ValidationHeader {
AllocType m_type;
unsigned m_size;
ValidationTag m_prefix;
unsigned m_alignment;
};
static const int ValidationBufferSize = sizeof(ValidationHeader) + sizeof(ValidationTag);
}
#if ENABLE(WTF_MALLOC_VALIDATION)
#if ENABLE(FAST_MALLOC_MATCH_VALIDATION)
// Malloc validation is a scheme whereby a tag is attached to an
// allocation which identifies how it was originally allocated.
......@@ -136,36 +120,30 @@ namespace WTF {
// is implemented.
namespace Internal {
// Handle a detected alloc/free mismatch. By default this calls CRASH().
void fastMallocMatchFailed(void* p);
inline ValidationHeader* fastMallocValidationHeader(void* p)
{
return reinterpret_cast<ValidationHeader*>(static_cast<char*>(p) - sizeof(ValidationHeader));
}
inline ValidationTag* fastMallocValidationSuffix(void* p)
// Return the AllocType tag associated with the allocated block p.
inline AllocType fastMallocMatchValidationType(const void* p)
{
ValidationHeader* header = fastMallocValidationHeader(p);
if (header->m_prefix != static_cast<unsigned>(ValidationPrefix))
fastMallocMatchFailed(p);
return reinterpret_cast<ValidationTag*>(static_cast<char*>(p) + header->m_size);
const AllocAlignmentInteger* type = static_cast<const AllocAlignmentInteger*>(p) - 1;
return static_cast<AllocType>(*type);
}
// Return the AllocType tag associated with the allocated block p.
inline AllocType fastMallocMatchValidationType(void* p)
// Return the address of the AllocType tag associated with the allocated block p.
inline AllocAlignmentInteger* fastMallocMatchValidationValue(void* p)
{
return fastMallocValidationHeader(p)->m_type;
return reinterpret_cast<AllocAlignmentInteger*>(static_cast<char*>(p) - sizeof(AllocAlignmentInteger));
}
// Set the AllocType tag to be associaged with the allocated block p.
inline void setFastMallocMatchValidationType(void* p, AllocType allocType)
{
fastMallocValidationHeader(p)->m_type = allocType;
AllocAlignmentInteger* type = static_cast<AllocAlignmentInteger*>(p) - 1;
*type = static_cast<AllocAlignmentInteger>(allocType);
}
// Handle a detected alloc/free mismatch. By default this calls CRASH().
void fastMallocMatchFailed(void* p);
} // namespace Internal
// This is a higher level function which is used by FastMalloc-using code.
......@@ -178,34 +156,16 @@ namespace WTF {
}
// This is a higher level function which is used by FastMalloc-using code.
inline void fastMallocMatchValidateFree(void* p, Internal::AllocType)
inline void fastMallocMatchValidateFree(void* p, Internal::AllocType allocType)
{
if (!p)
return;
Internal::ValidationHeader* header = Internal::fastMallocValidationHeader(p);
if (header->m_prefix != static_cast<unsigned>(Internal::ValidationPrefix))
Internal::fastMallocMatchFailed(p);
if (*Internal::fastMallocValidationSuffix(p) != Internal::ValidationSuffix)
if (Internal::fastMallocMatchValidationType(p) != allocType)
Internal::fastMallocMatchFailed(p);
Internal::setFastMallocMatchValidationType(p, Internal::AllocTypeMalloc); // Set it to this so that fastFree thinks it's OK.
}
inline void fastMallocValidate(void* p)
{
if (!p)
return;
Internal::ValidationHeader* header = Internal::fastMallocValidationHeader(p);
if (header->m_prefix != static_cast<unsigned>(Internal::ValidationPrefix))
Internal::fastMallocMatchFailed(p);
if (*Internal::fastMallocValidationSuffix(p) != Internal::ValidationSuffix)
Internal::fastMallocMatchFailed(p);
}
#else
inline void fastMallocMatchValidateMalloc(void*, Internal::AllocType)
......
......@@ -875,12 +875,8 @@
/* fastMalloc match validation allows for runtime verification that
new is matched by delete, fastMalloc is matched by fastFree, etc. */
#if !defined(ENABLE_WTF_MALLOC_VALIDATION)
#ifndef NDEBUG
#define ENABLE_WTF_MALLOC_VALIDATION 1
#else
#define ENABLE_WTF_MALLOC_VALIDATION 0
#endif
#if !defined(ENABLE_FAST_MALLOC_MATCH_VALIDATION)
#define ENABLE_FAST_MALLOC_MATCH_VALIDATION 0
#endif
#if !defined(ENABLE_ICONDATABASE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment