Enable ParallelJobs by default
authorkbalazs@webkit.org <kbalazs@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Dec 2011 14:30:16 +0000 (14:30 +0000)
committerkbalazs@webkit.org <kbalazs@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Dec 2011 14:30:16 +0000 (14:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=70032

Reviewed by Zoltan Herczeg.

Source/JavaScriptCore:

Relanding with typo fix.

According to measurements on Mac and Linux it is a
considerable speedup for SVG on multicore.

Remove the ENABLE(PARALLEL_JOBS) guard.
Fix build on Windows and Chromium.

* JavaScriptCore.gypi:  Add the files to the build. It was
missing for the gyp build system.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
Export symbols.
* wtf/ParallelJobs.h:
* wtf/ParallelJobsGeneric.cpp:
(WTF::ParallelEnvironment::ParallelEnvironment):
(WTF::ParallelEnvironment::execute):
Deinline these to avoid exporting a lot of symbols.
These are non-trivial and called only once on a given object
so it doesn't seems to be worthwile to inline them.
Additionally fix a signed-unsigned comparison in the constructor.
* wtf/ParallelJobsGeneric.h:
* wtf/Platform.h:

Source/WebCore:

Covered by existing tests.

According to measurements on Mac and Linux it is a
considerable speedup for SVG on multicore.

Remove the ENABLE(PARALLEL_JOBS) guard. Fix the Windows build
by qualifying ParallelJobs with the WTF namespace (otherwise
MSVC believes it belongs to WebCore which is likely a compiler bug).

* platform/graphics/filters/FEConvolveMatrix.cpp:
(WebCore::FEConvolveMatrix::setInteriorPixelsWorker):
(WebCore::FEConvolveMatrix::platformApplySoftware):
* platform/graphics/filters/FEConvolveMatrix.h:
* platform/graphics/filters/FEGaussianBlur.cpp:
(WebCore::FEGaussianBlur::platformApplyWorker):
(WebCore::FEGaussianBlur::platformApply):
* platform/graphics/filters/FEGaussianBlur.h:
* platform/graphics/filters/FELighting.cpp:
(WebCore::FELighting::platformApplyGenericWorker):
(WebCore::FELighting::platformApplyGeneric):
* platform/graphics/filters/FELighting.h:
* platform/graphics/filters/FEMorphology.cpp:
(WebCore::FEMorphology::platformApplyWorker):
(WebCore::FEMorphology::platformApply):
* platform/graphics/filters/FEMorphology.h:
* platform/graphics/filters/FETurbulence.cpp:
(WebCore::FETurbulence::fillRegionWorker):
(WebCore::FETurbulence::platformApplySoftware):
* platform/graphics/filters/FETurbulence.h:
* platform/graphics/filters/arm/FELightingNEON.cpp:
(WebCore::FELighting::platformApplyNeonWorker):
* platform/graphics/filters/arm/FELightingNEON.h:
(WebCore::FELighting::platformApplyNeon):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@102132 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.gypi
Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
Source/JavaScriptCore/wtf/ParallelJobs.h
Source/JavaScriptCore/wtf/ParallelJobsGeneric.cpp
Source/JavaScriptCore/wtf/ParallelJobsGeneric.h
Source/JavaScriptCore/wtf/Platform.h
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp
Source/WebCore/platform/graphics/filters/FEConvolveMatrix.h
Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp
Source/WebCore/platform/graphics/filters/FEGaussianBlur.h
Source/WebCore/platform/graphics/filters/FELighting.cpp
Source/WebCore/platform/graphics/filters/FELighting.h
Source/WebCore/platform/graphics/filters/FEMorphology.cpp
Source/WebCore/platform/graphics/filters/FEMorphology.h
Source/WebCore/platform/graphics/filters/FETurbulence.cpp
Source/WebCore/platform/graphics/filters/FETurbulence.h
Source/WebCore/platform/graphics/filters/arm/FELightingNEON.cpp
Source/WebCore/platform/graphics/filters/arm/FELightingNEON.h

index b04e2fd..e64b8fd 100644 (file)
@@ -1,3 +1,31 @@
+2011-11-21  Balazs Kelemen  <kbalazs@webkit.org>
+
+        Enable ParallelJobs by default
+        https://bugs.webkit.org/show_bug.cgi?id=70032
+
+        Reviewed by Zoltan Herczeg.
+
+        According to measurements on Mac and Linux it is a
+        considerable speedup for SVG on multicore.
+
+        Remove the ENABLE(PARALLEL_JOBS) guard.
+        Fix build on Windows and Chromium.
+
+        * JavaScriptCore.gypi:  Add the files to the build. It was
+        missing for the gyp build system.
+        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+        Export symbols.
+        * wtf/ParallelJobs.h:
+        * wtf/ParallelJobsGeneric.cpp:
+        (WTF::ParallelEnvironment::ParallelEnvironment):
+        (WTF::ParallelEnvironment::execute):
+        Deinline these to avoid exporting a lot of symbols.
+        These are non-trivial and called only once on a given object
+        so it doesn't seems to be worthwile to inline them.
+        Additionally fix a signed-unsigned comparison in the constructor.
+        * wtf/ParallelJobsGeneric.h:
+        * wtf/Platform.h:
+
 2011-12-06  Simon Hausmann  <simon.hausmann@nokia.com>
 
         [Qt] build-jsc script doesn't work
index 72c1e22..7f148fb 100644 (file)
             'wtf/OSRandomSource.h',
             'wtf/PageAllocationAligned.cpp',
             'wtf/PageBlock.cpp',
+            'wtf/ParallelJobs.h',
+            'wtf/ParallelJobsGeneric.cpp',
+            'wtf/ParallelJobsGeneric.h',
+            'wtf/ParallelJobsLibdispatch.h',
+            'wtf/ParallelJobsOpenMP.h',
             'wtf/RandomNumber.cpp',
             'wtf/RandomNumberSeed.h',
             'wtf/RefCountedLeakCounter.cpp',
index 4990f38..7c52f5d 100644 (file)
@@ -14,6 +14,7 @@ EXPORTS
     ??0JSLock@JSC@@QAE@PAVExecState@1@@Z
     ??0MD5@WTF@@QAE@XZ
     ??0Mutex@WTF@@QAE@XZ
+    ??0ParallelEnvironment@WTF@@QAE@P6AXPAX@ZIH@Z
     ??0RefCountedLeakCounter@WTF@@QAE@PBD@Z
     ??0RegExpObject@JSC@@IAE@PAVJSGlobalObject@1@PAVStructure@1@PAVRegExp@1@@Z
     ??0SHA1@WTF@@QAE@XZ
@@ -130,6 +131,7 @@ EXPORTS
     ?currentThread@WTF@@YAIXZ
     ?currentThreadIsHoldingLock@JSLock@JSC@@SA_NXZ
     ?currentTime@WTF@@YANXZ
+       ?execute@ParallelEnvironment@WTF@@QAEXPAX@Z
     ?data@CString@WTF@@QBEPBDXZ
     ?dateToDaysFrom1970@WTF@@YANHHH@Z
     ?dayInMonthFromDayInYear@WTF@@YAHH_N@Z
index 77b51c2..92b9c5b 100644 (file)
 #include "RefPtr.h"
 #include <wtf/Vector.h>
 
-#if ENABLE(PARALLEL_JOBS)
-
 // Usage:
 //
-// #if ENABLE(PARALLEL_JOBS)
-//
 //     // Initialize parallel jobs
 //     ParallelJobs<TypeOfParameter> parallelJobs(&worker [, requestedNumberOfJobs]);
 //
 //     // Execute parallel jobs
 //     parallelJobs.execute();
 //
-// #else
-//
-//     inlineFunction(args...);
-//
-// #endif // ENABLE(PARALLEL_JOBS)
 
 #if ENABLE(THREADING_GENERIC)
 #include "ParallelJobsGeneric.h"
@@ -111,6 +102,4 @@ private:
 
 using WTF::ParallelJobs;
 
-#endif // ENABLE(PARALLEL_JOBS)
-
 #endif // ParallelJobs_h
index 7677427..12eaf4e 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "config.h"
 
-#if ENABLE(PARALLEL_JOBS) && ENABLE(THREADING_GENERIC)
+#if ENABLE(THREADING_GENERIC)
 
 #include "ParallelJobs.h"
 #include "UnusedParam.h"
@@ -38,7 +38,7 @@
 #elif OS(LINUX) || OS(AIX) || OS(SOLARIS)
 #include <unistd.h>
 #elif OS(WINDOWS)
-#include <Windows.h>
+#include <windows.h>
 #endif
 
 namespace WTF {
@@ -47,6 +47,52 @@ Vector< RefPtr<ParallelEnvironment::ThreadPrivate> >* ParallelEnvironment::s_thr
 
 int ParallelEnvironment::s_maxNumberOfParallelThreads = -1;
 
+ParallelEnvironment::ParallelEnvironment(ThreadFunction threadFunction, size_t sizeOfParameter, int requestedJobNumber) :
+    m_threadFunction(threadFunction),
+    m_sizeOfParameter(sizeOfParameter)
+{
+    ASSERT_ARG(requestedJobNumber, requestedJobNumber >= 1);
+
+    if (s_maxNumberOfParallelThreads == -1)
+        determineMaxNumberOfParallelThreads();
+
+    if (!requestedJobNumber || requestedJobNumber > s_maxNumberOfParallelThreads)
+        requestedJobNumber = static_cast<unsigned>(s_maxNumberOfParallelThreads);
+
+    if (!s_threadPool)
+        s_threadPool = new Vector< RefPtr<ThreadPrivate> >();
+
+    // The main thread should be also a worker.
+    int maxNumberOfNewThreads = requestedJobNumber - 1;
+
+    for (int i = 0; i < s_maxNumberOfParallelThreads && m_threads.size() < static_cast<unsigned>(maxNumberOfNewThreads); ++i) {
+        if (s_threadPool->size() < i + 1)
+            s_threadPool->append(ThreadPrivate::create());
+
+        if ((*s_threadPool)[i]->tryLockFor(this))
+            m_threads.append((*s_threadPool)[i]);
+    }
+
+    m_numberOfJobs = m_threads.size() + 1;
+}
+
+void ParallelEnvironment::execute(void* parameters)
+{
+    unsigned char* currentParameter = static_cast<unsigned char*>(parameters);
+    size_t i;
+    for (i = 0; i < m_threads.size(); ++i) {
+        m_threads[i]->execute(m_threadFunction, currentParameter);
+        currentParameter += m_sizeOfParameter;
+    }
+
+    // The work for the main thread.
+    (*m_threadFunction)(currentParameter);
+
+    // Wait until all jobs are done.
+    for (i = 0; i < m_threads.size(); ++i)
+        m_threads[i]->waitForFinish();
+}
+
 void ParallelEnvironment::determineMaxNumberOfParallelThreads()
 {
     const int defaultIfUnavailable = 2;
@@ -132,5 +178,4 @@ void* ParallelEnvironment::ThreadPrivate::workerThread(void* threadData)
 }
 
 } // namespace WTF
-
-#endif // ENABLE(PARALLEL_JOBS) && ENABLE(THREADING_GENERIC)
+#endif // ENABLE(THREADING_GENERIC)
index e7d2441..dab6dd9 100644 (file)
@@ -40,55 +40,14 @@ class ParallelEnvironment {
 public:
     typedef void (*ThreadFunction)(void*);
 
-    ParallelEnvironment(ThreadFunction threadFunction, size_t sizeOfParameter, int requestedJobNumber) :
-        m_threadFunction(threadFunction),
-        m_sizeOfParameter(sizeOfParameter)
-    {
-        ASSERT_ARG(requestedJobNumber, requestedJobNumber >= 1);
-
-        if (s_maxNumberOfParallelThreads == -1)
-            determineMaxNumberOfParallelThreads();
-
-        if (!requestedJobNumber || requestedJobNumber > s_maxNumberOfParallelThreads)
-            requestedJobNumber = static_cast<unsigned>(s_maxNumberOfParallelThreads);
-
-        if (!s_threadPool)
-            s_threadPool = new Vector< RefPtr<ThreadPrivate> >();
-
-        // The main thread should be also a worker.
-        int maxNumberOfNewThreads = requestedJobNumber - 1;
-
-        for (int i = 0; i < s_maxNumberOfParallelThreads && m_threads.size() < maxNumberOfNewThreads; ++i) {
-            if (s_threadPool->size() < i + 1)
-                s_threadPool->append(ThreadPrivate::create());
-
-            if ((*s_threadPool)[i]->tryLockFor(this))
-                m_threads.append((*s_threadPool)[i]);
-        }
-
-        m_numberOfJobs = m_threads.size() + 1;
-    }
+    ParallelEnvironment(ThreadFunction, size_t sizeOfParameter, int requestedJobNumber);
 
     int numberOfJobs()
     {
         return m_numberOfJobs;
     }
 
-    void execute(unsigned char* parameters)
-    {
-        size_t i;
-        for (i = 0; i < m_threads.size(); ++i) {
-            m_threads[i]->execute(m_threadFunction, parameters);
-            parameters += m_sizeOfParameter;
-        }
-
-        // The work for the main thread
-        (*m_threadFunction)(parameters);
-
-        // Wait until all jobs are done.
-        for (i = 0; i < m_threads.size(); ++i)
-            m_threads[i]->waitForFinish();
-    }
+    void execute(void* parameters);
 
     class ThreadPrivate : public RefCounted<ThreadPrivate> {
     public:
index be0c64e..8fa6bb5 100644 (file)
 #define ENABLE_BRANCH_COMPACTION 1
 #endif
 
-#if !defined(ENABLE_THREADING_OPENMP) && defined(_OPENMP)
+#if !defined(ENABLE_THREADING_LIBDISPATCH) && HAVE(DISPATCH_H)
+#define ENABLE_THREADING_LIBDISPATCH 1
+#elif !defined(ENABLE_THREADING_OPENMP) && defined(_OPENMP)
 #define ENABLE_THREADING_OPENMP 1
-#endif
-
-#if !defined(ENABLE_PARALLEL_JOBS) && (ENABLE(THREADING_GENERIC) || ENABLE(THREADING_LIBDISPATCH) || ENABLE(THREADING_OPENMP))
-#define ENABLE_PARALLEL_JOBS 1
+#elif !defined(THREADING_GENERIC)
+#define ENABLE_THREADING_GENERIC 1
 #endif
 
 #if ENABLE(GLIB_SUPPORT)
index ee1a2ae..e3de7dc 100644 (file)
@@ -1,3 +1,44 @@
+2011-11-21  Balazs Kelemen  <kbalazs@webkit.org>
+
+        Enable ParallelJobs by default
+        https://bugs.webkit.org/show_bug.cgi?id=70032
+
+        Reviewed by Zoltan Herczeg.
+
+        Covered by existing tests.
+
+        According to measurements on Mac and Linux it is a
+        considerable speedup for SVG on multicore.
+
+        Remove the ENABLE(PARALLEL_JOBS) guard. Fix the Windows build
+        by qualifying ParallelJobs with the WTF namespace (otherwise
+        MSVC believes it belongs to WebCore which is likely a compiler bug).
+
+        * platform/graphics/filters/FEConvolveMatrix.cpp:
+        (WebCore::FEConvolveMatrix::setInteriorPixelsWorker):
+        (WebCore::FEConvolveMatrix::platformApplySoftware):
+        * platform/graphics/filters/FEConvolveMatrix.h:
+        * platform/graphics/filters/FEGaussianBlur.cpp:
+        (WebCore::FEGaussianBlur::platformApplyWorker):
+        (WebCore::FEGaussianBlur::platformApply):
+        * platform/graphics/filters/FEGaussianBlur.h:
+        * platform/graphics/filters/FELighting.cpp:
+        (WebCore::FELighting::platformApplyGenericWorker):
+        (WebCore::FELighting::platformApplyGeneric):
+        * platform/graphics/filters/FELighting.h:
+        * platform/graphics/filters/FEMorphology.cpp:
+        (WebCore::FEMorphology::platformApplyWorker):
+        (WebCore::FEMorphology::platformApply):
+        * platform/graphics/filters/FEMorphology.h:
+        * platform/graphics/filters/FETurbulence.cpp:
+        (WebCore::FETurbulence::fillRegionWorker):
+        (WebCore::FETurbulence::platformApplySoftware):
+        * platform/graphics/filters/FETurbulence.h:
+        * platform/graphics/filters/arm/FELightingNEON.cpp:
+        (WebCore::FELighting::platformApplyNeonWorker):
+        * platform/graphics/filters/arm/FELightingNEON.h:
+        (WebCore::FELighting::platformApplyNeon):
+
 2011-12-06  Andreas Kling  <kling@webkit.org>
 
         Unreviewed assertion fix for r102123.
index 7dd74b3..cda5f19 100644 (file)
@@ -394,12 +394,10 @@ ALWAYS_INLINE void FEConvolveMatrix::setOuterPixels(PaintingData& paintingData,
         fastSetOuterPixels<false>(paintingData, x1, y1, x2, y2);
 }
 
-#if ENABLE(PARALLEL_JOBS)
 void FEConvolveMatrix::setInteriorPixelsWorker(InteriorPixelParameters* param)
 {
     param->filter->setInteriorPixels(*param->paintingData, param->clipRight, param->clipBottom, param->yStart, param->yEnd);
 }
-#endif
 
 void FEConvolveMatrix::platformApplySoftware()
 {
@@ -435,10 +433,9 @@ void FEConvolveMatrix::platformApplySoftware()
 
     if (clipRight >= 0 && clipBottom >= 0) {
 
-#if ENABLE(PARALLEL_JOBS)
         int optimalThreadNumber = (absolutePaintRect().width() * absolutePaintRect().height()) / s_minimalRectDimension;
         if (optimalThreadNumber > 1) {
-            ParallelJobs<InteriorPixelParameters> parallelJobs(&WebCore::FEConvolveMatrix::setInteriorPixelsWorker, optimalThreadNumber);
+            WTF::ParallelJobs<InteriorPixelParameters> parallelJobs(&WebCore::FEConvolveMatrix::setInteriorPixelsWorker, optimalThreadNumber);
             const int numOfThreads = parallelJobs.numberOfJobs();
             const int heightPerThread = clipBottom / numOfThreads;
             int startY = 0;
@@ -458,10 +455,10 @@ void FEConvolveMatrix::platformApplySoftware()
             }
 
             parallelJobs.execute();
-        } else
-            // Fallback to the default setInteriorPixels call.
-#endif
-        setInteriorPixels(paintingData, clipRight, clipBottom, 0, clipBottom);
+        } else {
+            // Fallback to single threaded mode.
+            setInteriorPixels(paintingData, clipRight, clipBottom, 0, clipBottom);
+        }
 
         clipRight += m_targetOffset.x() + 1;
         clipBottom += m_targetOffset.y() + 1;
index dca4324..34baf6f 100644 (file)
@@ -105,7 +105,6 @@ private:
     ALWAYS_INLINE void setOuterPixels(PaintingData&, int x1, int y1, int x2, int y2);
 
     // Parallelization parts
-#if ENABLE(PARALLEL_JOBS)
     static const int s_minimalRectDimension = (100 * 100); // Empirical data limit for parallel jobs
 
     template<typename Type>
@@ -121,7 +120,6 @@ private:
     };
 
     static void setInteriorPixelsWorker(InteriorPixelParameters*);
-#endif
 
     IntSize m_kernelSize;
     float m_divisor;
index a3abcfd..f57b604 100644 (file)
@@ -139,7 +139,6 @@ inline void FEGaussianBlur::platformApplyGeneric(ByteArray* srcPixelArray, ByteA
 
 }
 
-#if ENABLE(PARALLEL_JOBS)
 void FEGaussianBlur::platformApplyWorker(PlatformApplyParameters* parameters)
 {
     IntSize paintSize(parameters->width, parameters->height);
@@ -151,17 +150,15 @@ void FEGaussianBlur::platformApplyWorker(PlatformApplyParameters* parameters)
         parameters->kernelSizeX, parameters->kernelSizeY, paintSize);
 #endif
 }
-#endif
 
 inline void FEGaussianBlur::platformApply(ByteArray* srcPixelArray, ByteArray* tmpPixelArray, unsigned kernelSizeX, unsigned kernelSizeY, IntSize& paintSize)
 {
-#if ENABLE(PARALLEL_JOBS)
     int scanline = 4 * paintSize.width();
     int extraHeight = 3 * kernelSizeY * 0.5f;
     int optimalThreadNumber = (paintSize.width() * paintSize.height()) / (s_minimalRectDimension + extraHeight * paintSize.width());
 
     if (optimalThreadNumber > 1) {
-        ParallelJobs<PlatformApplyParameters> parallelJobs(&platformApplyWorker, optimalThreadNumber);
+        WTF::ParallelJobs<PlatformApplyParameters> parallelJobs(&platformApplyWorker, optimalThreadNumber);
 
         int jobs = parallelJobs.numberOfJobs();
         if (jobs > 1) {
@@ -220,8 +217,8 @@ inline void FEGaussianBlur::platformApply(ByteArray* srcPixelArray, ByteArray* t
             }
             return;
         }
+        // Fallback to single threaded mode.
     }
-#endif // PARALLEL_JOBS
 
     // The selection here eventually should happen dynamically on some platforms.
 #if CPU(ARM_NEON) && COMPILER(GCC)
index 2d96a40..fbb0d9a 100644 (file)
@@ -49,7 +49,6 @@ public:
     virtual TextStream& externalRepresentation(TextStream&, int indention) const;
 
 private:
-#if ENABLE(PARALLEL_JOBS)
     static const int s_minimalRectDimension = 100 * 100; // Empirical data limit for parallel jobs
 
     template<typename Type>
@@ -66,7 +65,6 @@ private:
     };
 
     static void platformApplyWorker(PlatformApplyParameters*);
-#endif // ENABLE(PARALLEL_JOBS)
 
     FEGaussianBlur(Filter*, float, float);
 
index 2c97a11..e795d35 100644 (file)
@@ -242,20 +242,17 @@ inline void FELighting::platformApplyGenericPaint(LightingData& data, LightSourc
     }
 }
 
-#if ENABLE(PARALLEL_JOBS)
 void FELighting::platformApplyGenericWorker(PlatformApplyGenericParameters* parameters)
 {
     parameters->filter->platformApplyGenericPaint(parameters->data, parameters->paintingData, parameters->yStart, parameters->yEnd);
 }
-#endif // ENABLE(PARALLEL_JOBS)
 
 inline void FELighting::platformApplyGeneric(LightingData& data, LightSource::PaintingData& paintingData)
 {
-#if ENABLE(PARALLEL_JOBS)
     int optimalThreadNumber = ((data.widthDecreasedByOne - 1) * (data.heightDecreasedByOne - 1)) / s_minimalRectDimension;
     if (optimalThreadNumber > 1) {
         // Initialize parallel jobs
-        ParallelJobs<PlatformApplyGenericParameters> parallelJobs(&platformApplyGenericWorker, optimalThreadNumber);
+        WTF::ParallelJobs<PlatformApplyGenericParameters> parallelJobs(&platformApplyGenericWorker, optimalThreadNumber);
 
         // Fill the parameter array
         int job = parallelJobs.numberOfJobs();
@@ -277,8 +274,9 @@ inline void FELighting::platformApplyGeneric(LightingData& data, LightSource::Pa
             parallelJobs.execute();
             return;
         }
+        // Fallback to single threaded mode.
     }
-#endif
+
     platformApplyGenericPaint(data, paintingData, 1, data.heightDecreasedByOne);
 }
 
index 04d7a1f..5426f91 100644 (file)
@@ -50,9 +50,7 @@ public:
     virtual void determineAbsolutePaintRect() { setAbsolutePaintRect(enclosingIntRect(maxEffectRect())); }
 
 protected:
-#if ENABLE(PARALLEL_JOBS)
     static const int s_minimalRectDimension = 100 * 100; // Empirical data limit for parallel jobs
-#endif
 
     enum LightingType {
         DiffuseLighting,
@@ -78,7 +76,6 @@ protected:
         inline void bottomRight(int offset, IntPoint& normalVector);
     };
 
-#if ENABLE(PARALLEL_JOBS)
     template<typename Type>
     friend class ParallelJobs;
 
@@ -92,7 +89,6 @@ protected:
 
     static void platformApplyGenericWorker(PlatformApplyGenericParameters*);
     static void platformApplyNeonWorker(FELightingPaintingDataForNeon*);
-#endif
 
     FELighting(Filter*, LightingType, const Color&, float, float, float, float, float, float, PassRefPtr<LightSource>);
 
index 85445d9..bd75e2b 100644 (file)
@@ -158,16 +158,13 @@ void FEMorphology::platformApplyGeneric(PaintingData* paintingData, int yStart,
     }
 }
 
-#if ENABLE(PARALLEL_JOBS)
 void FEMorphology::platformApplyWorker(PlatformApplyParameters* param)
 {
     param->filter->platformApplyGeneric(param->paintingData, param->startY, param->endY);
 }
-#endif
 
 void FEMorphology::platformApply(PaintingData* paintingData)
 {
-#if ENABLE(PARALLEL_JOBS)
     int optimalThreadNumber = (paintingData->width * paintingData->height) / s_minimalArea;
     if (optimalThreadNumber > 1) {
         ParallelJobs<PlatformApplyParameters> parallelJobs(&WebCore::FEMorphology::platformApplyWorker, optimalThreadNumber);
@@ -188,7 +185,7 @@ void FEMorphology::platformApply(PaintingData* paintingData)
         }
         // Fallback to single thread model
     }
-#endif
+
     platformApplyGeneric(paintingData, 0, paintingData->height);
 }
 
index 72c6f4e..f925403 100644 (file)
@@ -62,7 +62,6 @@ public:
         int radiusY;
     };
 
-#if ENABLE(PARALLEL_JOBS)
     static const int s_minimalArea = (300 * 300); // Empirical data limit for parallel jobs
 
     struct PlatformApplyParameters {
@@ -73,7 +72,6 @@ public:
     };
 
     static void platformApplyWorker(PlatformApplyParameters*);
-#endif
 
     inline void platformApply(PaintingData*);
     inline void platformApplyGeneric(PaintingData*, const int yStart, const int yEnd);
index 9460fe2..3ca4571 100644 (file)
@@ -357,12 +357,10 @@ inline void FETurbulence::fillRegion(ByteArray* pixelArray, PaintingData& painti
     }
 }
 
-#if ENABLE(PARALLEL_JOBS)
 void FETurbulence::fillRegionWorker(FillRegionParameters* parameters)
 {
     parameters->filter->fillRegion(parameters->pixelArray, *parameters->paintingData, parameters->startY, parameters->endY);
 }
-#endif // ENABLE(PARALLEL_JOBS)
 
 void FETurbulence::platformApplySoftware()
 {
@@ -378,12 +376,10 @@ void FETurbulence::platformApplySoftware()
     PaintingData paintingData(m_seed, roundedIntSize(filterPrimitiveSubregion().size()));
     initPaint(paintingData);
 
-#if ENABLE(PARALLEL_JOBS)
-
     int optimalThreadNumber = (absolutePaintRect().width() * absolutePaintRect().height()) / s_minimalRectDimension;
     if (optimalThreadNumber > 1) {
         // Initialize parallel jobs
-        ParallelJobs<FillRegionParameters> parallelJobs(&WebCore::FETurbulence::fillRegionWorker, optimalThreadNumber);
+        WTF::ParallelJobs<FillRegionParameters> parallelJobs(&WebCore::FETurbulence::fillRegionWorker, optimalThreadNumber);
 
         // Fill the parameter array
         int i = parallelJobs.numberOfJobs();
@@ -405,14 +401,11 @@ void FETurbulence::platformApplySoftware()
 
             // Execute parallel jobs
             parallelJobs.execute();
-
             return;
         }
     }
-    // Fallback to sequential mode if there is no room for a new thread or the paint area is too small
-
-#endif // ENABLE(PARALLEL_JOBS)
 
+    // Fallback to single threaded mode if there is no room for a new thread or the paint area is too small.
     fillRegion(pixelArray, paintingData, 0, absolutePaintRect().height());
 }
 
index 641ca76..01d3c59 100644 (file)
@@ -58,9 +58,7 @@ public:
     bool stitchTiles() const;
     bool setStitchTiles(bool);
 
-#if ENABLE(PARALLEL_JOBS)
     static void fillRegionWorker(void*);
-#endif
 
     virtual void platformApplySoftware();
     virtual void dump();
@@ -72,9 +70,8 @@ public:
 private:
     static const int s_blockSize = 256;
     static const int s_blockMask = s_blockSize - 1;
-#if ENABLE(PARALLEL_JOBS)
-    static const int s_minimalRectDimension = (100 * 100); // Empirical data limit for parallel jobs
-#endif
+
+    static const int s_minimalRectDimension = (100 * 100); // Empirical data limit for parallel jobs.
 
     struct PaintingData {
         long seed;
@@ -90,7 +87,6 @@ private:
         inline long random();
     };
 
-#if ENABLE(PARALLEL_JOBS)
     template<typename Type>
     friend class ParallelJobs;
 
@@ -103,7 +99,6 @@ private:
     };
 
     static void fillRegionWorker(FillRegionParameters*);
-#endif
 
     FETurbulence(Filter*, TurbulenceType, float, float, int, float, bool);
 
index 513b749..110b528 100644 (file)
@@ -50,12 +50,10 @@ short* feLightingConstantsForNeon()
     return s_FELightingConstantsForNeon;
 }
 
-#if ENABLE(PARALLEL_JOBS)
 void FELighting::platformApplyNeonWorker(FELightingPaintingDataForNeon* parameters)
 {
     neonDrawLighting(parameters);
 }
-#endif
 
 #define ASSTRING(str) #str
 #define TOSTRING(value) ASSTRING(value)
index d69e227..9094153 100644 (file)
@@ -167,7 +167,6 @@ inline void FELighting::platformApplyNeon(LightingData& data, LightSource::Paint
     if (floatArguments.diffuseConstant == 1)
         neonData.flags |= FLAG_DIFFUSE_CONST_IS_1;
 
-#if ENABLE(PARALLEL_JOBS)
     int optimalThreadNumber = ((data.widthDecreasedByOne - 1) * (data.heightDecreasedByOne - 1)) / s_minimalRectDimension;
     if (optimalThreadNumber > 1) {
         // Initialize parallel jobs
@@ -193,7 +192,6 @@ inline void FELighting::platformApplyNeon(LightingData& data, LightSource::Paint
             return;
         }
     }
-#endif
 
     neonDrawLighting(&neonData);
 }