Title: [100988] trunk/Source
Revision
100988
Author
kbal...@webkit.org
Date
2011-11-22 03:42:00 -0800 (Tue, 22 Nov 2011)

Log Message

Enable ParallelJobs by default
https://bugs.webkit.org/show_bug.cgi?id=70032

Reviewed by Zoltan Herczeg.

Source/_javascript_Core:

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.

* _javascript_Core.gypi:  Add the files to the build. It was
missing for the gyp build system.
* _javascript_Core.vcproj/_javascript_Core/_javascript_Core.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):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (100987 => 100988)


--- trunk/Source/_javascript_Core/ChangeLog	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-11-22 11:42:00 UTC (rev 100988)
@@ -1,3 +1,31 @@
+2011-11-21  Balazs Kelemen  <kbal...@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.
+
+        * _javascript_Core.gypi:  Add the files to the build. It was
+        missing for the gyp build system.
+        * _javascript_Core.vcproj/_javascript_Core/_javascript_Core.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-11-21  Filip Pizlo  <fpi...@apple.com>
 
         DFG should have richer debug output for CFA and phi processing

Modified: trunk/Source/_javascript_Core/_javascript_Core.gypi (100987 => 100988)


--- trunk/Source/_javascript_Core/_javascript_Core.gypi	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/_javascript_Core/_javascript_Core.gypi	2011-11-22 11:42:00 UTC (rev 100988)
@@ -565,6 +565,11 @@
             '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',

Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def (100987 => 100988)


--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2011-11-22 11:42:00 UTC (rev 100988)
@@ -13,6 +13,7 @@
     ??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
@@ -128,6 +129,7 @@
     ?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

Modified: trunk/Source/_javascript_Core/wtf/ParallelJobs.h (100987 => 100988)


--- trunk/Source/_javascript_Core/wtf/ParallelJobs.h	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/_javascript_Core/wtf/ParallelJobs.h	2011-11-22 11:42:00 UTC (rev 100988)
@@ -33,12 +33,8 @@
 #include "RefPtr.h"
 #include <wtf/Vector.h>
 
-#if ENABLE(PARALLEL_JOBS)
-
 // Usage:
 //
-// #if ENABLE(PARALLEL_JOBS)
-//
 //     // Initialize parallel jobs
 //     ParallelJobs<TypeOfParameter> parallelJobs(&worker [, requestedNumberOfJobs]);
 //
@@ -52,11 +48,6 @@
 //     // Execute parallel jobs
 //     parallelJobs.execute();
 //
-// #else
-//
-//     inlineFunction(args...);
-//
-// #endif // ENABLE(PARALLEL_JOBS)
 
 #if ENABLE(THREADING_GENERIC)
 #include "ParallelJobsGeneric.h"
@@ -111,6 +102,4 @@
 
 using WTF::ParallelJobs;
 
-#endif // ENABLE(PARALLEL_JOBS)
-
 #endif // ParallelJobs_h

Modified: trunk/Source/_javascript_Core/wtf/ParallelJobsGeneric.cpp (100987 => 100988)


--- trunk/Source/_javascript_Core/wtf/ParallelJobsGeneric.cpp	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/_javascript_Core/wtf/ParallelJobsGeneric.cpp	2011-11-22 11:42:00 UTC (rev 100988)
@@ -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 @@
 
 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, parameters);
+        currentParameter += 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 ParallelEnvironment::determineMaxNumberOfParallelThreads()
 {
     const int defaultIfUnavailable = 2;
@@ -132,5 +178,4 @@
 }
 
 } // namespace WTF
-
-#endif // ENABLE(PARALLEL_JOBS) && ENABLE(THREADING_GENERIC)
+#endif // ENABLE(THREADING_GENERIC)

Modified: trunk/Source/_javascript_Core/wtf/ParallelJobsGeneric.h (100987 => 100988)


--- trunk/Source/_javascript_Core/wtf/ParallelJobsGeneric.h	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/_javascript_Core/wtf/ParallelJobsGeneric.h	2011-11-22 11:42:00 UTC (rev 100988)
@@ -40,56 +40,15 @@
 public:
     typedef void (*ThreadFunction)(void*);
 
-    ParallelEnvironment(ThreadFunction threadFunction, size_t sizeOfParameter, int requestedJobNumber) :
-        m_threadFunction(threadFunction),
-        m_sizeOfParameter(sizeOfParameter)
-    {
-        ASSERT_ARG(requestedJobNumber, requestedJobNumber >= 1);
+    ParallelEnvironment(ThreadFunction, size_t sizeOfParameter, int requestedJobNumber);
 
-        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;
-    }
-
     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;
-        }
+    void execute(void* parameters);
 
-        // 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();
-    }
-
     class ThreadPrivate : public RefCounted<ThreadPrivate> {
     public:
         ThreadPrivate()

Modified: trunk/Source/_javascript_Core/wtf/Platform.h (100987 => 100988)


--- trunk/Source/_javascript_Core/wtf/Platform.h	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/_javascript_Core/wtf/Platform.h	2011-11-22 11:42:00 UTC (rev 100988)
@@ -1081,14 +1081,14 @@
 #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
+#elif !defined(THREADING_GENERIC)
+#define ENABLE_THREADING_GENERIC 1
 #endif
 
-#if !defined(ENABLE_PARALLEL_JOBS) && (ENABLE(THREADING_GENERIC) || ENABLE(THREADING_LIBDISPATCH) || ENABLE(THREADING_OPENMP))
-#define ENABLE_PARALLEL_JOBS 1
-#endif
-
 #if ENABLE(GLIB_SUPPORT)
 #include "GTypedefs.h"
 #endif

Modified: trunk/Source/WebCore/ChangeLog (100987 => 100988)


--- trunk/Source/WebCore/ChangeLog	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/WebCore/ChangeLog	2011-11-22 11:42:00 UTC (rev 100988)
@@ -1,3 +1,44 @@
+2011-11-21  Balazs Kelemen  <kbal...@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-11-22  Alexander Pavlov  <apav...@chromium.org>
 
         Web Inspector: [protocol] actual JSON messages do not conform to Inspector.json in CSS

Modified: trunk/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp (100987 => 100988)


--- trunk/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.cpp	2011-11-22 11:42:00 UTC (rev 100988)
@@ -394,12 +394,10 @@
         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 @@
 
     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 @@
             }
 
             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;

Modified: trunk/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.h (100987 => 100988)


--- trunk/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.h	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/WebCore/platform/graphics/filters/FEConvolveMatrix.h	2011-11-22 11:42:00 UTC (rev 100988)
@@ -105,7 +105,6 @@
     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 @@
     };
 
     static void setInteriorPixelsWorker(InteriorPixelParameters*);
-#endif
 
     IntSize m_kernelSize;
     float m_divisor;

Modified: trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp (100987 => 100988)


--- trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp	2011-11-22 11:42:00 UTC (rev 100988)
@@ -135,7 +135,6 @@
     }
 }
 
-#if ENABLE(PARALLEL_JOBS)
 void FEGaussianBlur::platformApplyWorker(PlatformApplyParameters* parameters)
 {
     IntSize paintSize(parameters->width, parameters->height);
@@ -147,17 +146,15 @@
         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) {
@@ -216,8 +213,8 @@
             }
             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)

Modified: trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.h (100987 => 100988)


--- trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.h	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/WebCore/platform/graphics/filters/FEGaussianBlur.h	2011-11-22 11:42:00 UTC (rev 100988)
@@ -49,7 +49,6 @@
     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 @@
     };
 
     static void platformApplyWorker(PlatformApplyParameters*);
-#endif // ENABLE(PARALLEL_JOBS)
 
     FEGaussianBlur(Filter*, float, float);
 

Modified: trunk/Source/WebCore/platform/graphics/filters/FELighting.cpp (100987 => 100988)


--- trunk/Source/WebCore/platform/graphics/filters/FELighting.cpp	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/WebCore/platform/graphics/filters/FELighting.cpp	2011-11-22 11:42:00 UTC (rev 100988)
@@ -242,20 +242,17 @@
     }
 }
 
-#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 @@
             parallelJobs.execute();
             return;
         }
+        // Fallback to single threaded mode.
     }
-#endif
+
     platformApplyGenericPaint(data, paintingData, 1, data.heightDecreasedByOne);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/filters/FELighting.h (100987 => 100988)


--- trunk/Source/WebCore/platform/graphics/filters/FELighting.h	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/WebCore/platform/graphics/filters/FELighting.h	2011-11-22 11:42:00 UTC (rev 100988)
@@ -50,9 +50,7 @@
     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 @@
         inline void bottomRight(int offset, IntPoint& normalVector);
     };
 
-#if ENABLE(PARALLEL_JOBS)
     template<typename Type>
     friend class ParallelJobs;
 
@@ -92,7 +89,6 @@
 
     static void platformApplyGenericWorker(PlatformApplyGenericParameters*);
     static void platformApplyNeonWorker(FELightingPaintingDataForNeon*);
-#endif
 
     FELighting(Filter*, LightingType, const Color&, float, float, float, float, float, float, PassRefPtr<LightSource>);
 

Modified: trunk/Source/WebCore/platform/graphics/filters/FEMorphology.cpp (100987 => 100988)


--- trunk/Source/WebCore/platform/graphics/filters/FEMorphology.cpp	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/WebCore/platform/graphics/filters/FEMorphology.cpp	2011-11-22 11:42:00 UTC (rev 100988)
@@ -158,16 +158,13 @@
     }
 }
 
-#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 @@
         }
         // Fallback to single thread model
     }
-#endif
+
     platformApplyGeneric(paintingData, 0, paintingData->height);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/filters/FEMorphology.h (100987 => 100988)


--- trunk/Source/WebCore/platform/graphics/filters/FEMorphology.h	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/WebCore/platform/graphics/filters/FEMorphology.h	2011-11-22 11:42:00 UTC (rev 100988)
@@ -62,7 +62,6 @@
         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 @@
     };
 
     static void platformApplyWorker(PlatformApplyParameters*);
-#endif
 
     inline void platformApply(PaintingData*);
     inline void platformApplyGeneric(PaintingData*, const int yStart, const int yEnd);

Modified: trunk/Source/WebCore/platform/graphics/filters/FETurbulence.cpp (100987 => 100988)


--- trunk/Source/WebCore/platform/graphics/filters/FETurbulence.cpp	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/WebCore/platform/graphics/filters/FETurbulence.cpp	2011-11-22 11:42:00 UTC (rev 100988)
@@ -357,12 +357,10 @@
     }
 }
 
-#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 @@
     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 @@
 
             // 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());
 }
 

Modified: trunk/Source/WebCore/platform/graphics/filters/FETurbulence.h (100987 => 100988)


--- trunk/Source/WebCore/platform/graphics/filters/FETurbulence.h	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/WebCore/platform/graphics/filters/FETurbulence.h	2011-11-22 11:42:00 UTC (rev 100988)
@@ -58,9 +58,7 @@
     bool stitchTiles() const;
     bool setStitchTiles(bool);
 
-#if ENABLE(PARALLEL_JOBS)
     static void fillRegionWorker(void*);
-#endif
 
     virtual void platformApplySoftware();
     virtual void dump();
@@ -72,10 +70,9 @@
 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;
         int latticeSelector[2 * s_blockSize + 2];
@@ -90,7 +87,6 @@
         inline long random();
     };
 
-#if ENABLE(PARALLEL_JOBS)
     template<typename Type>
     friend class ParallelJobs;
 
@@ -103,7 +99,6 @@
     };
 
     static void fillRegionWorker(FillRegionParameters*);
-#endif
 
     FETurbulence(Filter*, TurbulenceType, float, float, int, float, bool);
 

Modified: trunk/Source/WebCore/platform/graphics/filters/arm/FELightingNEON.cpp (100987 => 100988)


--- trunk/Source/WebCore/platform/graphics/filters/arm/FELightingNEON.cpp	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/WebCore/platform/graphics/filters/arm/FELightingNEON.cpp	2011-11-22 11:42:00 UTC (rev 100988)
@@ -50,12 +50,10 @@
     return s_FELightingConstantsForNeon;
 }
 
-#if ENABLE(PARALLEL_JOBS)
 void FELighting::platformApplyNeonWorker(FELightingPaintingDataForNeon* parameters)
 {
     neonDrawLighting(parameters);
 }
-#endif
 
 #define ASSTRING(str) #str
 #define TOSTRING(value) ASSTRING(value)

Modified: trunk/Source/WebCore/platform/graphics/filters/arm/FELightingNEON.h (100987 => 100988)


--- trunk/Source/WebCore/platform/graphics/filters/arm/FELightingNEON.h	2011-11-22 11:14:54 UTC (rev 100987)
+++ trunk/Source/WebCore/platform/graphics/filters/arm/FELightingNEON.h	2011-11-22 11:42:00 UTC (rev 100988)
@@ -167,7 +167,6 @@
     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 @@
             return;
         }
     }
-#endif
 
     neonDrawLighting(&neonData);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to