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