<!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>[197393] releases/WebKitGTK/webkit-2.12/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/197393">197393</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2016-03-01 01:03:18 -0800 (Tue, 01 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Revert &quot;Merge <a href="http://trac.webkit.org/projects/webkit/changeset/197226">r197226</a> - Remove the on demand executable allocator&quot;

This reverts commit 3380464fbd83e408a06904221206c9bd1cafe2e6.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit212SourceJavaScriptCoreCMakeListstxt">releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/CMakeLists.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit212SourceJavaScriptCoreChangeLog">releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit212SourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxproj">releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj</a></li>
<li><a href="#releasesWebKitGTKwebkit212SourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxprojfilters">releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters</a></li>
<li><a href="#releasesWebKitGTKwebkit212SourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#releasesWebKitGTKwebkit212SourceJavaScriptCorejitExecutableAllocatorh">releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/jit/ExecutableAllocator.h</a></li>
<li><a href="#releasesWebKitGTKwebkit212SourceJavaScriptCorejitExecutableAllocatorFixedVMPoolcpp">releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit212SourceJavaScriptCorejitJITStubRoutineh">releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/jit/JITStubRoutine.h</a></li>
<li><a href="#releasesWebKitGTKwebkit212SourceWTFChangeLog">releases/WebKitGTK/webkit-2.12/Source/WTF/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit212SourceWTFwtfPlatformh">releases/WebKitGTK/webkit-2.12/Source/WTF/wtf/Platform.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit212SourceJavaScriptCorejitExecutableAllocatorcpp">releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/jit/ExecutableAllocator.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit212SourceJavaScriptCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/CMakeLists.txt (197392 => 197393)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/CMakeLists.txt        2016-03-01 09:02:54 UTC (rev 197392)
+++ releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/CMakeLists.txt        2016-03-01 09:03:18 UTC (rev 197393)
</span><span class="lines">@@ -515,6 +515,7 @@
</span><span class="cx">     jit/CallFrameShuffler32_64.cpp
</span><span class="cx">     jit/CallFrameShuffler64.cpp
</span><span class="cx">     jit/ExecutableAllocationFuzz.cpp
</span><ins>+    jit/ExecutableAllocator.cpp
</ins><span class="cx">     jit/ExecutableAllocatorFixedVMPool.cpp
</span><span class="cx">     jit/GCAwareJITStubRoutine.cpp
</span><span class="cx">     jit/GPRInfo.cpp
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit212SourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/ChangeLog (197392 => 197393)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/ChangeLog        2016-03-01 09:02:54 UTC (rev 197392)
+++ releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/ChangeLog        2016-03-01 09:03:18 UTC (rev 197393)
</span><span class="lines">@@ -126,49 +126,6 @@
</span><span class="cx">         (JSC::FTL::TypedPointer::heap):
</span><span class="cx">         (JSC::FTL::TypedPointer::value):
</span><span class="cx"> 
</span><del>-2016-02-26  Oliver Hunt  &lt;oliver@apple.com&gt;
-
-        Remove the on demand executable allocator
-        https://bugs.webkit.org/show_bug.cgi?id=154749
-
-        Reviewed by Geoffrey Garen.
-
-        Remove all the DemandExecutable code and executable allocator ifdefs.
-
-        * CMakeLists.txt:
-        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
-        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
-        * JavaScriptCore.xcodeproj/project.pbxproj:
-        * jit/ExecutableAllocator.cpp: Removed.
-        (JSC::DemandExecutableAllocator::DemandExecutableAllocator): Deleted.
-        (JSC::DemandExecutableAllocator::~DemandExecutableAllocator): Deleted.
-        (JSC::DemandExecutableAllocator::bytesAllocatedByAllAllocators): Deleted.
-        (JSC::DemandExecutableAllocator::bytesCommittedByAllocactors): Deleted.
-        (JSC::DemandExecutableAllocator::dumpProfileFromAllAllocators): Deleted.
-        (JSC::DemandExecutableAllocator::allocateNewSpace): Deleted.
-        (JSC::DemandExecutableAllocator::notifyNeedPage): Deleted.
-        (JSC::DemandExecutableAllocator::notifyPageIsFree): Deleted.
-        (JSC::DemandExecutableAllocator::allocators): Deleted.
-        (JSC::DemandExecutableAllocator::allocatorsMutex): Deleted.
-        (JSC::ExecutableAllocator::initializeAllocator): Deleted.
-        (JSC::ExecutableAllocator::ExecutableAllocator): Deleted.
-        (JSC::ExecutableAllocator::~ExecutableAllocator): Deleted.
-        (JSC::ExecutableAllocator::isValid): Deleted.
-        (JSC::ExecutableAllocator::underMemoryPressure): Deleted.
-        (JSC::ExecutableAllocator::memoryPressureMultiplier): Deleted.
-        (JSC::ExecutableAllocator::allocate): Deleted.
-        (JSC::ExecutableAllocator::committedByteCount): Deleted.
-        (JSC::ExecutableAllocator::dumpProfile): Deleted.
-        (JSC::ExecutableAllocator::getLock): Deleted.
-        (JSC::ExecutableAllocator::isValidExecutableMemory): Deleted.
-        (JSC::ExecutableAllocator::reprotectRegion): Deleted.
-        * jit/ExecutableAllocator.h:
-        * jit/ExecutableAllocatorFixedVMPool.cpp:
-        * jit/JITStubRoutine.h:
-        (JSC::JITStubRoutine::canPerformRangeFilter): Deleted.
-        (JSC::JITStubRoutine::filteringStartAddress): Deleted.
-        (JSC::JITStubRoutine::filteringExtentSize): Deleted.
-
</del><span class="cx"> 2016-02-26  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reduce direct callers of Structure::findStructuresAndMapForMaterialization
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit212SourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxproj"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj (197392 => 197393)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj        2016-03-01 09:02:54 UTC (rev 197392)
+++ releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj        2016-03-01 09:03:18 UTC (rev 197393)
</span><span class="lines">@@ -635,6 +635,7 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\jit\CallFrameShuffler32_64.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\jit\CallFrameShuffler64.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\jit\ExecutableAllocationFuzz.cpp&quot; /&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\jit\ExecutableAllocator.cpp&quot; /&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\jit\ExecutableAllocatorFixedVMPool.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\jit\GCAwareJITStubRoutine.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\jit\HostCallReturnValue.cpp&quot; /&gt;
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit212SourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters (197392 => 197393)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters        2016-03-01 09:02:54 UTC (rev 197392)
+++ releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters        2016-03-01 09:03:18 UTC (rev 197393)
</span><span class="lines">@@ -390,6 +390,9 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\interpreter\StackVisitor.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;interpreter&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\jit\ExecutableAllocator.cpp&quot;&gt;
+      &lt;Filter&gt;jit&lt;/Filter&gt;
+    &lt;/ClCompile&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\jit\GCAwareJITStubRoutine.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;jit&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit212SourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (197392 => 197393)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-03-01 09:02:54 UTC (rev 197392)
+++ releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-03-01 09:03:18 UTC (rev 197393)
</span><span class="lines">@@ -1757,6 +1757,7 @@
</span><span class="cx">                 A7A8AF4017ADB5F3005AB174 /* Uint8ClampedArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A8AF3117ADB5F3005AB174 /* Uint8ClampedArray.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A7A8AF4117ADB5F3005AB174 /* Uint16Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A8AF3217ADB5F3005AB174 /* Uint16Array.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A7A8AF4217ADB5F3005AB174 /* Uint32Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A8AF3317ADB5F3005AB174 /* Uint32Array.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                A7B48F490EE8936F00DCBDB6 /* ExecutableAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7B48DB60EE74CFC00DCBDB6 /* ExecutableAllocator.cpp */; };
</ins><span class="cx">                 A7B4ACAF1484C9CE00B38A36 /* JSExportMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B4ACAE1484C9CE00B38A36 /* JSExportMacros.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A7B601821639FD2A00372BA3 /* UnlinkedCodeBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = A79E781F15EECBA80047C855 /* UnlinkedCodeBlock.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 A7BDAEC817F4EA1400F6140C /* ArrayIteratorPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7BDAEC217F4EA1400F6140C /* ArrayIteratorPrototype.cpp */; };
</span><span class="lines">@@ -3948,6 +3949,7 @@
</span><span class="cx">                 A7A8AF3317ADB5F3005AB174 /* Uint32Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Uint32Array.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A7A979C418BE8D9E002C3733 /* FunctionPrototype.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = FunctionPrototype.js; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A7B48DB50EE74CFC00DCBDB6 /* ExecutableAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExecutableAllocator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                A7B48DB60EE74CFC00DCBDB6 /* ExecutableAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExecutableAllocator.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 A7B4ACAE1484C9CE00B38A36 /* JSExportMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSExportMacros.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 A7BDAEC217F4EA1400F6140C /* ArrayIteratorPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = ArrayIteratorPrototype.cpp; sourceTree = &quot;&lt;group&gt;&quot;; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
</span><span class="cx">                 A7BDAEC317F4EA1400F6140C /* ArrayIteratorPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayIteratorPrototype.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -4942,6 +4944,7 @@
</span><span class="cx">                                 0FD82E37141AB14200179C94 /* CompactJITCodeMap.h */,
</span><span class="cx">                                 0FF054F71AC35B4400E5BE57 /* ExecutableAllocationFuzz.cpp */,
</span><span class="cx">                                 0FF054F81AC35B4400E5BE57 /* ExecutableAllocationFuzz.h */,
</span><ins>+                                A7B48DB60EE74CFC00DCBDB6 /* ExecutableAllocator.cpp */,
</ins><span class="cx">                                 A7B48DB50EE74CFC00DCBDB6 /* ExecutableAllocator.h */,
</span><span class="cx">                                 86DB64630F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp */,
</span><span class="cx">                                 0F24E53E17EA9F5900ABB217 /* FPRInfo.h */,
</span><span class="lines">@@ -8850,6 +8853,7 @@
</span><span class="cx">                                 1429D8780ED21ACD00B89619 /* ExceptionHelpers.cpp in Sources */,
</span><span class="cx">                                 86CA032E1038E8440028A609 /* Executable.cpp in Sources */,
</span><span class="cx">                                 0FF054F91AC35B4400E5BE57 /* ExecutableAllocationFuzz.cpp in Sources */,
</span><ins>+                                A7B48F490EE8936F00DCBDB6 /* ExecutableAllocator.cpp in Sources */,
</ins><span class="cx">                                 86DB64640F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp in Sources */,
</span><span class="cx">                                 0F56A1D515001CF4002992B1 /* ExecutionCounter.cpp in Sources */,
</span><span class="cx">                                 0F0332C018ADFAE1005F979A /* ExitingJITType.cpp in Sources */,
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit212SourceJavaScriptCorejitExecutableAllocatorcpp"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/jit/ExecutableAllocator.cpp (0 => 197393)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/jit/ExecutableAllocator.cpp                                (rev 0)
+++ releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/jit/ExecutableAllocator.cpp        2016-03-01 09:03:18 UTC (rev 197393)
</span><span class="lines">@@ -0,0 +1,275 @@
</span><ins>+/*
+ * Copyright (C) 2008 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include &quot;config.h&quot;
+#include &quot;ExecutableAllocator.h&quot;
+
+#include &quot;JSCInlines.h&quot;
+
+#if ENABLE(EXECUTABLE_ALLOCATOR_DEMAND)
+#include &quot;CodeProfiling.h&quot;
+#include &lt;wtf/HashSet.h&gt;
+#include &lt;wtf/Lock.h&gt;
+#include &lt;wtf/MetaAllocator.h&gt;
+#include &lt;wtf/NeverDestroyed.h&gt;
+#include &lt;wtf/PageReservation.h&gt;
+#include &lt;wtf/VMTags.h&gt;
+#endif
+
+// Uncomment to create an artificial executable memory usage limit. This limit
+// is imperfect and is primarily useful for testing the VM's ability to handle
+// out-of-executable-memory situations.
+// #define EXECUTABLE_MEMORY_LIMIT 1000000
+
+#if ENABLE(ASSEMBLER)
+
+using namespace WTF;
+
+namespace JSC {
+
+#if ENABLE(EXECUTABLE_ALLOCATOR_DEMAND)
+
+class DemandExecutableAllocator : public MetaAllocator {
+public:
+    DemandExecutableAllocator()
+        : MetaAllocator(jitAllocationGranule)
+    {
+        std::lock_guard&lt;StaticLock&gt; lock(allocatorsMutex());
+        allocators().add(this);
+        // Don't preallocate any memory here.
+    }
+    
+    virtual ~DemandExecutableAllocator()
+    {
+        {
+            std::lock_guard&lt;StaticLock&gt; lock(allocatorsMutex());
+            allocators().remove(this);
+        }
+        for (unsigned i = 0; i &lt; reservations.size(); ++i)
+            reservations.at(i).deallocate();
+    }
+
+    static size_t bytesAllocatedByAllAllocators()
+    {
+        size_t total = 0;
+        std::lock_guard&lt;StaticLock&gt; lock(allocatorsMutex());
+        for (HashSet&lt;DemandExecutableAllocator*&gt;::const_iterator allocator = allocators().begin(); allocator != allocators().end(); ++allocator)
+            total += (*allocator)-&gt;bytesAllocated();
+        return total;
+    }
+
+    static size_t bytesCommittedByAllocactors()
+    {
+        size_t total = 0;
+        std::lock_guard&lt;StaticLock&gt; lock(allocatorsMutex());
+        for (HashSet&lt;DemandExecutableAllocator*&gt;::const_iterator allocator = allocators().begin(); allocator != allocators().end(); ++allocator)
+            total += (*allocator)-&gt;bytesCommitted();
+        return total;
+    }
+
+#if ENABLE(META_ALLOCATOR_PROFILE)
+    static void dumpProfileFromAllAllocators()
+    {
+        std::lock_guard&lt;StaticLock&gt; lock(allocatorsMutex());
+        for (HashSet&lt;DemandExecutableAllocator*&gt;::const_iterator allocator = allocators().begin(); allocator != allocators().end(); ++allocator)
+            (*allocator)-&gt;dumpProfile();
+    }
+#endif
+
+protected:
+    virtual void* allocateNewSpace(size_t&amp; numPages)
+    {
+        size_t newNumPages = (((numPages * pageSize() + JIT_ALLOCATOR_LARGE_ALLOC_SIZE - 1) / JIT_ALLOCATOR_LARGE_ALLOC_SIZE * JIT_ALLOCATOR_LARGE_ALLOC_SIZE) + pageSize() - 1) / pageSize();
+        
+        ASSERT(newNumPages &gt;= numPages);
+        
+        numPages = newNumPages;
+        
+#ifdef EXECUTABLE_MEMORY_LIMIT
+        if (bytesAllocatedByAllAllocators() &gt;= EXECUTABLE_MEMORY_LIMIT)
+            return 0;
+#endif
+        
+        PageReservation reservation = PageReservation::reserve(numPages * pageSize(), OSAllocator::JSJITCodePages, EXECUTABLE_POOL_WRITABLE, true);
+        RELEASE_ASSERT(reservation);
+        
+        reservations.append(reservation);
+        
+        return reservation.base();
+    }
+    
+    virtual void notifyNeedPage(void* page)
+    {
+        OSAllocator::commit(page, pageSize(), EXECUTABLE_POOL_WRITABLE, true);
+    }
+    
+    virtual void notifyPageIsFree(void* page)
+    {
+        OSAllocator::decommit(page, pageSize());
+    }
+
+private:
+    Vector&lt;PageReservation, 16&gt; reservations;
+    static HashSet&lt;DemandExecutableAllocator*&gt;&amp; allocators()
+    {
+        static NeverDestroyed&lt;HashSet&lt;DemandExecutableAllocator*&gt;&gt; set;
+        return set;
+    }
+
+    static StaticLock&amp; allocatorsMutex()
+    {
+        static StaticLock mutex;
+
+        return mutex;
+    }
+};
+
+#if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
+void ExecutableAllocator::initializeAllocator()
+{
+}
+#else
+static DemandExecutableAllocator* gAllocator;
+
+namespace {
+static inline DemandExecutableAllocator* allocator()
+{
+    return gAllocator;
+}
+}
+
+void ExecutableAllocator::initializeAllocator()
+{
+    ASSERT(!gAllocator);
+    gAllocator = new DemandExecutableAllocator();
+    CodeProfiling::notifyAllocator(gAllocator);
+}
+#endif
+
+ExecutableAllocator::ExecutableAllocator(VM&amp;)
+#if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
+    : m_allocator(std::make_unique&lt;DemandExecutableAllocator&gt;())
+#endif
+{
+    ASSERT(allocator());
+}
+
+ExecutableAllocator::~ExecutableAllocator()
+{
+}
+
+bool ExecutableAllocator::isValid() const
+{
+    return true;
+}
+
+bool ExecutableAllocator::underMemoryPressure()
+{
+#ifdef EXECUTABLE_MEMORY_LIMIT
+    return DemandExecutableAllocator::bytesAllocatedByAllAllocators() &gt; EXECUTABLE_MEMORY_LIMIT / 2;
+#else
+    return false;
+#endif
+}
+
+double ExecutableAllocator::memoryPressureMultiplier(size_t addedMemoryUsage)
+{
+    double result;
+#ifdef EXECUTABLE_MEMORY_LIMIT
+    size_t bytesAllocated = DemandExecutableAllocator::bytesAllocatedByAllAllocators() + addedMemoryUsage;
+    if (bytesAllocated &gt;= EXECUTABLE_MEMORY_LIMIT)
+        bytesAllocated = EXECUTABLE_MEMORY_LIMIT;
+    result = static_cast&lt;double&gt;(EXECUTABLE_MEMORY_LIMIT) /
+        (EXECUTABLE_MEMORY_LIMIT - bytesAllocated);
+#else
+    UNUSED_PARAM(addedMemoryUsage);
+    result = 1.0;
+#endif
+    if (result &lt; 1.0)
+        result = 1.0;
+    return result;
+
+}
+
+RefPtr&lt;ExecutableMemoryHandle&gt; ExecutableAllocator::allocate(VM&amp;, size_t sizeInBytes, void* ownerUID, JITCompilationEffort effort)
+{
+    RefPtr&lt;ExecutableMemoryHandle&gt; result = allocator()-&gt;allocate(sizeInBytes, ownerUID);
+    RELEASE_ASSERT(result || effort != JITCompilationMustSucceed);
+    return result;
+}
+
+size_t ExecutableAllocator::committedByteCount()
+{
+    return DemandExecutableAllocator::bytesCommittedByAllocactors();
+}
+
+#if ENABLE(META_ALLOCATOR_PROFILE)
+void ExecutableAllocator::dumpProfile()
+{
+    DemandExecutableAllocator::dumpProfileFromAllAllocators();
+}
+#endif
+
+Lock&amp; ExecutableAllocator::getLock() const
+{
+    return gAllocator-&gt;getLock();
+}
+
+bool ExecutableAllocator::isValidExecutableMemory(const LockHolder&amp; locker, void* address)
+{
+    return gAllocator-&gt;isInAllocatedMemory(locker, address);
+}
+
+#endif // ENABLE(EXECUTABLE_ALLOCATOR_DEMAND)
+
+#if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
+
+#if OS(WINDOWS)
+#error &quot;ASSEMBLER_WX_EXCLUSIVE not yet suported on this platform.&quot;
+#endif
+
+void ExecutableAllocator::reprotectRegion(void* start, size_t size, ProtectionSetting setting)
+{
+    size_t pageSize = WTF::pageSize();
+
+    // Calculate the start of the page containing this region,
+    // and account for this extra memory within size.
+    intptr_t startPtr = reinterpret_cast&lt;intptr_t&gt;(start);
+    intptr_t pageStartPtr = startPtr &amp; ~(pageSize - 1);
+    void* pageStart = reinterpret_cast&lt;void*&gt;(pageStartPtr);
+    size += (startPtr - pageStartPtr);
+
+    // Round size up
+    size += (pageSize - 1);
+    size &amp;= ~(pageSize - 1);
+
+    mprotect(pageStart, size, (setting == Writable) ? PROTECTION_FLAGS_RW : PROTECTION_FLAGS_RX);
+}
+
+#endif
+
+}
+
+#endif // HAVE(ASSEMBLER)
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit212SourceJavaScriptCorejitExecutableAllocatorh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/jit/ExecutableAllocator.h (197392 => 197393)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/jit/ExecutableAllocator.h        2016-03-01 09:02:54 UTC (rev 197392)
+++ releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/jit/ExecutableAllocator.h        2016-03-01 09:03:18 UTC (rev 197393)
</span><span class="lines">@@ -69,6 +69,11 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ASSEMBLER)
</span><span class="cx"> 
</span><ins>+#if ENABLE(EXECUTABLE_ALLOCATOR_DEMAND)
+class DemandExecutableAllocator;
+#endif
+
+#if ENABLE(EXECUTABLE_ALLOCATOR_FIXED)
</ins><span class="cx"> #if CPU(ARM)
</span><span class="cx"> static const size_t fixedExecutableMemoryPoolSize = 16 * 1024 * 1024;
</span><span class="cx"> #elif CPU(ARM64)
</span><span class="lines">@@ -85,6 +90,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> extern uintptr_t startOfFixedExecutableMemoryPool;
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> class ExecutableAllocator {
</span><span class="cx">     enum ProtectionSetting { Writable, Executable };
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit212SourceJavaScriptCorejitExecutableAllocatorFixedVMPoolcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp (197392 => 197393)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp        2016-03-01 09:02:54 UTC (rev 197392)
+++ releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp        2016-03-01 09:03:18 UTC (rev 197393)
</span><span class="lines">@@ -28,6 +28,8 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;JSCInlines.h&quot;
</span><span class="cx"> 
</span><ins>+#if ENABLE(EXECUTABLE_ALLOCATOR_FIXED)
+
</ins><span class="cx"> #include &quot;CodeProfiling.h&quot;
</span><span class="cx"> #include &quot;ExecutableAllocationFuzz.h&quot;
</span><span class="cx"> #include &lt;errno.h&gt;
</span><span class="lines">@@ -220,3 +222,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> }
</span><ins>+
+
+#endif // ENABLE(EXECUTABLE_ALLOCATOR_FIXED)
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit212SourceJavaScriptCorejitJITStubRoutineh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/jit/JITStubRoutine.h (197392 => 197393)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/jit/JITStubRoutine.h        2016-03-01 09:02:54 UTC (rev 197392)
+++ releases/WebKitGTK/webkit-2.12/Source/JavaScriptCore/jit/JITStubRoutine.h        2016-03-01 09:03:18 UTC (rev 197393)
</span><span class="lines">@@ -103,15 +103,29 @@
</span><span class="cx">     
</span><span class="cx">     static bool canPerformRangeFilter()
</span><span class="cx">     {
</span><ins>+#if ENABLE(EXECUTABLE_ALLOCATOR_FIXED)
</ins><span class="cx">         return true;
</span><ins>+#else
+        return false;
+#endif
</ins><span class="cx">     }
</span><span class="cx">     static uintptr_t filteringStartAddress()
</span><span class="cx">     {
</span><ins>+#if ENABLE(EXECUTABLE_ALLOCATOR_FIXED)
</ins><span class="cx">         return startOfFixedExecutableMemoryPool;
</span><ins>+#else
+        UNREACHABLE_FOR_PLATFORM();
+        return 0;
+#endif
</ins><span class="cx">     }
</span><span class="cx">     static size_t filteringExtentSize()
</span><span class="cx">     {
</span><ins>+#if ENABLE(EXECUTABLE_ALLOCATOR_FIXED)
</ins><span class="cx">         return fixedExecutableMemoryPoolSize;
</span><ins>+#else
+        UNREACHABLE_FOR_PLATFORM();
+        return 0;
+#endif
</ins><span class="cx">     }
</span><span class="cx">     static bool passesFilter(uintptr_t address)
</span><span class="cx">     {
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit212SourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/Source/WTF/ChangeLog (197392 => 197393)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/WTF/ChangeLog        2016-03-01 09:02:54 UTC (rev 197392)
+++ releases/WebKitGTK/webkit-2.12/Source/WTF/ChangeLog        2016-03-01 09:03:18 UTC (rev 197393)
</span><span class="lines">@@ -1,14 +1,3 @@
</span><del>-2016-02-26  Oliver Hunt  &lt;oliver@apple.com&gt;
-
-        Remove the on demand executable allocator
-        https://bugs.webkit.org/show_bug.cgi?id=154749
-
-        Reviewed by Geoffrey Garen.
-
-        Remove the DeamndExecutableAllocator compile flags.
-
-        * wtf/Platform.h:
-
</del><span class="cx"> 2016-02-25  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         HashMap::ensure() should return an AddResult like all the other add-like functions.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit212SourceWTFwtfPlatformh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.12/Source/WTF/wtf/Platform.h (197392 => 197393)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.12/Source/WTF/wtf/Platform.h        2016-03-01 09:02:54 UTC (rev 197392)
+++ releases/WebKitGTK/webkit-2.12/Source/WTF/wtf/Platform.h        2016-03-01 09:03:18 UTC (rev 197393)
</span><span class="lines">@@ -882,6 +882,16 @@
</span><span class="cx"> #define ENABLE_MASM_PROBE 0
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+/* Pick which allocator to use; we only need an executable allocator if the assembler is compiled in.
+   On non-Windows x86-64, iOS, and ARM64 we use a single fixed mmap, on other platforms we mmap on demand. */
+#if ENABLE(ASSEMBLER)
+#if CPU(X86_64) || PLATFORM(IOS) || CPU(ARM64)
+#define ENABLE_EXECUTABLE_ALLOCATOR_FIXED 1
+#else
+#define ENABLE_EXECUTABLE_ALLOCATOR_DEMAND 1
+#endif
+#endif
+
</ins><span class="cx"> /* CSS Selector JIT Compiler */
</span><span class="cx"> #if !defined(ENABLE_CSS_SELECTOR_JIT)
</span><span class="cx"> #if (CPU(X86_64) || CPU(ARM64) || (CPU(ARM_THUMB2) &amp;&amp; PLATFORM(IOS))) &amp;&amp; ENABLE(JIT) &amp;&amp; (OS(DARWIN) || PLATFORM(GTK) || PLATFORM(EFL))
</span></span></pre>
</div>
</div>

</body>
</html>