Changeset 168676 in webkit


Ignore:
Timestamp:
May 12, 2014 11:40:08 PM (10 years ago)
Author:
mark.lam@apple.com
Message:

WebKit2 on iOS needs to capture the main thread's floating point environment.
<https://webkit.org/b/132755>

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 "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):

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.
Location:
trunk
Files:
8 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r168674 r168676  
     12014-05-12  Mark Lam  <mark.lam@apple.com>
     2
     3        WebKit2 on iOS needs to capture the main thread's floating point environment.
     4        <https://webkit.org/b/132755>
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * fast/workers/resources/worker-floating-point.js: Added.
     9        (runTest1):
     10        (doDiv):
     11        (runTest2):
     12        * fast/workers/worker-floating-point-expected.txt: Added.
     13        * fast/workers/worker-floating-point.html: Added.
     14        * js/floating-point-denormalized-expected.txt: Added.
     15        * js/floating-point-denormalized.html: Added.
     16        * js/script-tests/floating-point-denormalized.js: Added.
     17
    1182014-05-12  Dirk Schulze  <krit@webkit.org>
    219
  • trunk/Source/WebCore/ChangeLog

    r168674 r168676  
     12014-05-12  Mark Lam  <mark.lam@apple.com>
     2
     3        WebKit2 on iOS needs to capture the main thread's floating point environment.
     4        <https://webkit.org/b/132755>
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        For iOS, WorkerThread::workerThread() expects to be able to initialize the
     9        worker thread's floating point environment to be the same as the one in the
     10        main thread.  The FP env of the main thread is expected to have been captured
     11        in the mainThreadFEnv global.  On WebKit2 for iOS, we neglected to initialize
     12        mainThreadFEnv.
     13
     14        We now introduce a FloatingPointEnvironment class that will encapsulate the main
     15        thread (aka "UIThread") fenv, and we'll call FloatingPointEnv::saveMainThreadEnvironment()
     16        from ChildProcess::platformInitialize() to ensure that the FloatingPointEnvironment
     17        singleton instance is initialized properly for WebKit2.
     18
     19        In the ChildProcess::platformInitialize(), we also need to initialize the ARMv7
     20        FP env to support denormalized numbers.  We'll do this before calling
     21        saveMainThreadEnvironment().
     22
     23        Tests: fast/workers/worker-floating-point.html
     24               js/floating-point-denormalized.html
     25
     26        * WebCore.exp.in:
     27        * WebCore.xcodeproj/project.pbxproj:
     28        * platform/ios/wak/FloatingPointEnvironment.cpp: Added.
     29        (WebCore::FloatingPointEnvironment::env):
     30        (WebCore::FloatingPointEnvironment::FloatingPointEnvironment):
     31        (WebCore::FloatingPointEnvironment::enableDenormalSupport):
     32        (WebCore::FloatingPointEnvironment::saveMainThreadEnvironment):
     33        (WebCore::FloatingPointEnvironment::propagateMainThreadEnvironment):
     34        * platform/ios/wak/FloatingPointEnvironment.h: Added.
     35        * platform/ios/wak/WebCoreThread.h:
     36        * platform/ios/wak/WebCoreThread.mm:
     37        (RunWebThread):
     38        (StartWebThread):
     39        * workers/WorkerThread.cpp:
     40        (WebCore::WorkerThread::workerThread):
     41
    1422014-05-12  Dirk Schulze  <krit@webkit.org>
    243
  • trunk/Source/WebCore/WebCore.exp.in

    r168668 r168676  
    25832583__ZN7WebCore23characterBeforePositionERKNS_15VisiblePositionE
    25842584__ZN7WebCore24DocumentMarkerController14markersInRangeEPNS_5RangeENS_14DocumentMarker11MarkerTypesE
     2585__ZN7WebCore24FloatingPointEnvironment21enableDenormalSupportEv
     2586__ZN7WebCore24FloatingPointEnvironment25saveMainThreadEnvironmentEv
     2587__ZN7WebCore24FloatingPointEnvironment6sharedEv
    25852588__ZN7WebCore24acquireLineBreakIteratorEN3WTF10StringViewERKNS0_12AtomicStringEPKtj
    25862589__ZN7WebCore24createTemporaryDirectoryEP8NSString
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r168647 r168676  
    65466546                FE4AADEF16D2C37400026FFC /* AbstractSQLStatementBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = FE4AADED16D2C37400026FFC /* AbstractSQLStatementBackend.h */; settings = {ATTRIBUTES = (Private, ); }; };
    65476547                FE6938B61045D67E008EABB6 /* EventHandlerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = FE6938B51045D67E008EABB6 /* EventHandlerIOS.mm */; };
     6548                FE699871192087E7006936BD /* FloatingPointEnvironment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE69986F192087E7006936BD /* FloatingPointEnvironment.cpp */; };
     6549                FE699872192087E7006936BD /* FloatingPointEnvironment.h in Headers */ = {isa = PBXBuildFile; fileRef = FE699870192087E7006936BD /* FloatingPointEnvironment.h */; settings = {ATTRIBUTES = (Private, ); }; };
    65486550                FE6F6AAF169E057500FC30A2 /* DatabaseBackendContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE6F6AAD169E057500FC30A2 /* DatabaseBackendContext.cpp */; };
    65496551                FE6F6AB0169E057500FC30A2 /* DatabaseBackendContext.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6F6AAE169E057500FC30A2 /* DatabaseBackendContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    1402614028                FE4AADED16D2C37400026FFC /* AbstractSQLStatementBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AbstractSQLStatementBackend.h; sourceTree = "<group>"; };
    1402714029                FE6938B51045D67E008EABB6 /* EventHandlerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EventHandlerIOS.mm; sourceTree = "<group>"; };
     14030                FE69986F192087E7006936BD /* FloatingPointEnvironment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FloatingPointEnvironment.cpp; path = ios/wak/FloatingPointEnvironment.cpp; sourceTree = "<group>"; };
     14031                FE699870192087E7006936BD /* FloatingPointEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FloatingPointEnvironment.h; path = ios/wak/FloatingPointEnvironment.h; sourceTree = "<group>"; };
    1402814032                FE6F6AAD169E057500FC30A2 /* DatabaseBackendContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatabaseBackendContext.cpp; sourceTree = "<group>"; };
    1402914033                FE6F6AAE169E057500FC30A2 /* DatabaseBackendContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseBackendContext.h; sourceTree = "<group>"; };
     
    1814318147                        isa = PBXGroup;
    1814418148                        children = (
     18149                                FE69986F192087E7006936BD /* FloatingPointEnvironment.cpp */,
     18150                                FE699870192087E7006936BD /* FloatingPointEnvironment.h */,
    1814518151                                A148328C187F508700DA63A6 /* WAKAppKitStubs.h */,
    1814618152                                A148328D187F508700DA63A6 /* WAKAppKitStubs.m */,
     
    2296622972                        buildActionMask = 2147483647;
    2296722973                        files = (
     22974                                FE699872192087E7006936BD /* FloatingPointEnvironment.h in Headers */,
    2296822975                                E1D31CDD19196020001005A3 /* BlobDataFileReference.h in Headers */,
    2296922976                                FE115FAB167988CD00249134 /* AbstractDatabaseServer.h in Headers */,
     
    2507425081                                E12719C70EEEC16800F61213 /* NavigatorBase.h in Headers */,
    2507525082                                9711460414EF009A00674FD9 /* NavigatorGeolocation.h in Headers */,
    25076                                 078E091A17D14D1C00420AA1 /* NavigatorMediaStream.h in Headers */,
     25083                                078E091A17D14D1C00420AA1 /* NavigatorUserMedia.h in Headers */,
    2507725084                                078E091B17D14D1C00420AA1 /* NavigatorUserMediaError.h in Headers */,
    2507825085                                078E091C17D14D1C00420AA1 /* NavigatorUserMediaErrorCallback.h in Headers */,
     
    2754027547                                0F43C85F189E15A600019AE2 /* JSPerformanceTiming.cpp in Sources */,
    2754127548                                E44613A40CD6331000FADA75 /* HTMLMediaElement.cpp in Sources */,
     27549                                FE699871192087E7006936BD /* FloatingPointEnvironment.cpp in Sources */,
    2754227550                                0779BF0D18453168000B6AE7 /* HTMLMediaElementMediaStream.cpp in Sources */,
    2754327551                                07FE99DC18807A7D00256648 /* HTMLMediaSession.cpp in Sources */,
  • trunk/Source/WebCore/platform/ios/wak/WebCoreThread.h

    r161603 r168676  
    3030
    3131#import <CoreGraphics/CoreGraphics.h>
    32 #import <fenv.h>
    3332
    3433#if defined(__cplusplus)
     
    4140   
    4241extern volatile bool webThreadShouldYield;
    43 
    44 extern fenv_t mainThreadFEnv;
    4542
    4643#ifdef __OBJC__
  • trunk/Source/WebCore/platform/ios/wak/WebCoreThread.mm

    r165662 r168676  
    2929#if PLATFORM(IOS)
    3030
     31#import "FloatingPointEnvironment.h"
    3132#import "JSDOMWindowBase.h"
    3233#import "ThreadGlobalData.h"
     
    102103static BOOL webThreadStarted;
    103104static unsigned webThreadLockCount;
    104 fenv_t mainThreadFEnv;
    105105
    106106static NSAutoreleasePoolMark savedAutoreleasePoolMark;
     
    644644void *RunWebThread(void *arg)
    645645{
    646     // Propagate the mainThread's fenv to the web thread.
    647     fesetenv(&mainThreadFEnv);
     646    FloatingPointEnvironment::shared().propagateMainThreadEnvironment();
    648647
    649648    UNUSED_PARAM(arg);
     
    760759
    761760    // Propagate the mainThread's fenv to workers & the web thread.
    762     fegetenv(&mainThreadFEnv);
     761    FloatingPointEnvironment::shared().saveMainThreadEnvironment();
    763762
    764763    pthread_create(&webThread, &tattr, RunWebThread, NULL);
  • trunk/Source/WebCore/workers/WorkerThread.cpp

    r168600 r168676  
    4646
    4747#if PLATFORM(IOS)
     48#include "FloatingPointEnvironment.h"
    4849#include "WebCoreThread.h"
    4950#endif
     
    154155    // Propagate the mainThread's fenv to workers.
    155156#if PLATFORM(IOS)
    156     fesetenv(&mainThreadFEnv);
     157    FloatingPointEnvironment::shared().propagateMainThreadEnvironment();
    157158#endif
    158159
  • trunk/Source/WebKit2/ChangeLog

    r168675 r168676  
     12014-05-12  Mark Lam  <mark.lam@apple.com>
     2
     3        WebKit2 on iOS needs to capture the main thread's floating point environment.
     4        <https://webkit.org/b/132755>
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * Shared/mac/ChildProcessMac.mm:
     9        (WebKit::ChildProcess::platformInitialize):
     10        - Call FloatingPointEnv::enableNeededFloatingPointModes() to initialize
     11          the ARMv7 FP env to support denormalized numbers.
     12        - Call FloatingPointEnv::saveMainThreadEnvironment() to capture the main thread
     13          fp env.
     14
    1152014-05-12  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    216
  • trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm

    r166047 r168676  
    3737#import <sysexits.h>
    3838
     39#if PLATFORM(IOS)
     40#import <WebCore/FloatingPointEnvironment.h>
     41#endif
     42
    3943// We have to #undef __APPLE_API_PRIVATE to prevent sandbox.h from looking for a header file that does not exist (<rdar://problem/9679211>).
    4044#undef __APPLE_API_PRIVATE
     
    8993#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
    9094    initializeTimerCoalescingPolicy();
     95#endif
     96#if PLATFORM(IOS)
     97    FloatingPointEnvironment& floatingPointEnvironment = FloatingPointEnvironment::shared();
     98    floatingPointEnvironment.enableDenormalSupport();
     99    floatingPointEnvironment.saveMainThreadEnvironment();
    91100#endif
    92101
Note: See TracChangeset for help on using the changeset viewer.