<!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>[168676] trunk</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/168676">168676</a></dd>
<dt>Author</dt> <dd>mark.lam@apple.com</dd>
<dt>Date</dt> <dd>2014-05-12 23:40:08 -0700 (Mon, 12 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>WebKit2 on iOS needs to capture the main thread's floating point environment.
&lt;https://webkit.org/b/132755&gt;

Reviewed by Geoffrey Garen.


Source/WebCore: 
For iOS, WorkerThread::workerThread() expects to be able to initialize the
worker thread's floating point environment to be the same as the one in the
main thread.  The FP env of the main thread is expected to have been captured
in the mainThreadFEnv global.  On WebKit2 for iOS, we neglected to initialize
mainThreadFEnv.

We now introduce a FloatingPointEnvironment class that will encapsulate the main
thread (aka &quot;UIThread&quot;) fenv, and we'll call FloatingPointEnv::saveMainThreadEnvironment()
from ChildProcess::platformInitialize() to ensure that the FloatingPointEnvironment
singleton instance is initialized properly for WebKit2.

In the ChildProcess::platformInitialize(), we also need to initialize the ARMv7
FP env to support denormalized numbers.  We'll do this before calling
saveMainThreadEnvironment().

Tests: fast/workers/worker-floating-point.html
       js/floating-point-denormalized.html

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* platform/ios/wak/FloatingPointEnvironment.cpp: Added.
(WebCore::FloatingPointEnvironment::env):
(WebCore::FloatingPointEnvironment::FloatingPointEnvironment):
(WebCore::FloatingPointEnvironment::enableDenormalSupport):
(WebCore::FloatingPointEnvironment::saveMainThreadEnvironment):
(WebCore::FloatingPointEnvironment::propagateMainThreadEnvironment):
* platform/ios/wak/FloatingPointEnvironment.h: Added.
* platform/ios/wak/WebCoreThread.h:
* platform/ios/wak/WebCoreThread.mm:
(RunWebThread):
(StartWebThread):
* workers/WorkerThread.cpp:
(WebCore::WorkerThread::workerThread):

Source/WebKit2: 
* Shared/mac/ChildProcessMac.mm:
(WebKit::ChildProcess::platformInitialize):
- Call FloatingPointEnv::enableNeededFloatingPointModes() to initialize
  the ARMv7 FP env to support denormalized numbers.
- Call FloatingPointEnv::saveMainThreadEnvironment() to capture the main thread
  fp env.

LayoutTests: 
* fast/workers/resources/worker-floating-point.js: Added.
(runTest1):
(doDiv):
(runTest2):
* fast/workers/worker-floating-point-expected.txt: Added.
* fast/workers/worker-floating-point.html: Added.
* js/floating-point-denormalized-expected.txt: Added.
* js/floating-point-denormalized.html: Added.
* js/script-tests/floating-point-denormalized.js: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreplatformioswakWebCoreThreadh">trunk/Source/WebCore/platform/ios/wak/WebCoreThread.h</a></li>
<li><a href="#trunkSourceWebCoreplatformioswakWebCoreThreadmm">trunk/Source/WebCore/platform/ios/wak/WebCoreThread.mm</a></li>
<li><a href="#trunkSourceWebCoreworkersWorkerThreadcpp">trunk/Source/WebCore/workers/WorkerThread.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedmacChildProcessMacmm">trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastworkersresourcesworkerfloatingpointjs">trunk/LayoutTests/fast/workers/resources/worker-floating-point.js</a></li>
<li><a href="#trunkLayoutTestsfastworkersworkerfloatingpointexpectedtxt">trunk/LayoutTests/fast/workers/worker-floating-point-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastworkersworkerfloatingpointhtml">trunk/LayoutTests/fast/workers/worker-floating-point.html</a></li>
<li><a href="#trunkLayoutTestsjsfloatingpointdenormalizedexpectedtxt">trunk/LayoutTests/js/floating-point-denormalized-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsfloatingpointdenormalizedhtml">trunk/LayoutTests/js/floating-point-denormalized.html</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsfloatingpointdenormalizedjs">trunk/LayoutTests/js/script-tests/floating-point-denormalized.js</a></li>
<li><a href="#trunkSourceWebCoreplatformioswakFloatingPointEnvironmentcpp">trunk/Source/WebCore/platform/ios/wak/FloatingPointEnvironment.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformioswakFloatingPointEnvironmenth">trunk/Source/WebCore/platform/ios/wak/FloatingPointEnvironment.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (168675 => 168676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-05-13 06:14:17 UTC (rev 168675)
+++ trunk/LayoutTests/ChangeLog        2014-05-13 06:40:08 UTC (rev 168676)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-05-12  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        WebKit2 on iOS needs to capture the main thread's floating point environment.
+        &lt;https://webkit.org/b/132755&gt;
+
+        Reviewed by Geoffrey Garen.
+
+        * fast/workers/resources/worker-floating-point.js: Added.
+        (runTest1):
+        (doDiv):
+        (runTest2):
+        * fast/workers/worker-floating-point-expected.txt: Added.
+        * fast/workers/worker-floating-point.html: Added.
+        * js/floating-point-denormalized-expected.txt: Added.
+        * js/floating-point-denormalized.html: Added.
+        * js/script-tests/floating-point-denormalized.js: Added.
+
</ins><span class="cx"> 2014-05-12  Dirk Schulze  &lt;krit@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         SVG root element accepts background color but fails to repaint it
</span></span></pre></div>
<a id="trunkLayoutTestsfastworkersresourcesworkerfloatingpointjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/workers/resources/worker-floating-point.js (0 => 168676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/workers/resources/worker-floating-point.js                                (rev 0)
+++ trunk/LayoutTests/fast/workers/resources/worker-floating-point.js        2014-05-13 06:40:08 UTC (rev 168676)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+postMessage(&quot;Start test&quot;);
+
+function runTest1() {
+    var count = 0;
+    var value = 1;
+    while (value / 2) {
+        value /= 2;
+        ++count;
+    }
+
+    if (count == 1074)
+        return &quot;PASS: &quot; + count;
+    return &quot;FAIL: expect 1074, actual &quot; + count;
+}
+
+postMessage(&quot;Test 1: &quot; + runTest1());
+
+function doDiv(a, b)
+{
+    return a / b;
+}
+
+function runTest2() {
+    count = doDiv(807930891584112.1, 1000000000.1);
+    if (count == 807930.89150331901085)
+        return &quot;PASS: &quot; + count;
+    return &quot;FAIL: expect 807930.89150331901085, actual &quot; + count;
+}
+
+postMessage(&quot;Test 2: &quot; + runTest2());
+
+postMessage(&quot;DONE&quot;);
</ins></span></pre></div>
<a id="trunkLayoutTestsfastworkersworkerfloatingpointexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/workers/worker-floating-point-expected.txt (0 => 168676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/workers/worker-floating-point-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/workers/worker-floating-point-expected.txt        2014-05-13 06:40:08 UTC (rev 168676)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+Test a few floating point operations on Worker threads. Regression test for https://webkit.org/b/132755.
+
+Start test
+Test 1: PASS: 1074
+Test 2: PASS: 807930.891503319
+DONE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastworkersworkerfloatingpointhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/workers/worker-floating-point.html (0 => 168676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/workers/worker-floating-point.html                                (rev 0)
+++ trunk/LayoutTests/fast/workers/worker-floating-point.html        2014-05-13 06:40:08 UTC (rev 168676)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;html&gt;
+&lt;body&gt;
+&lt;p&gt;Test a few floating point operations on Worker threads.  Regression test for https://webkit.org/b/132755.&lt;/p&gt;
+&lt;div id=result&gt;&lt;/div&gt;
+&lt;script&gt;
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+function log(message)
+{
+    document.getElementById(&quot;result&quot;).innerHTML += message + &quot;&lt;br&gt;&quot;;
+}
+
+var worker = new Worker(&quot;resources/worker-floating-point.js&quot;);
+worker.onmessage = function(event) {
+    log(event.data);
+    if (event.data == &quot;DONE&quot;) {
+        if (window.testRunner)
+            testRunner.notifyDone();
+    }
+};
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsfloatingpointdenormalizedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/floating-point-denormalized-expected.txt (0 => 168676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/floating-point-denormalized-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/floating-point-denormalized-expected.txt        2014-05-13 06:40:08 UTC (rev 168676)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+This tests that floating point math supports for denormalized numbers.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsfloatingpointdenormalizedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/floating-point-denormalized.html (0 => 168676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/floating-point-denormalized.html                                (rev 0)
+++ trunk/LayoutTests/js/floating-point-denormalized.html        2014-05-13 06:40:08 UTC (rev 168676)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;script-tests/floating-point-denormalized.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsfloatingpointdenormalizedjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/floating-point-denormalized.js (0 => 168676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/floating-point-denormalized.js                                (rev 0)
+++ trunk/LayoutTests/js/script-tests/floating-point-denormalized.js        2014-05-13 06:40:08 UTC (rev 168676)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+description(
+&quot;This tests that floating point math supports for denormalized numbers.&quot;
+);
+
+var count = 0;
+var value = 1;
+while (value / 2) {
+    value /= 2;
+    ++count;
+}
+
+if (count == 1074)
+    debug(&quot;PASS&quot;);
+else
+    debug(&quot;FAIL: expected 1074, actual &quot; + count);
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (168675 => 168676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-05-13 06:14:17 UTC (rev 168675)
+++ trunk/Source/WebCore/ChangeLog        2014-05-13 06:40:08 UTC (rev 168676)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2014-05-12  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        WebKit2 on iOS needs to capture the main thread's floating point environment.
+        &lt;https://webkit.org/b/132755&gt;
+
+        Reviewed by Geoffrey Garen.
+
+        For iOS, WorkerThread::workerThread() expects to be able to initialize the
+        worker thread's floating point environment to be the same as the one in the
+        main thread.  The FP env of the main thread is expected to have been captured
+        in the mainThreadFEnv global.  On WebKit2 for iOS, we neglected to initialize
+        mainThreadFEnv.
+
+        We now introduce a FloatingPointEnvironment class that will encapsulate the main
+        thread (aka &quot;UIThread&quot;) fenv, and we'll call FloatingPointEnv::saveMainThreadEnvironment()
+        from ChildProcess::platformInitialize() to ensure that the FloatingPointEnvironment
+        singleton instance is initialized properly for WebKit2.
+
+        In the ChildProcess::platformInitialize(), we also need to initialize the ARMv7
+        FP env to support denormalized numbers.  We'll do this before calling
+        saveMainThreadEnvironment().
+
+        Tests: fast/workers/worker-floating-point.html
+               js/floating-point-denormalized.html
+
+        * WebCore.exp.in:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/ios/wak/FloatingPointEnvironment.cpp: Added.
+        (WebCore::FloatingPointEnvironment::env):
+        (WebCore::FloatingPointEnvironment::FloatingPointEnvironment):
+        (WebCore::FloatingPointEnvironment::enableDenormalSupport):
+        (WebCore::FloatingPointEnvironment::saveMainThreadEnvironment):
+        (WebCore::FloatingPointEnvironment::propagateMainThreadEnvironment):
+        * platform/ios/wak/FloatingPointEnvironment.h: Added.
+        * platform/ios/wak/WebCoreThread.h:
+        * platform/ios/wak/WebCoreThread.mm:
+        (RunWebThread):
+        (StartWebThread):
+        * workers/WorkerThread.cpp:
+        (WebCore::WorkerThread::workerThread):
+
</ins><span class="cx"> 2014-05-12  Dirk Schulze  &lt;krit@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         SVG root element accepts background color but fails to repaint it
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (168675 => 168676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-05-13 06:14:17 UTC (rev 168675)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-05-13 06:40:08 UTC (rev 168676)
</span><span class="lines">@@ -2582,6 +2582,9 @@
</span><span class="cx"> __ZN7WebCore23atBoundaryOfGranularityERKNS_15VisiblePositionENS_15TextGranularityENS_18SelectionDirectionE
</span><span class="cx"> __ZN7WebCore23characterBeforePositionERKNS_15VisiblePositionE
</span><span class="cx"> __ZN7WebCore24DocumentMarkerController14markersInRangeEPNS_5RangeENS_14DocumentMarker11MarkerTypesE
</span><ins>+__ZN7WebCore24FloatingPointEnvironment21enableDenormalSupportEv
+__ZN7WebCore24FloatingPointEnvironment25saveMainThreadEnvironmentEv
+__ZN7WebCore24FloatingPointEnvironment6sharedEv
</ins><span class="cx"> __ZN7WebCore24acquireLineBreakIteratorEN3WTF10StringViewERKNS0_12AtomicStringEPKtj
</span><span class="cx"> __ZN7WebCore24createTemporaryDirectoryEP8NSString
</span><span class="cx"> __ZN7WebCore24distanceBetweenPositionsERKNS_15VisiblePositionES2_
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (168675 => 168676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-05-13 06:14:17 UTC (rev 168675)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-05-13 06:40:08 UTC (rev 168676)
</span><span class="lines">@@ -6545,6 +6545,8 @@
</span><span class="cx">                 FE4AADEE16D2C37400026FFC /* AbstractSQLStatement.h in Headers */ = {isa = PBXBuildFile; fileRef = FE4AADEC16D2C37400026FFC /* AbstractSQLStatement.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 FE4AADEF16D2C37400026FFC /* AbstractSQLStatementBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = FE4AADED16D2C37400026FFC /* AbstractSQLStatementBackend.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 FE6938B61045D67E008EABB6 /* EventHandlerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = FE6938B51045D67E008EABB6 /* EventHandlerIOS.mm */; };
</span><ins>+                FE699871192087E7006936BD /* FloatingPointEnvironment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE69986F192087E7006936BD /* FloatingPointEnvironment.cpp */; };
+                FE699872192087E7006936BD /* FloatingPointEnvironment.h in Headers */ = {isa = PBXBuildFile; fileRef = FE699870192087E7006936BD /* FloatingPointEnvironment.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 FE6F6AAF169E057500FC30A2 /* DatabaseBackendContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE6F6AAD169E057500FC30A2 /* DatabaseBackendContext.cpp */; };
</span><span class="cx">                 FE6F6AB0169E057500FC30A2 /* DatabaseBackendContext.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6F6AAE169E057500FC30A2 /* DatabaseBackendContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 FE6FD48D0F676E9300092873 /* JSCoordinates.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE6FD48B0F676E9300092873 /* JSCoordinates.cpp */; };
</span><span class="lines">@@ -14025,6 +14027,8 @@
</span><span class="cx">                 FE4AADEC16D2C37400026FFC /* AbstractSQLStatement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AbstractSQLStatement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FE4AADED16D2C37400026FFC /* AbstractSQLStatementBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AbstractSQLStatementBackend.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FE6938B51045D67E008EABB6 /* EventHandlerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EventHandlerIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                FE69986F192087E7006936BD /* FloatingPointEnvironment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FloatingPointEnvironment.cpp; path = ios/wak/FloatingPointEnvironment.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                FE699870192087E7006936BD /* FloatingPointEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FloatingPointEnvironment.h; path = ios/wak/FloatingPointEnvironment.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 FE6F6AAD169E057500FC30A2 /* DatabaseBackendContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatabaseBackendContext.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FE6F6AAE169E057500FC30A2 /* DatabaseBackendContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseBackendContext.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FE6FD48B0F676E9300092873 /* JSCoordinates.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCoordinates.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -18142,6 +18146,8 @@
</span><span class="cx">                 A148328B187F506800DA63A6 /* wak */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                FE69986F192087E7006936BD /* FloatingPointEnvironment.cpp */,
+                                FE699870192087E7006936BD /* FloatingPointEnvironment.h */,
</ins><span class="cx">                                 A148328C187F508700DA63A6 /* WAKAppKitStubs.h */,
</span><span class="cx">                                 A148328D187F508700DA63A6 /* WAKAppKitStubs.m */,
</span><span class="cx">                                 A148328E187F508700DA63A6 /* WAKClipView.h */,
</span><span class="lines">@@ -22965,6 +22971,7 @@
</span><span class="cx">                         isa = PBXHeadersBuildPhase;
</span><span class="cx">                         buildActionMask = 2147483647;
</span><span class="cx">                         files = (
</span><ins>+                                FE699872192087E7006936BD /* FloatingPointEnvironment.h in Headers */,
</ins><span class="cx">                                 E1D31CDD19196020001005A3 /* BlobDataFileReference.h in Headers */,
</span><span class="cx">                                 FE115FAB167988CD00249134 /* AbstractDatabaseServer.h in Headers */,
</span><span class="cx">                                 CD2F4A2418D89F700063746D /* AudioHardwareListener.h in Headers */,
</span><span class="lines">@@ -25073,7 +25080,7 @@
</span><span class="cx">                                 A9C6E5A60D746458006442E9 /* Navigator.h in Headers */,
</span><span class="cx">                                 E12719C70EEEC16800F61213 /* NavigatorBase.h in Headers */,
</span><span class="cx">                                 9711460414EF009A00674FD9 /* NavigatorGeolocation.h in Headers */,
</span><del>-                                078E091A17D14D1C00420AA1 /* NavigatorMediaStream.h in Headers */,
</del><ins>+                                078E091A17D14D1C00420AA1 /* NavigatorUserMedia.h in Headers */,
</ins><span class="cx">                                 078E091B17D14D1C00420AA1 /* NavigatorUserMediaError.h in Headers */,
</span><span class="cx">                                 078E091C17D14D1C00420AA1 /* NavigatorUserMediaErrorCallback.h in Headers */,
</span><span class="cx">                                 078E091D17D14D1C00420AA1 /* NavigatorUserMediaSuccessCallback.h in Headers */,
</span><span class="lines">@@ -27539,6 +27546,7 @@
</span><span class="cx">                                 A8EA7CAC0A192B9C00A8EF5F /* HTMLMarqueeElement.cpp in Sources */,
</span><span class="cx">                                 0F43C85F189E15A600019AE2 /* JSPerformanceTiming.cpp in Sources */,
</span><span class="cx">                                 E44613A40CD6331000FADA75 /* HTMLMediaElement.cpp in Sources */,
</span><ins>+                                FE699871192087E7006936BD /* FloatingPointEnvironment.cpp in Sources */,
</ins><span class="cx">                                 0779BF0D18453168000B6AE7 /* HTMLMediaElementMediaStream.cpp in Sources */,
</span><span class="cx">                                 07FE99DC18807A7D00256648 /* HTMLMediaSession.cpp in Sources */,
</span><span class="cx">                                 A8EA79F80A1916DF00A8EF5F /* HTMLMenuElement.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformioswakFloatingPointEnvironmentcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/ios/wak/FloatingPointEnvironment.cpp (0 => 168676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/wak/FloatingPointEnvironment.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/wak/FloatingPointEnvironment.cpp        2014-05-13 06:40:08 UTC (rev 168676)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+/*
+ * Copyright (C) 2014 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;FloatingPointEnvironment.h&quot;
+
+#include &lt;wtf/MainThread.h&gt;
+#include &lt;wtf/NeverDestroyed.h&gt;
+
+#if PLATFORM(IOS)
+
+namespace WebCore {
+
+FloatingPointEnvironment&amp; FloatingPointEnvironment::shared()
+{
+    static NeverDestroyed&lt;FloatingPointEnvironment&gt; floatingPointEnvironment;
+    return floatingPointEnvironment;
+}
+
+FloatingPointEnvironment::FloatingPointEnvironment()
+    : m_isInitialized(false)
+{
+}
+
+void FloatingPointEnvironment::enableDenormalSupport()
+{
+    RELEASE_ASSERT(isUIThread());
+#if defined _ARM_ARCH_7
+    fenv_t env; 
+    fegetenv(&amp;env); 
+    env.__fpscr &amp;= ~0x01000000U;
+    fesetenv(&amp;env); 
+#endif
+    // Supporting denormal mode is already the default on x86, x86_64, and ARM64.
+}
+
+void FloatingPointEnvironment::saveMainThreadEnvironment()
+{
+    RELEASE_ASSERT(!m_isInitialized);
+    RELEASE_ASSERT(isUIThread());
+    fegetenv(&amp;m_mainThreadEnvironment);
+    m_isInitialized = true;
+}
+
+void FloatingPointEnvironment::propagateMainThreadEnvironment()
+{
+    RELEASE_ASSERT(m_isInitialized);
+    RELEASE_ASSERT(!isUIThread());
+    fesetenv(&amp;m_mainThreadEnvironment);
+}
+
+} // namespace WebCore
+
+#endif // PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformioswakFloatingPointEnvironmenth"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/ios/wak/FloatingPointEnvironment.h (0 => 168676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/wak/FloatingPointEnvironment.h                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/wak/FloatingPointEnvironment.h        2014-05-13 06:40:08 UTC (rev 168676)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * Copyright (C) 2014 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. 
+ */
+
+#ifndef FloatingPointEnvironment_h
+#define FloatingPointEnvironment_h
+
+#if TARGET_OS_IPHONE
+
+#import &lt;fenv.h&gt;
+
+namespace WebCore {
+
+class FloatingPointEnvironment {
+public:
+    FloatingPointEnvironment();
+
+    void enableDenormalSupport();
+    void saveMainThreadEnvironment();
+    void propagateMainThreadEnvironment();
+
+    static FloatingPointEnvironment&amp; shared();
+
+private:
+
+    fenv_t m_mainThreadEnvironment;
+    bool m_isInitialized;
+};
+
+} // namespace WebCore
+
+using WebCore::FloatingPointEnvironment;
+
+#endif // TARGET_OS_IPHONE
+
+#endif // FloatingPointEnvironment_h
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformioswakWebCoreThreadh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/wak/WebCoreThread.h (168675 => 168676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/wak/WebCoreThread.h        2014-05-13 06:14:17 UTC (rev 168675)
+++ trunk/Source/WebCore/platform/ios/wak/WebCoreThread.h        2014-05-13 06:40:08 UTC (rev 168676)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> #if TARGET_OS_IPHONE
</span><span class="cx"> 
</span><span class="cx"> #import &lt;CoreGraphics/CoreGraphics.h&gt;
</span><del>-#import &lt;fenv.h&gt;
</del><span class="cx"> 
</span><span class="cx"> #if defined(__cplusplus)
</span><span class="cx"> extern &quot;C&quot; {
</span><span class="lines">@@ -41,8 +40,6 @@
</span><span class="cx">     
</span><span class="cx"> extern volatile bool webThreadShouldYield;
</span><span class="cx"> 
</span><del>-extern fenv_t mainThreadFEnv;
-
</del><span class="cx"> #ifdef __OBJC__
</span><span class="cx"> @class NSRunLoop;
</span><span class="cx"> #else
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformioswakWebCoreThreadmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/wak/WebCoreThread.mm (168675 => 168676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/wak/WebCoreThread.mm        2014-05-13 06:14:17 UTC (rev 168675)
+++ trunk/Source/WebCore/platform/ios/wak/WebCoreThread.mm        2014-05-13 06:40:08 UTC (rev 168676)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> 
</span><ins>+#import &quot;FloatingPointEnvironment.h&quot;
</ins><span class="cx"> #import &quot;JSDOMWindowBase.h&quot;
</span><span class="cx"> #import &quot;ThreadGlobalData.h&quot;
</span><span class="cx"> #import &quot;RuntimeApplicationChecksIOS.h&quot;
</span><span class="lines">@@ -101,7 +102,6 @@
</span><span class="cx"> static BOOL isWebThreadLocked;
</span><span class="cx"> static BOOL webThreadStarted;
</span><span class="cx"> static unsigned webThreadLockCount;
</span><del>-fenv_t mainThreadFEnv;
</del><span class="cx"> 
</span><span class="cx"> static NSAutoreleasePoolMark savedAutoreleasePoolMark;
</span><span class="cx"> static BOOL isNestedWebThreadRunLoop;
</span><span class="lines">@@ -643,8 +643,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> void *RunWebThread(void *arg)
</span><span class="cx"> {
</span><del>-    // Propagate the mainThread's fenv to the web thread.
-    fesetenv(&amp;mainThreadFEnv);
</del><ins>+    FloatingPointEnvironment::shared().propagateMainThreadEnvironment();
</ins><span class="cx"> 
</span><span class="cx">     UNUSED_PARAM(arg);
</span><span class="cx">     // WTF::initializeMainThread() needs to be called before JSC::initializeThreading() since the
</span><span class="lines">@@ -759,7 +758,7 @@
</span><span class="cx">     ASSERT_WITH_MESSAGE(result == 0, &quot;startup lock failed with code:%d&quot;, result);
</span><span class="cx"> 
</span><span class="cx">     // Propagate the mainThread's fenv to workers &amp; the web thread.
</span><del>-    fegetenv(&amp;mainThreadFEnv);
</del><ins>+    FloatingPointEnvironment::shared().saveMainThreadEnvironment();
</ins><span class="cx"> 
</span><span class="cx">     pthread_create(&amp;webThread, &amp;tattr, RunWebThread, NULL);
</span><span class="cx">     pthread_attr_destroy(&amp;tattr);
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersWorkerThreadcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/WorkerThread.cpp (168675 => 168676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/WorkerThread.cpp        2014-05-13 06:14:17 UTC (rev 168675)
+++ trunk/Source/WebCore/workers/WorkerThread.cpp        2014-05-13 06:40:08 UTC (rev 168676)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><ins>+#include &quot;FloatingPointEnvironment.h&quot;
</ins><span class="cx"> #include &quot;WebCoreThread.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -153,7 +154,7 @@
</span><span class="cx"> {
</span><span class="cx">     // Propagate the mainThread's fenv to workers.
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    fesetenv(&amp;mainThreadFEnv);
</del><ins>+    FloatingPointEnvironment::shared().propagateMainThreadEnvironment();
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (168675 => 168676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-05-13 06:14:17 UTC (rev 168675)
+++ trunk/Source/WebKit2/ChangeLog        2014-05-13 06:40:08 UTC (rev 168676)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-05-12  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        WebKit2 on iOS needs to capture the main thread's floating point environment.
+        &lt;https://webkit.org/b/132755&gt;
+
+        Reviewed by Geoffrey Garen.
+
+        * Shared/mac/ChildProcessMac.mm:
+        (WebKit::ChildProcess::platformInitialize):
+        - Call FloatingPointEnv::enableNeededFloatingPointModes() to initialize
+          the ARMv7 FP env to support denormalized numbers.
+        - Call FloatingPointEnv::saveMainThreadEnvironment() to capture the main thread
+          fp env.
+
</ins><span class="cx"> 2014-05-12  Gyuyoung Kim  &lt;gyuyoung.kim@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL][WK2] Fix ewk_view_navigation test in EWK2ViewTest 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacChildProcessMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm (168675 => 168676)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm        2014-05-13 06:14:17 UTC (rev 168675)
+++ trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm        2014-05-13 06:40:08 UTC (rev 168676)
</span><span class="lines">@@ -36,6 +36,10 @@
</span><span class="cx"> #import &lt;stdlib.h&gt;
</span><span class="cx"> #import &lt;sysexits.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &lt;WebCore/FloatingPointEnvironment.h&gt;
+#endif
+
</ins><span class="cx"> // We have to #undef __APPLE_API_PRIVATE to prevent sandbox.h from looking for a header file that does not exist (&lt;rdar://problem/9679211&gt;). 
</span><span class="cx"> #undef __APPLE_API_PRIVATE
</span><span class="cx"> #import &lt;sandbox.h&gt;
</span><span class="lines">@@ -89,6 +93,11 @@
</span><span class="cx"> #if !PLATFORM(IOS) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
</span><span class="cx">     initializeTimerCoalescingPolicy();
</span><span class="cx"> #endif
</span><ins>+#if PLATFORM(IOS)
+    FloatingPointEnvironment&amp; floatingPointEnvironment = FloatingPointEnvironment::shared();
+    floatingPointEnvironment.enableDenormalSupport();
+    floatingPointEnvironment.saveMainThreadEnvironment();
+#endif
</ins><span class="cx"> 
</span><span class="cx">     [[NSFileManager defaultManager] changeCurrentDirectoryPath:[[NSBundle mainBundle] bundlePath]];
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>