<!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>[242419] releases/WebKitGTK/webkit-2.24/Source/bmalloc</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/242419">242419</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2019-03-05 00:43:25 -0800 (Tue, 05 Mar 2019)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/241832">r241832</a> - [bmalloc] bmalloc::Cache should not be instantiated if we are using system malloc
https://bugs.webkit.org/show_bug.cgi?id=194811
Reviewed by Mark Lam.
bmalloc::Cache is very large. It is 13KB. Since it exists per HeapKind, it takes 40KB.
But this is meaningless if we are under the system malloc mode by using "Malloc=1". We
found that it continues using so much dirty memory region even under the system malloc mode.
This patch avoids instantiation of bmalloc::Cache under the system malloc mode.
* bmalloc/Allocator.cpp:
(bmalloc::Allocator::Allocator):
(bmalloc::Allocator::tryAllocate):
(bmalloc::Allocator::allocateImpl):
(bmalloc::Allocator::reallocateImpl):
(bmalloc::Allocator::allocateSlowCase):
Allocator is a per Cache object. So we no longer need to keep m_debugHeap. If debug heap is enabled,
Allocator is never created.
* bmalloc/Allocator.h:
* bmalloc/Cache.cpp:
(bmalloc::debugHeap):
(bmalloc::Cache::Cache):
(bmalloc::Cache::tryAllocateSlowCaseNullCache):
(bmalloc::Cache::allocateSlowCaseNullCache):
(bmalloc::Cache::deallocateSlowCaseNullCache):
(bmalloc::Cache::tryReallocateSlowCaseNullCache):
(bmalloc::Cache::reallocateSlowCaseNullCache):
* bmalloc/Cache.h:
(bmalloc::Cache::tryAllocate):
(bmalloc::Cache::tryReallocate):
If the debug heap mode is enabled, we keep Cache::getFast() returning nullptr. And in the slow path case, we use debugHeap.
This makes bmalloc fast path fast, while we avoid Cache instantiation.
* bmalloc/Deallocator.cpp:
(bmalloc::Deallocator::Deallocator):
(bmalloc::Deallocator::scavenge):
(bmalloc::Deallocator::deallocateSlowCase):
* bmalloc/Deallocator.h:
Ditto for Deallocator.
* bmalloc/bmalloc.cpp:
(bmalloc::api::isEnabled):
We used `getFastCase()` for Heap. But it is basically wrong since we do not have any guarantee that someone already initializes
Heap when this is called. Previously, luckily, Cache is initialized, and Cache initialized Heap. But Cache initialization is removed
for system malloc mode and now PerProcess<PerHeapKind<Heap>>::getFastCase() returns nullptr at an early phase. This patch just uses
Environment::isDebugHeapEnabled() instead.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit224SourcebmallocChangeLog">releases/WebKitGTK/webkit-2.24/Source/bmalloc/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourcebmallocbmallocAllocatorcpp">releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Allocator.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourcebmallocbmallocAllocatorh">releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Allocator.h</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourcebmallocbmallocCachecpp">releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Cache.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourcebmallocbmallocCacheh">releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Cache.h</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourcebmallocbmallocDeallocatorcpp">releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Deallocator.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit224SourcebmallocbmallocDeallocatorh">releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Deallocator.h</a></li>
<li><a href="#releasesWebKitGTKwebkit224Sourcebmallocbmallocbmalloccpp">releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/bmalloc.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit224SourcebmallocChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/bmalloc/ChangeLog (242418 => 242419)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/bmalloc/ChangeLog 2019-03-05 08:43:20 UTC (rev 242418)
+++ releases/WebKitGTK/webkit-2.24/Source/bmalloc/ChangeLog 2019-03-05 08:43:25 UTC (rev 242419)
</span><span class="lines">@@ -1,3 +1,53 @@
</span><ins>+2019-02-20 Yusuke Suzuki <ysuzuki@apple.com>
+
+ [bmalloc] bmalloc::Cache should not be instantiated if we are using system malloc
+ https://bugs.webkit.org/show_bug.cgi?id=194811
+
+ Reviewed by Mark Lam.
+
+ bmalloc::Cache is very large. It is 13KB. Since it exists per HeapKind, it takes 40KB.
+ But this is meaningless if we are under the system malloc mode by using "Malloc=1". We
+ found that it continues using so much dirty memory region even under the system malloc mode.
+ This patch avoids instantiation of bmalloc::Cache under the system malloc mode.
+
+ * bmalloc/Allocator.cpp:
+ (bmalloc::Allocator::Allocator):
+ (bmalloc::Allocator::tryAllocate):
+ (bmalloc::Allocator::allocateImpl):
+ (bmalloc::Allocator::reallocateImpl):
+ (bmalloc::Allocator::allocateSlowCase):
+ Allocator is a per Cache object. So we no longer need to keep m_debugHeap. If debug heap is enabled,
+ Allocator is never created.
+
+ * bmalloc/Allocator.h:
+ * bmalloc/Cache.cpp:
+ (bmalloc::debugHeap):
+ (bmalloc::Cache::Cache):
+ (bmalloc::Cache::tryAllocateSlowCaseNullCache):
+ (bmalloc::Cache::allocateSlowCaseNullCache):
+ (bmalloc::Cache::deallocateSlowCaseNullCache):
+ (bmalloc::Cache::tryReallocateSlowCaseNullCache):
+ (bmalloc::Cache::reallocateSlowCaseNullCache):
+ * bmalloc/Cache.h:
+ (bmalloc::Cache::tryAllocate):
+ (bmalloc::Cache::tryReallocate):
+ If the debug heap mode is enabled, we keep Cache::getFast() returning nullptr. And in the slow path case, we use debugHeap.
+ This makes bmalloc fast path fast, while we avoid Cache instantiation.
+
+ * bmalloc/Deallocator.cpp:
+ (bmalloc::Deallocator::Deallocator):
+ (bmalloc::Deallocator::scavenge):
+ (bmalloc::Deallocator::deallocateSlowCase):
+ * bmalloc/Deallocator.h:
+ Ditto for Deallocator.
+
+ * bmalloc/bmalloc.cpp:
+ (bmalloc::api::isEnabled):
+ We used `getFastCase()` for Heap. But it is basically wrong since we do not have any guarantee that someone already initializes
+ Heap when this is called. Previously, luckily, Cache is initialized, and Cache initialized Heap. But Cache initialization is removed
+ for system malloc mode and now PerProcess<PerHeapKind<Heap>>::getFastCase() returns nullptr at an early phase. This patch just uses
+ Environment::isDebugHeapEnabled() instead.
+
</ins><span class="cx"> 2019-02-20 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r241789.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourcebmallocbmallocAllocatorcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Allocator.cpp (242418 => 242419)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Allocator.cpp 2019-03-05 08:43:20 UTC (rev 242418)
+++ releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Allocator.cpp 2019-03-05 08:43:25 UTC (rev 242419)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx"> #include "BAssert.h"
</span><span class="cx"> #include "Chunk.h"
</span><span class="cx"> #include "Deallocator.h"
</span><del>-#include "DebugHeap.h"
</del><ins>+#include "Environment.h"
</ins><span class="cx"> #include "Heap.h"
</span><span class="cx"> #include "PerProcess.h"
</span><span class="cx"> #include "Sizes.h"
</span><span class="lines">@@ -38,9 +38,9 @@
</span><span class="cx">
</span><span class="cx"> Allocator::Allocator(Heap& heap, Deallocator& deallocator)
</span><span class="cx"> : m_heap(heap)
</span><del>- , m_debugHeap(heap.debugHeap())
</del><span class="cx"> , m_deallocator(deallocator)
</span><span class="cx"> {
</span><ins>+ BASSERT(!PerProcess<Environment>::get()->isDebugHeapEnabled());
</ins><span class="cx"> for (size_t sizeClass = 0; sizeClass < sizeClassCount; ++sizeClass)
</span><span class="cx"> m_bumpAllocators[sizeClass].init(objectSize(sizeClass));
</span><span class="cx"> }
</span><span class="lines">@@ -52,9 +52,6 @@
</span><span class="cx">
</span><span class="cx"> void* Allocator::tryAllocate(size_t size)
</span><span class="cx"> {
</span><del>- if (m_debugHeap)
- return m_debugHeap->malloc(size);
-
</del><span class="cx"> if (size <= smallMax)
</span><span class="cx"> return allocate(size);
</span><span class="cx">
</span><span class="lines">@@ -78,9 +75,6 @@
</span><span class="cx"> {
</span><span class="cx"> BASSERT(isPowerOfTwo(alignment));
</span><span class="cx">
</span><del>- if (m_debugHeap)
- return m_debugHeap->memalign(alignment, size, crashOnFailure);
-
</del><span class="cx"> if (!size)
</span><span class="cx"> size = alignment;
</span><span class="cx">
</span><span class="lines">@@ -107,9 +101,6 @@
</span><span class="cx">
</span><span class="cx"> void* Allocator::reallocateImpl(void* object, size_t newSize, bool crashOnFailure)
</span><span class="cx"> {
</span><del>- if (m_debugHeap)
- return m_debugHeap->realloc(object, newSize, crashOnFailure);
-
</del><span class="cx"> size_t oldSize = 0;
</span><span class="cx"> switch (objectType(m_heap.kind(), object)) {
</span><span class="cx"> case ObjectType::Small: {
</span><span class="lines">@@ -200,9 +191,6 @@
</span><span class="cx">
</span><span class="cx"> void* Allocator::allocateSlowCase(size_t size)
</span><span class="cx"> {
</span><del>- if (m_debugHeap)
- return m_debugHeap->malloc(size);
-
</del><span class="cx"> if (size <= maskSizeClassMax) {
</span><span class="cx"> size_t sizeClass = bmalloc::maskSizeClass(size);
</span><span class="cx"> BumpAllocator& allocator = m_bumpAllocators[sizeClass];
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourcebmallocbmallocAllocatorh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Allocator.h (242418 => 242419)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Allocator.h 2019-03-05 08:43:20 UTC (rev 242418)
+++ releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Allocator.h 2019-03-05 08:43:25 UTC (rev 242419)
</span><span class="lines">@@ -33,7 +33,6 @@
</span><span class="cx"> namespace bmalloc {
</span><span class="cx">
</span><span class="cx"> class Deallocator;
</span><del>-class DebugHeap;
</del><span class="cx"> class Heap;
</span><span class="cx">
</span><span class="cx"> // Per-cache object allocator.
</span><span class="lines">@@ -69,7 +68,6 @@
</span><span class="cx"> std::array<BumpRangeCache, sizeClassCount> m_bumpRangeCaches;
</span><span class="cx">
</span><span class="cx"> Heap& m_heap;
</span><del>- DebugHeap* m_debugHeap;
</del><span class="cx"> Deallocator& m_deallocator;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourcebmallocbmallocCachecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Cache.cpp (242418 => 242419)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Cache.cpp 2019-03-05 08:43:20 UTC (rev 242418)
+++ releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Cache.cpp 2019-03-05 08:43:25 UTC (rev 242419)
</span><span class="lines">@@ -25,11 +25,15 @@
</span><span class="cx">
</span><span class="cx"> #include "BInline.h"
</span><span class="cx"> #include "Cache.h"
</span><ins>+#include "DebugHeap.h"
+#include "Environment.h"
</ins><span class="cx"> #include "Heap.h"
</span><span class="cx"> #include "PerProcess.h"
</span><span class="cx">
</span><span class="cx"> namespace bmalloc {
</span><span class="cx">
</span><ins>+static DebugHeap* debugHeapCache { nullptr };
+
</ins><span class="cx"> void Cache::scavenge(HeapKind heapKind)
</span><span class="cx"> {
</span><span class="cx"> PerHeapKind<Cache>* caches = PerThread<PerHeapKind<Cache>>::getFastCase();
</span><span class="lines">@@ -42,34 +46,82 @@
</span><span class="cx"> caches->at(heapKind).deallocator().scavenge();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static BINLINE DebugHeap* debugHeap()
+{
+ if (debugHeapCache)
+ return debugHeapCache;
+ if (PerProcess<Environment>::get()->isDebugHeapEnabled()) {
+ debugHeapCache = PerProcess<DebugHeap>::get();
+ return debugHeapCache;
+ }
+ return nullptr;
+}
+
</ins><span class="cx"> Cache::Cache(HeapKind heapKind)
</span><span class="cx"> : m_deallocator(PerProcess<PerHeapKind<Heap>>::get()->at(heapKind))
</span><span class="cx"> , m_allocator(PerProcess<PerHeapKind<Heap>>::get()->at(heapKind), m_deallocator)
</span><span class="cx"> {
</span><ins>+ BASSERT(!PerProcess<Environment>::get()->isDebugHeapEnabled());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> BNO_INLINE void* Cache::tryAllocateSlowCaseNullCache(HeapKind heapKind, size_t size)
</span><span class="cx"> {
</span><ins>+ // FIXME: DebugHeap does not have tryAllocate feature.
+ // https://bugs.webkit.org/show_bug.cgi?id=194837
+ if (auto* heap = debugHeap())
+ return heap->malloc(size);
</ins><span class="cx"> return PerThread<PerHeapKind<Cache>>::getSlowCase()->at(mapToActiveHeapKind(heapKind)).allocator().tryAllocate(size);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> BNO_INLINE void* Cache::allocateSlowCaseNullCache(HeapKind heapKind, size_t size)
</span><span class="cx"> {
</span><ins>+ if (auto* heap = debugHeap())
+ return heap->malloc(size);
</ins><span class="cx"> return PerThread<PerHeapKind<Cache>>::getSlowCase()->at(mapToActiveHeapKind(heapKind)).allocator().allocate(size);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+BNO_INLINE void* Cache::tryAllocateSlowCaseNullCache(HeapKind heapKind, size_t alignment, size_t size)
+{
+ if (auto* heap = debugHeap()) {
+ constexpr bool crashOnFailure = false;
+ return heap->memalign(alignment, size, crashOnFailure);
+ }
+ return PerThread<PerHeapKind<Cache>>::getSlowCase()->at(mapToActiveHeapKind(heapKind)).allocator().tryAllocate(alignment, size);
+}
+
</ins><span class="cx"> BNO_INLINE void* Cache::allocateSlowCaseNullCache(HeapKind heapKind, size_t alignment, size_t size)
</span><span class="cx"> {
</span><ins>+ if (auto* heap = debugHeap()) {
+ constexpr bool crashOnFailure = true;
+ return heap->memalign(alignment, size, crashOnFailure);
+ }
</ins><span class="cx"> return PerThread<PerHeapKind<Cache>>::getSlowCase()->at(mapToActiveHeapKind(heapKind)).allocator().allocate(alignment, size);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> BNO_INLINE void Cache::deallocateSlowCaseNullCache(HeapKind heapKind, void* object)
</span><span class="cx"> {
</span><ins>+ if (auto* heap = debugHeap()) {
+ heap->free(object);
+ return;
+ }
</ins><span class="cx"> PerThread<PerHeapKind<Cache>>::getSlowCase()->at(mapToActiveHeapKind(heapKind)).deallocator().deallocate(object);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+BNO_INLINE void* Cache::tryReallocateSlowCaseNullCache(HeapKind heapKind, void* object, size_t newSize)
+{
+ if (auto* heap = debugHeap()) {
+ constexpr bool crashOnFailure = false;
+ return heap->realloc(object, newSize, crashOnFailure);
+ }
+ return PerThread<PerHeapKind<Cache>>::getSlowCase()->at(mapToActiveHeapKind(heapKind)).allocator().tryReallocate(object, newSize);
+}
+
</ins><span class="cx"> BNO_INLINE void* Cache::reallocateSlowCaseNullCache(HeapKind heapKind, void* object, size_t newSize)
</span><span class="cx"> {
</span><ins>+ if (auto* heap = debugHeap()) {
+ constexpr bool crashOnFailure = true;
+ return heap->realloc(object, newSize, crashOnFailure);
+ }
</ins><span class="cx"> return PerThread<PerHeapKind<Cache>>::getSlowCase()->at(mapToActiveHeapKind(heapKind)).allocator().reallocate(object, newSize);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourcebmallocbmallocCacheh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Cache.h (242418 => 242419)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Cache.h 2019-03-05 08:43:20 UTC (rev 242418)
+++ releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Cache.h 2019-03-05 08:43:25 UTC (rev 242419)
</span><span class="lines">@@ -56,8 +56,10 @@
</span><span class="cx"> private:
</span><span class="cx"> BEXPORT static void* tryAllocateSlowCaseNullCache(HeapKind, size_t);
</span><span class="cx"> BEXPORT static void* allocateSlowCaseNullCache(HeapKind, size_t);
</span><ins>+ BEXPORT static void* tryAllocateSlowCaseNullCache(HeapKind, size_t alignment, size_t);
</ins><span class="cx"> BEXPORT static void* allocateSlowCaseNullCache(HeapKind, size_t alignment, size_t);
</span><span class="cx"> BEXPORT static void deallocateSlowCaseNullCache(HeapKind, void*);
</span><ins>+ BEXPORT static void* tryReallocateSlowCaseNullCache(HeapKind, void*, size_t);
</ins><span class="cx"> BEXPORT static void* reallocateSlowCaseNullCache(HeapKind, void*, size_t);
</span><span class="cx">
</span><span class="cx"> Deallocator m_deallocator;
</span><span class="lines">@@ -84,7 +86,7 @@
</span><span class="cx"> {
</span><span class="cx"> PerHeapKind<Cache>* caches = PerThread<PerHeapKind<Cache>>::getFastCase();
</span><span class="cx"> if (!caches)
</span><del>- return allocateSlowCaseNullCache(heapKind, alignment, size);
</del><ins>+ return tryAllocateSlowCaseNullCache(heapKind, alignment, size);
</ins><span class="cx"> return caches->at(mapToActiveHeapKindAfterEnsuringGigacage(heapKind)).allocator().tryAllocate(alignment, size);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -108,7 +110,7 @@
</span><span class="cx"> {
</span><span class="cx"> PerHeapKind<Cache>* caches = PerThread<PerHeapKind<Cache>>::getFastCase();
</span><span class="cx"> if (!caches)
</span><del>- return reallocateSlowCaseNullCache(heapKind, object, newSize);
</del><ins>+ return tryReallocateSlowCaseNullCache(heapKind, object, newSize);
</ins><span class="cx"> return caches->at(mapToActiveHeapKindAfterEnsuringGigacage(heapKind)).allocator().tryReallocate(object, newSize);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourcebmallocbmallocDeallocatorcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Deallocator.cpp (242418 => 242419)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Deallocator.cpp 2019-03-05 08:43:20 UTC (rev 242418)
+++ releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Deallocator.cpp 2019-03-05 08:43:25 UTC (rev 242419)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx"> #include "BInline.h"
</span><span class="cx"> #include "Chunk.h"
</span><span class="cx"> #include "Deallocator.h"
</span><del>-#include "DebugHeap.h"
</del><ins>+#include "Environment.h"
</ins><span class="cx"> #include "Heap.h"
</span><span class="cx"> #include "Object.h"
</span><span class="cx"> #include "PerProcess.h"
</span><span class="lines">@@ -39,13 +39,8 @@
</span><span class="cx">
</span><span class="cx"> Deallocator::Deallocator(Heap& heap)
</span><span class="cx"> : m_heap(heap)
</span><del>- , m_debugHeap(heap.debugHeap())
</del><span class="cx"> {
</span><del>- if (m_debugHeap) {
- // Fill the object log in order to disable the fast path.
- while (m_objectLog.size() != m_objectLog.capacity())
- m_objectLog.push(nullptr);
- }
</del><ins>+ BASSERT(!PerProcess<Environment>::get()->isDebugHeapEnabled());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Deallocator::~Deallocator()
</span><span class="lines">@@ -55,9 +50,6 @@
</span><span class="cx">
</span><span class="cx"> void Deallocator::scavenge()
</span><span class="cx"> {
</span><del>- if (m_debugHeap)
- return;
-
</del><span class="cx"> std::unique_lock<Mutex> lock(Heap::mutex());
</span><span class="cx">
</span><span class="cx"> processObjectLog(lock);
</span><span class="lines">@@ -73,9 +65,6 @@
</span><span class="cx">
</span><span class="cx"> void Deallocator::deallocateSlowCase(void* object)
</span><span class="cx"> {
</span><del>- if (m_debugHeap)
- return m_debugHeap->free(object);
-
</del><span class="cx"> if (!object)
</span><span class="cx"> return;
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224SourcebmallocbmallocDeallocatorh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Deallocator.h (242418 => 242419)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Deallocator.h 2019-03-05 08:43:20 UTC (rev 242418)
+++ releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/Deallocator.h 2019-03-05 08:43:25 UTC (rev 242419)
</span><span class="lines">@@ -33,7 +33,6 @@
</span><span class="cx">
</span><span class="cx"> namespace bmalloc {
</span><span class="cx">
</span><del>-class DebugHeap;
</del><span class="cx"> class Heap;
</span><span class="cx"> class Mutex;
</span><span class="cx">
</span><span class="lines">@@ -58,7 +57,6 @@
</span><span class="cx"> Heap& m_heap;
</span><span class="cx"> FixedVector<void*, deallocatorLogCapacity> m_objectLog;
</span><span class="cx"> LineCache m_lineCache; // The Heap removes items from this cache.
</span><del>- DebugHeap* m_debugHeap;
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> inline bool Deallocator::deallocateFastCase(void* object)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit224Sourcebmallocbmallocbmalloccpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/bmalloc.cpp (242418 => 242419)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/bmalloc.cpp 2019-03-05 08:43:20 UTC (rev 242418)
+++ releases/WebKitGTK/webkit-2.24/Source/bmalloc/bmalloc/bmalloc.cpp 2019-03-05 08:43:25 UTC (rev 242419)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx">
</span><span class="cx"> #include "bmalloc.h"
</span><span class="cx">
</span><ins>+#include "Environment.h"
</ins><span class="cx"> #include "PerProcess.h"
</span><span class="cx">
</span><span class="cx"> namespace bmalloc { namespace api {
</span><span class="lines">@@ -87,11 +88,9 @@
</span><span class="cx"> PerProcess<Scavenger>::get()->scavenge();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool isEnabled(HeapKind kind)
</del><ins>+bool isEnabled(HeapKind)
</ins><span class="cx"> {
</span><del>- kind = mapToActiveHeapKind(kind);
- std::unique_lock<Mutex> lock(Heap::mutex());
- return !PerProcess<PerHeapKind<Heap>>::getFastCase()->at(kind).debugHeap();
</del><ins>+ return !PerProcess<Environment>::get()->isDebugHeapEnabled();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if BOS(DARWIN)
</span></span></pre>
</div>
</div>
</body>
</html>