<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[179221] trunk/Source/WTF</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/179221">179221</a></dd>
<dt>Author</dt> <dd>ggaren@apple.com</dd>
<dt>Date</dt> <dd>2015-01-27 14:41:47 -0800 (Tue, 27 Jan 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Removed WTF_MALLOC_VALIDATION
https://bugs.webkit.org/show_bug.cgi?id=140958
Reviewed by Anders Carlsson.
I don't think anyone has been using this, and the #ifdefs were driving
me crazy.
We have other options for validation -- like MallocGuardEdges,
MallocCheckHeapEach, MallocScribble, and GuardMalloc.
* wtf/FastMalloc.cpp:
(WTF::tryFastMalloc):
(WTF::fastMalloc):
(WTF::tryFastCalloc):
(WTF::fastCalloc):
(WTF::fastFree):
(WTF::tryFastRealloc):
(WTF::fastRealloc):
(WTF::fastMallocSize):
(WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
(WTF::Internal::fastMallocMatchFailed): Deleted.
* wtf/FastMalloc.h:
(WTF::Internal::fastMallocValidationHeader): Deleted.
(WTF::Internal::fastMallocValidationSuffix): Deleted.
(WTF::Internal::fastMallocMatchValidationType): Deleted.
(WTF::Internal::setFastMallocMatchValidationType): Deleted.
(WTF::fastMallocMatchValidateMalloc): Deleted.
(WTF::fastMallocMatchValidateFree): Deleted.
(WTF::fastMallocValidate): Deleted.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfFastMalloccpp">trunk/Source/WTF/wtf/FastMalloc.cpp</a></li>
<li><a href="#trunkSourceWTFwtfFastMalloch">trunk/Source/WTF/wtf/FastMalloc.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (179220 => 179221)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2015-01-27 22:37:27 UTC (rev 179220)
+++ trunk/Source/WTF/ChangeLog        2015-01-27 22:41:47 UTC (rev 179221)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2015-01-27 Geoffrey Garen <ggaren@apple.com>
+
+ Removed WTF_MALLOC_VALIDATION
+ https://bugs.webkit.org/show_bug.cgi?id=140958
+
+ Reviewed by Anders Carlsson.
+
+ I don't think anyone has been using this, and the #ifdefs were driving
+ me crazy.
+
+ We have other options for validation -- like MallocGuardEdges,
+ MallocCheckHeapEach, MallocScribble, and GuardMalloc.
+
+ * wtf/FastMalloc.cpp:
+ (WTF::tryFastMalloc):
+ (WTF::fastMalloc):
+ (WTF::tryFastCalloc):
+ (WTF::fastCalloc):
+ (WTF::fastFree):
+ (WTF::tryFastRealloc):
+ (WTF::fastRealloc):
+ (WTF::fastMallocSize):
+ (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+ (WTF::Internal::fastMallocMatchFailed): Deleted.
+ * wtf/FastMalloc.h:
+ (WTF::Internal::fastMallocValidationHeader): Deleted.
+ (WTF::Internal::fastMallocValidationSuffix): Deleted.
+ (WTF::Internal::fastMallocMatchValidationType): Deleted.
+ (WTF::Internal::setFastMallocMatchValidationType): Deleted.
+ (WTF::fastMallocMatchValidateMalloc): Deleted.
+ (WTF::fastMallocMatchValidateFree): Deleted.
+ (WTF::fastMallocValidate): Deleted.
+
</ins><span class="cx"> 2015-01-27 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r179192.
</span></span></pre></div>
<a id="trunkSourceWTFwtfFastMalloccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/FastMalloc.cpp (179220 => 179221)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/FastMalloc.cpp        2015-01-27 22:37:27 UTC (rev 179220)
+++ trunk/Source/WTF/wtf/FastMalloc.cpp        2015-01-27 22:41:47 UTC (rev 179221)
</span><span class="lines">@@ -185,22 +185,6 @@
</span><span class="cx">
</span><span class="cx"> namespace WTF {
</span><span class="cx">
</span><del>-
-namespace Internal {
-#if !ENABLE(WTF_MALLOC_VALIDATION)
-WTF_EXPORT_PRIVATE NO_RETURN_DUE_TO_CRASH void fastMallocMatchFailed(void*);
-#else
-COMPILE_ASSERT(((sizeof(ValidationHeader) % sizeof(AllocAlignmentInteger)) == 0), ValidationHeader_must_produce_correct_alignment);
-#endif
-
-NO_RETURN_DUE_TO_CRASH void fastMallocMatchFailed(void*)
-{
- CRASH();
-}
-
-} // namespace Internal
-
-
</del><span class="cx"> void* fastZeroedMalloc(size_t n)
</span><span class="cx"> {
</span><span class="cx"> void* result = fastMalloc(n);
</span><span class="lines">@@ -248,39 +232,14 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!isForbidden());
</span><span class="cx">
</span><del>-#if ENABLE(WTF_MALLOC_VALIDATION)
- if (std::numeric_limits<size_t>::max() - Internal::ValidationBufferSize <= n) // If overflow would occur...
- return 0;
-
- void* result = malloc(n + Internal::ValidationBufferSize);
- if (!result)
- return 0;
- Internal::ValidationHeader* header = static_cast<Internal::ValidationHeader*>(result);
- header->m_size = n;
- header->m_type = Internal::AllocTypeMalloc;
- header->m_prefix = static_cast<unsigned>(Internal::ValidationPrefix);
- result = header + 1;
- *Internal::fastMallocValidationSuffix(result) = Internal::ValidationSuffix;
- fastMallocValidate(result);
- return result;
-#else
</del><span class="cx"> return malloc(n);
</span><del>-#endif
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void* fastMalloc(size_t n)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!isForbidden());
</span><span class="cx">
</span><del>-#if ENABLE(WTF_MALLOC_VALIDATION)
- TryMallocReturnValue returnValue = tryFastMalloc(n);
- void* result;
- if (!returnValue.getValue(result))
- CRASH();
-#else
</del><span class="cx"> void* result = malloc(n);
</span><del>-#endif
-
</del><span class="cx"> if (!result)
</span><span class="cx"> CRASH();
</span><span class="cx">
</span><span class="lines">@@ -290,37 +249,14 @@
</span><span class="cx"> TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!isForbidden());
</span><del>-
-#if ENABLE(WTF_MALLOC_VALIDATION)
- size_t totalBytes = n_elements * element_size;
- if (n_elements > 1 && element_size && (totalBytes / element_size) != n_elements)
- return 0;
-
- TryMallocReturnValue returnValue = tryFastMalloc(totalBytes);
- void* result;
- if (!returnValue.getValue(result))
- return 0;
- memset(result, 0, totalBytes);
- fastMallocValidate(result);
- return result;
-#else
</del><span class="cx"> return calloc(n_elements, element_size);
</span><del>-#endif
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void* fastCalloc(size_t n_elements, size_t element_size)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!isForbidden());
</span><span class="cx">
</span><del>-#if ENABLE(WTF_MALLOC_VALIDATION)
- TryMallocReturnValue returnValue = tryFastCalloc(n_elements, element_size);
- void* result;
- if (!returnValue.getValue(result))
- CRASH();
-#else
</del><span class="cx"> void* result = calloc(n_elements, element_size);
</span><del>-#endif
-
</del><span class="cx"> if (!result)
</span><span class="cx"> CRASH();
</span><span class="cx">
</span><span class="lines">@@ -330,58 +266,19 @@
</span><span class="cx"> void fastFree(void* p)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!isForbidden());
</span><del>-
-#if ENABLE(WTF_MALLOC_VALIDATION)
- if (!p)
- return;
-
- fastMallocMatchValidateFree(p, Internal::AllocTypeMalloc);
- Internal::ValidationHeader* header = Internal::fastMallocValidationHeader(p);
- memset(p, 0xCC, header->m_size);
- free(header);
-#else
</del><span class="cx"> free(p);
</span><del>-#endif
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TryMallocReturnValue tryFastRealloc(void* p, size_t n)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!isForbidden());
</span><del>-
-#if ENABLE(WTF_MALLOC_VALIDATION)
- if (p) {
- if (std::numeric_limits<size_t>::max() - Internal::ValidationBufferSize <= n) // If overflow would occur...
- return 0;
- fastMallocValidate(p);
- Internal::ValidationHeader* result = static_cast<Internal::ValidationHeader*>(realloc(Internal::fastMallocValidationHeader(p), n + Internal::ValidationBufferSize));
- if (!result)
- return 0;
- result->m_size = n;
- result = result + 1;
- *fastMallocValidationSuffix(result) = Internal::ValidationSuffix;
- fastMallocValidate(result);
- return result;
- } else {
- return fastMalloc(n);
- }
-#else
</del><span class="cx"> return realloc(p, n);
</span><del>-#endif
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void* fastRealloc(void* p, size_t n)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!isForbidden());
</span><del>-
-#if ENABLE(WTF_MALLOC_VALIDATION)
- TryMallocReturnValue returnValue = tryFastRealloc(p, n);
- void* result;
- if (!returnValue.getValue(result))
- CRASH();
-#else
</del><span class="cx"> void* result = realloc(p, n);
</span><del>-#endif
-
</del><span class="cx"> if (!result)
</span><span class="cx"> CRASH();
</span><span class="cx"> return result;
</span><span class="lines">@@ -397,9 +294,7 @@
</span><span class="cx">
</span><span class="cx"> size_t fastMallocSize(const void* p)
</span><span class="cx"> {
</span><del>-#if ENABLE(WTF_MALLOC_VALIDATION)
- return Internal::fastMallocValidationHeader(const_cast<void*>(p))->m_size;
-#elif OS(DARWIN)
</del><ins>+#if OS(DARWIN)
</ins><span class="cx"> return malloc_size(p);
</span><span class="cx"> #elif OS(WINDOWS)
</span><span class="cx"> return _msize(const_cast<void*>(p));
</span><span class="lines">@@ -4356,24 +4251,7 @@
</span><span class="cx"> ALWAYS_INLINE
</span><span class="cx"> #endif
</span><span class="cx"> void* malloc(size_t size) {
</span><del>-#if ENABLE(WTF_MALLOC_VALIDATION)
- if (std::numeric_limits<size_t>::max() - Internal::ValidationBufferSize <= size) // If overflow would occur...
- return 0;
- void* result = do_malloc(size + Internal::ValidationBufferSize);
- if (!result)
- return 0;
-
- Internal::ValidationHeader* header = static_cast<Internal::ValidationHeader*>(result);
- header->m_size = size;
- header->m_type = Internal::AllocTypeMalloc;
- header->m_prefix = static_cast<unsigned>(Internal::ValidationPrefix);
- result = header + 1;
- *Internal::fastMallocValidationSuffix(result) = Internal::ValidationSuffix;
- fastMallocValidate(result);
-#else
- void* result = do_malloc(size);
-#endif
-
</del><ins>+ void* result = do_malloc(size);
</ins><span class="cx"> MallocHook::InvokeNewHook(result, size);
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="lines">@@ -4387,18 +4265,7 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> MallocHook::InvokeDeleteHook(ptr);
</span><del>-
-#if ENABLE(WTF_MALLOC_VALIDATION)
- if (!ptr)
- return;
-
- fastMallocValidate(ptr);
- Internal::ValidationHeader* header = Internal::fastMallocValidationHeader(ptr);
- memset(ptr, 0xCC, header->m_size);
- do_free(header);
-#else
- do_free(ptr);
-#endif
</del><ins>+ do_free(ptr);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #ifndef WTF_CHANGES
</span><span class="lines">@@ -4410,9 +4277,6 @@
</span><span class="cx"> void* fastCalloc(size_t n, size_t elem_size)
</span><span class="cx"> {
</span><span class="cx"> void* result = calloc<true>(n, elem_size);
</span><del>-#if ENABLE(WTF_MALLOC_VALIDATION)
- fastMallocValidate(result);
-#endif
</del><span class="cx"> #if ENABLE(ALLOCATION_LOGGING)
</span><span class="cx"> dataLogF("fastMalloc contiguously allocating %lu * %lu bytes (fastCalloc): %p.\n", n, elem_size, result);
</span><span class="cx"> #endif
</span><span class="lines">@@ -4422,9 +4286,6 @@
</span><span class="cx"> TryMallocReturnValue tryFastCalloc(size_t n, size_t elem_size)
</span><span class="cx"> {
</span><span class="cx"> void* result = calloc<false>(n, elem_size);
</span><del>-#if ENABLE(WTF_MALLOC_VALIDATION)
- fastMallocValidate(result);
-#endif
</del><span class="cx"> #if ENABLE(ALLOCATION_LOGGING)
</span><span class="cx"> dataLogF("fastMalloc contiguously allocating %lu * %lu bytes (tryFastCalloc): %p.\n", n, elem_size, result);
</span><span class="cx"> #endif
</span><span class="lines">@@ -4441,19 +4302,10 @@
</span><span class="cx"> if (n > 1 && elem_size && (totalBytes / elem_size) != n)
</span><span class="cx"> return 0;
</span><span class="cx">
</span><del>-#if ENABLE(WTF_MALLOC_VALIDATION)
- void* result = malloc<crashOnFailure>(totalBytes);
- if (!result)
- return 0;
-
- memset(result, 0, totalBytes);
- fastMallocValidate(result);
-#else
</del><span class="cx"> void* result = do_malloc(totalBytes);
</span><span class="cx"> if (result != NULL) {
</span><span class="cx"> memset(result, 0, totalBytes);
</span><span class="cx"> }
</span><del>-#endif
</del><span class="cx">
</span><span class="cx"> MallocHook::InvokeNewHook(result, totalBytes);
</span><span class="cx"> return result;
</span><span class="lines">@@ -4480,13 +4332,7 @@
</span><span class="cx">
</span><span class="cx"> void* fastRealloc(void* old_ptr, size_t new_size)
</span><span class="cx"> {
</span><del>-#if ENABLE(WTF_MALLOC_VALIDATION)
- fastMallocValidate(old_ptr);
-#endif
</del><span class="cx"> void* result = realloc<true>(old_ptr, new_size);
</span><del>-#if ENABLE(WTF_MALLOC_VALIDATION)
- fastMallocValidate(result);
-#endif
</del><span class="cx"> #if ENABLE(ALLOCATION_LOGGING)
</span><span class="cx"> dataLogF("fastMalloc reallocating %lu bytes (fastRealloc): %p -> %p.\n", new_size, old_ptr, result);
</span><span class="cx"> #endif
</span><span class="lines">@@ -4495,13 +4341,7 @@
</span><span class="cx">
</span><span class="cx"> TryMallocReturnValue tryFastRealloc(void* old_ptr, size_t new_size)
</span><span class="cx"> {
</span><del>-#if ENABLE(WTF_MALLOC_VALIDATION)
- fastMallocValidate(old_ptr);
-#endif
</del><span class="cx"> void* result = realloc<false>(old_ptr, new_size);
</span><del>-#if ENABLE(WTF_MALLOC_VALIDATION)
- fastMallocValidate(result);
-#endif
</del><span class="cx"> #if ENABLE(ALLOCATION_LOGGING)
</span><span class="cx"> dataLogF("fastMalloc reallocating %lu bytes (tryFastRealloc): %p -> %p.\n", new_size, old_ptr, result);
</span><span class="cx"> #endif
</span><span class="lines">@@ -4513,12 +4353,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> void* realloc(void* old_ptr, size_t new_size) {
</span><span class="cx"> if (old_ptr == NULL) {
</span><del>-#if ENABLE(WTF_MALLOC_VALIDATION)
- void* result = malloc<crashOnFailure>(new_size);
-#else
</del><span class="cx"> void* result = do_malloc(new_size);
</span><span class="cx"> MallocHook::InvokeNewHook(result, new_size);
</span><del>-#endif
</del><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx"> if (new_size == 0) {
</span><span class="lines">@@ -4527,16 +4363,6 @@
</span><span class="cx"> return NULL;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if ENABLE(WTF_MALLOC_VALIDATION)
- if (std::numeric_limits<size_t>::max() - Internal::ValidationBufferSize <= new_size) // If overflow would occur...
- return 0;
- Internal::ValidationHeader* header = Internal::fastMallocValidationHeader(old_ptr);
- fastMallocValidate(old_ptr);
- old_ptr = header;
- header->m_size = new_size;
- new_size += Internal::ValidationBufferSize;
-#endif
-
</del><span class="cx"> ASSERT(pageheap != NULL); // Should not call realloc() before malloc()
</span><span class="cx"> ASSERT(kPageShift && kNumClasses && kPageSize);
</span><span class="cx">
</span><span class="lines">@@ -4572,16 +4398,8 @@
</span><span class="cx"> // that we already know the sizeclass of old_ptr. The benefit
</span><span class="cx"> // would be small, so don't bother.
</span><span class="cx"> do_free(old_ptr);
</span><del>-#if ENABLE(WTF_MALLOC_VALIDATION)
- new_ptr = static_cast<Internal::ValidationHeader*>(new_ptr) + 1;
- *Internal::fastMallocValidationSuffix(new_ptr) = Internal::ValidationSuffix;
-#endif
</del><span class="cx"> return new_ptr;
</span><span class="cx"> } else {
</span><del>-#if ENABLE(WTF_MALLOC_VALIDATION)
- old_ptr = static_cast<Internal::ValidationHeader*>(old_ptr) + 1; // Set old_ptr back to the user pointer.
- *Internal::fastMallocValidationSuffix(old_ptr) = Internal::ValidationSuffix;
-#endif
</del><span class="cx"> return old_ptr;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -4780,12 +4598,9 @@
</span><span class="cx">
</span><span class="cx"> size_t fastMallocSize(const void* ptr)
</span><span class="cx"> {
</span><del>- if (pageheap == NULL) TCMalloc_ThreadCache::InitModule();
- ASSERT(kPageShift && kNumClasses && kPageSize);
</del><ins>+ if (pageheap == NULL) TCMalloc_ThreadCache::InitModule();
+ ASSERT(kPageShift && kNumClasses && kPageSize);
</ins><span class="cx">
</span><del>-#if ENABLE(WTF_MALLOC_VALIDATION)
- return Internal::fastMallocValidationHeader(const_cast<void*>(ptr))->m_size;
-#else
</del><span class="cx"> const PageID p = reinterpret_cast<uintptr_t>(ptr) >> kPageShift;
</span><span class="cx"> Span* span = pageheap->GetDescriptorEnsureSafe(p);
</span><span class="cx">
</span><span class="lines">@@ -4801,7 +4616,6 @@
</span><span class="cx"> return ByteSizeForClass(cl);
</span><span class="cx">
</span><span class="cx"> return span->length << kPageShift;
</span><del>-#endif
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if OS(DARWIN)
</span></span></pre></div>
<a id="trunkSourceWTFwtfFastMalloch"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/FastMalloc.h (179220 => 179221)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/FastMalloc.h        2015-01-27 22:37:27 UTC (rev 179220)
+++ trunk/Source/WTF/wtf/FastMalloc.h        2015-01-27 22:41:47 UTC (rev 179221)
</span><span class="lines">@@ -94,129 +94,6 @@
</span><span class="cx"> // size as the minimally aligned memory allocation.
</span><span class="cx"> typedef unsigned long long AllocAlignmentInteger;
</span><span class="cx">
</span><del>- namespace Internal {
- enum AllocType { // Start with an unusual number instead of zero, because zero is common.
- AllocTypeMalloc = 0x375d6750, // Encompasses fastMalloc, fastZeroedMalloc, fastCalloc, fastRealloc.
- AllocTypeClassNew, // Encompasses class operator new from FastAllocBase.
- AllocTypeClassNewArray, // Encompasses class operator new[] from FastAllocBase.
- 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)
-
- // Malloc validation is a scheme whereby a tag is attached to an
- // allocation which identifies how it was originally allocated.
- // This allows us to verify that the freeing operation matches the
- // allocation operation. If memory is allocated with operator new[]
- // but freed with free or delete, this system would detect that.
- // In the implementation here, the tag is an integer prepended to
- // the allocation memory which is assigned one of the AllocType
- // enumeration values. An alternative implementation of this
- // scheme could store the tag somewhere else or ignore it.
- // Users of FastMalloc don't need to know or care how this tagging
- // 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)
- {
- 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);
- }
-
- // Return the AllocType tag associated with the allocated block p.
- inline AllocType fastMallocMatchValidationType(void* p)
- {
- return fastMallocValidationHeader(p)->m_type;
- }
-
- // Set the AllocType tag to be associaged with the allocated block p.
- inline void setFastMallocMatchValidationType(void* p, AllocType allocType)
- {
- fastMallocValidationHeader(p)->m_type = allocType;
- }
-
- } // namespace Internal
-
- // This is a higher level function which is used by FastMalloc-using code.
- inline void fastMallocMatchValidateMalloc(void* p, Internal::AllocType allocType)
- {
- if (!p)
- return;
-
- Internal::setFastMallocMatchValidationType(p, allocType);
- }
-
- // This is a higher level function which is used by FastMalloc-using code.
- inline void fastMallocMatchValidateFree(void* p, Internal::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)
- 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)
- {
- }
-
- inline void fastMallocMatchValidateFree(void*, Internal::AllocType)
- {
- }
-
-#endif
-
</del><span class="cx"> } // namespace WTF
</span><span class="cx">
</span><span class="cx"> using WTF::fastCalloc;
</span><span class="lines">@@ -254,27 +131,21 @@
</span><span class="cx"> \
</span><span class="cx"> void* operator new(size_t size) \
</span><span class="cx"> { \
</span><del>- void* p = ::WTF::fastMalloc(size); \
- ::WTF::fastMallocMatchValidateMalloc(p, ::WTF::Internal::AllocTypeClassNew); \
- return p; \
</del><ins>+ return ::WTF::fastMalloc(size); \
</ins><span class="cx"> } \
</span><span class="cx"> \
</span><span class="cx"> void operator delete(void* p) \
</span><span class="cx"> { \
</span><del>- ::WTF::fastMallocMatchValidateFree(p, ::WTF::Internal::AllocTypeClassNew); \
</del><span class="cx"> ::WTF::fastFree(p); \
</span><span class="cx"> } \
</span><span class="cx"> \
</span><span class="cx"> void* operator new[](size_t size) \
</span><span class="cx"> { \
</span><del>- void* p = ::WTF::fastMalloc(size); \
- ::WTF::fastMallocMatchValidateMalloc(p, ::WTF::Internal::AllocTypeClassNewArray); \
- return p; \
</del><ins>+ return ::WTF::fastMalloc(size); \
</ins><span class="cx"> } \
</span><span class="cx"> \
</span><span class="cx"> void operator delete[](void* p) \
</span><span class="cx"> { \
</span><del>- ::WTF::fastMallocMatchValidateFree(p, ::WTF::Internal::AllocTypeClassNewArray); \
</del><span class="cx"> ::WTF::fastFree(p); \
</span><span class="cx"> } \
</span><span class="cx"> void* operator new(size_t, NotNullTag, void* location) \
</span></span></pre>
</div>
</div>
</body>
</html>