<!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>[164261] trunk/Source</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/164261">164261</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-02-17 17:32:18 -0800 (Mon, 17 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove ENABLE_GLOBAL_FASTMALLOC_NEW
https://bugs.webkit.org/show_bug.cgi?id=127067

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

* parser/Nodes.h:

Source/WebCore:

* platform/Timer.h:

Source/WTF:

Remove the global operator new/operator delete overrides. Having ALWAYS_INLINE operators
like we do is really undefined behavior according to the C++ standard and we've been lucky enough
to get away with it so far, but any code that calls operator new/operator delete inside from the C++ standard
library (not from headers that are included) will be mismatched and potentially crash. libc++ calls
delete in it's std::thread implementation for example.

The only supported way to override operator new and operator delete globally is to not use inline
functions, but that would mean that any application using WebKit would not be able to provide custom
operator new/operator delete functions so we'll just reuse the already existing infrastructure consisting
of the WTF_MAKE_FAST_ALLOCATED macro.

* wtf/FastMalloc.cpp:
(WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
* wtf/FastMalloc.h:
* wtf/Platform.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserNodesh">trunk/Source/JavaScriptCore/parser/Nodes.h</a></li>
<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>
<li><a href="#trunkSourceWTFwtfPlatformh">trunk/Source/WTF/wtf/Platform.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformTimerh">trunk/Source/WebCore/platform/Timer.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (164260 => 164261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-02-18 00:56:57 UTC (rev 164260)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-02-18 01:32:18 UTC (rev 164261)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2014-02-17  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Remove ENABLE_GLOBAL_FASTMALLOC_NEW
+        https://bugs.webkit.org/show_bug.cgi?id=127067
+
+        Reviewed by Geoffrey Garen.
+
+        * parser/Nodes.h:
+
</ins><span class="cx"> 2014-02-17  Sergio Correia  &lt;sergio.correia@openbossa.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Replace uses of PassOwnPtr/OwnPtr with std::unique_ptr in WebCore/inspector
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserNodesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Nodes.h (164260 => 164261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Nodes.h        2014-02-18 00:56:57 UTC (rev 164260)
+++ trunk/Source/JavaScriptCore/parser/Nodes.h        2014-02-18 01:32:18 UTC (rev 164261)
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     class ParserArenaRefCounted : public RefCounted&lt;ParserArenaRefCounted&gt; {
</span><del>-        WTF_FASTMALLOC_OPERATORS;
</del><ins>+        WTF_MAKE_FAST_ALLOCATED;
</ins><span class="cx">     protected:
</span><span class="cx">         ParserArenaRefCounted(VM*);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (164260 => 164261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2014-02-18 00:56:57 UTC (rev 164260)
+++ trunk/Source/WTF/ChangeLog        2014-02-18 01:32:18 UTC (rev 164261)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2014-02-17  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Remove ENABLE_GLOBAL_FASTMALLOC_NEW
+        https://bugs.webkit.org/show_bug.cgi?id=127067
+
+        Reviewed by Geoffrey Garen.
+
+        Remove the global operator new/operator delete overrides. Having ALWAYS_INLINE operators
+        like we do is really undefined behavior according to the C++ standard and we've been lucky enough
+        to get away with it so far, but any code that calls operator new/operator delete inside from the C++ standard
+        library (not from headers that are included) will be mismatched and potentially crash. libc++ calls
+        delete in it's std::thread implementation for example.
+        
+        The only supported way to override operator new and operator delete globally is to not use inline
+        functions, but that would mean that any application using WebKit would not be able to provide custom
+        operator new/operator delete functions so we'll just reuse the already existing infrastructure consisting
+        of the WTF_MAKE_FAST_ALLOCATED macro.
+
+        * wtf/FastMalloc.cpp:
+        (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+        * wtf/FastMalloc.h:
+        * wtf/Platform.h:
+
</ins><span class="cx"> 2014-02-17  Ryan Lortie  &lt;desrt@desrt.ca&gt;
</span><span class="cx"> 
</span><span class="cx">         Enable DFG_JIT on FreeBSD
</span></span></pre></div>
<a id="trunkSourceWTFwtfFastMalloccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/FastMalloc.cpp (164260 => 164261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/FastMalloc.cpp        2014-02-18 00:56:57 UTC (rev 164260)
+++ trunk/Source/WTF/wtf/FastMalloc.cpp        2014-02-18 01:32:18 UTC (rev 164261)
</span><span class="lines">@@ -4531,64 +4531,6 @@
</span><span class="cx">   }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if ENABLE(GLOBAL_FASTMALLOC_NEW)
-
-void* operator new(size_t size) {
-  void* p = cpp_alloc(size, false);
-  // We keep this next instruction out of cpp_alloc for a reason: when
-  // it's in, and new just calls cpp_alloc, the optimizer may fold the
-  // new call into cpp_alloc, which messes up our whole section-based
-  // stacktracing (see ATTRIBUTE_SECTION, above).  This ensures cpp_alloc
-  // isn't the last thing this fn calls, and prevents the folding.
-  MallocHook::InvokeNewHook(p, size);
-  return p;
-}
-
-void* operator new(size_t size, const std::nothrow_t&amp;) __THROW {
-  void* p = cpp_alloc(size, true);
-  MallocHook::InvokeNewHook(p, size);
-  return p;
-}
-
-void operator delete(void* p) __THROW {
-  MallocHook::InvokeDeleteHook(p);
-  do_free(p);
-}
-
-void operator delete(void* p, const std::nothrow_t&amp;) __THROW {
-  MallocHook::InvokeDeleteHook(p);
-  do_free(p);
-}
-
-void* operator new[](size_t size) {
-  void* p = cpp_alloc(size, false);
-  // We keep this next instruction out of cpp_alloc for a reason: when
-  // it's in, and new just calls cpp_alloc, the optimizer may fold the
-  // new call into cpp_alloc, which messes up our whole section-based
-  // stacktracing (see ATTRIBUTE_SECTION, above).  This ensures cpp_alloc
-  // isn't the last thing this fn calls, and prevents the folding.
-  MallocHook::InvokeNewHook(p, size);
-  return p;
-}
-
-void* operator new[](size_t size, const std::nothrow_t&amp;) __THROW {
-  void* p = cpp_alloc(size, true);
-  MallocHook::InvokeNewHook(p, size);
-  return p;
-}
-
-void operator delete[](void* p) __THROW {
-  MallocHook::InvokeDeleteHook(p);
-  do_free(p);
-}
-
-void operator delete[](void* p, const std::nothrow_t&amp;) __THROW {
-  MallocHook::InvokeDeleteHook(p);
-  do_free(p);
-}
-
-#endif
-
</del><span class="cx"> extern &quot;C&quot; void* memalign(size_t align, size_t size) __THROW {
</span><span class="cx">   void* result = do_memalign(align, size);
</span><span class="cx">   MallocHook::InvokeNewHook(result, size);
</span></span></pre></div>
<a id="trunkSourceWTFwtfFastMalloch"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/FastMalloc.h (164260 => 164261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/FastMalloc.h        2014-02-18 00:56:57 UTC (rev 164260)
+++ trunk/Source/WTF/wtf/FastMalloc.h        2014-02-18 01:32:18 UTC (rev 164261)
</span><span class="lines">@@ -248,46 +248,7 @@
</span><span class="cx"> #define WTF_PRIVATE_INLINE inline
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if !defined(_CRTDBG_MAP_ALLOC) &amp;&amp; !(defined(USE_SYSTEM_MALLOC) &amp;&amp; USE_SYSTEM_MALLOC)
-
-// The nothrow functions here are actually not all that helpful, because fastMalloc will
-// call CRASH() rather than returning 0, and returning 0 is what nothrow is all about.
-// But since WebKit code never uses exceptions or nothrow at all, this is probably OK.
-// Long term we will adopt FastAllocBase.h everywhere, and and replace this with
-// debug-only code to make sure we don't use the system malloc via the default operator
-// new by accident.
-
-#if ENABLE(GLOBAL_FASTMALLOC_NEW)
-
-#if COMPILER(MSVC)
-#pragma warning(push)
-#pragma warning(disable: 4290) // Disable the C++ exception specification ignored warning.
-#elif COMPILER(CLANG) &amp;&amp; defined(__has_warning)
-#pragma clang diagnostic push
-#if __has_warning(&quot;-Winline-new-delete&quot;)
-// FIXME: The operator new, delete definitions cannot be inline per replacement.functions (17.6.4.6/3) of the C++
-// standard. As a workaround, disable warnings for such usage. See &lt;https://bugs.webkit.org/show_bug.cgi?id=124186&gt;.
-#pragma clang diagnostic ignored &quot;-Winline-new-delete&quot;
-#endif
-#endif
-WTF_PRIVATE_INLINE void* operator new(size_t size) throw (std::bad_alloc) { return fastMalloc(size); }
-WTF_PRIVATE_INLINE void* operator new(size_t size, const std::nothrow_t&amp;) throw() { return fastMalloc(size); }
-WTF_PRIVATE_INLINE void operator delete(void* p) throw() { fastFree(p); }
-WTF_PRIVATE_INLINE void operator delete(void* p, const std::nothrow_t&amp;) throw() { fastFree(p); }
-WTF_PRIVATE_INLINE void* operator new[](size_t size) throw (std::bad_alloc) { return fastMalloc(size); }
-WTF_PRIVATE_INLINE void* operator new[](size_t size, const std::nothrow_t&amp;) throw() { return fastMalloc(size); }
-WTF_PRIVATE_INLINE void operator delete[](void* p) throw() { fastFree(p); }
-WTF_PRIVATE_INLINE void operator delete[](void* p, const std::nothrow_t&amp;) throw() { fastFree(p); }
-#if COMPILER(MSVC)
-#pragma warning(pop)
-#elif COMPILER(CLANG) &amp;&amp; defined(__has_warning)
-#pragma clang diagnostic pop
-#endif
-
-#endif // ENABLE(GLOBAL_FASTMALLOC_NEW)
-#endif // !defined(_CRTDBG_MAP_ALLOC) &amp;&amp; !(defined(USE_SYSTEM_MALLOC) &amp;&amp; USE_SYSTEM_MALLOC)
-
-#define WTF_FASTMALLOC_OPERATORS \
</del><ins>+#define WTF_MAKE_FAST_ALLOCATED \
</ins><span class="cx"> public: \
</span><span class="cx">     void* operator new(size_t, void* p) { return p; } \
</span><span class="cx">     void* operator new[](size_t, void* p) { return p; } \
</span><span class="lines">@@ -325,11 +286,4 @@
</span><span class="cx"> private: \
</span><span class="cx"> typedef int __thisIsHereToForceASemicolonAfterThisMacro
</span><span class="cx"> 
</span><del>-#if ENABLE(GLOBAL_FASTMALLOC_NEW)
-#define WTF_MAKE_FAST_ALLOCATED
-#else
-#define WTF_MAKE_FAST_ALLOCATED WTF_FASTMALLOC_OPERATORS
-#endif
-
-
</del><span class="cx"> #endif /* WTF_FastMalloc_h */
</span></span></pre></div>
<a id="trunkSourceWTFwtfPlatformh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Platform.h (164260 => 164261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Platform.h        2014-02-18 00:56:57 UTC (rev 164260)
+++ trunk/Source/WTF/wtf/Platform.h        2014-02-18 01:32:18 UTC (rev 164261)
</span><span class="lines">@@ -449,7 +449,6 @@
</span><span class="cx"> #define WTF_USE_HARFBUZZ 1
</span><span class="cx"> #define WTF_USE_SOUP 1
</span><span class="cx"> #define WTF_USE_WEBP 1
</span><del>-#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> /* On Windows, use QueryPerformanceCounter by default */
</span><span class="lines">@@ -601,19 +600,10 @@
</span><span class="cx"> /* Include feature macros */
</span><span class="cx"> #include &lt;wtf/FeatureDefines.h&gt;
</span><span class="cx"> 
</span><del>-#if PLATFORM(EFL)
-#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
-#endif
-
</del><span class="cx"> #if OS(WINDOWS)
</span><del>-#define ENABLE_GLOBAL_FASTMALLOC_NEW 0
</del><span class="cx"> #define USE_SYSTEM_MALLOC 1
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if !defined(ENABLE_GLOBAL_FASTMALLOC_NEW)
-#define ENABLE_GLOBAL_FASTMALLOC_NEW 1
-#endif
-
</del><span class="cx"> #define ENABLE_DEBUG_WITH_BREAKPOINT 0
</span><span class="cx"> #define ENABLE_SAMPLING_COUNTERS 0
</span><span class="cx"> #define ENABLE_SAMPLING_FLAGS 0
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (164260 => 164261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-18 00:56:57 UTC (rev 164260)
+++ trunk/Source/WebCore/ChangeLog        2014-02-18 01:32:18 UTC (rev 164261)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2014-02-17  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        Remove ENABLE_GLOBAL_FASTMALLOC_NEW
+        https://bugs.webkit.org/show_bug.cgi?id=127067
+
+        Reviewed by Geoffrey Garen.
+
+        * platform/Timer.h:
+
</ins><span class="cx"> 2014-02-17  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Move iOS only Settings into Settings.in and make them not-iOS only
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformTimerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/Timer.h (164260 => 164261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/Timer.h        2014-02-18 00:56:57 UTC (rev 164260)
+++ trunk/Source/WebCore/platform/Timer.h        2014-02-18 01:32:18 UTC (rev 164261)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> 
</span><span class="cx"> class TimerBase {
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(TimerBase);
</span><del>-    WTF_FASTMALLOC_OPERATORS;
</del><ins>+    WTF_MAKE_FAST_ALLOCATED;
</ins><span class="cx"> public:
</span><span class="cx">     TimerBase();
</span><span class="cx">     virtual ~TimerBase();
</span></span></pre>
</div>
</div>

</body>
</html>