Title: [90399] trunk/Source/WebCore
Revision
90399
Author
[email protected]
Date
2011-07-05 09:07:35 -0700 (Tue, 05 Jul 2011)

Log Message

2011-07-05  Tamas Czene  <[email protected]>

        Reviewed by Simon Fraser.

        Remove virtual functions from StyleImage.
        https://bugs.webkit.org/show_bug.cgi?id=63909

        We can remove the virtual "isChachedImage, isPendingImage, isGeneratedImage" functions to speed up the StyleImage.
        Some profile data shows this part is significant, especially in small CSS-based sites.
        Removing the virtual functions - removing the calls - makes a small performance progression on this part.

        * rendering/style/StyleCachedImage.h:
        (WebCore::StyleCachedImage::StyleCachedImage):
        * rendering/style/StyleGeneratedImage.h:
        (WebCore::StyleGeneratedImage::StyleGeneratedImage):
        * rendering/style/StyleImage.h:
        (WebCore::StyleImage::isCachedImage):
        (WebCore::StyleImage::isPendingImage):
        (WebCore::StyleImage::isGeneratedImage):
        (WebCore::StyleImage::StyleImage):
        * rendering/style/StylePendingImage.h:
        (WebCore::StylePendingImage::StylePendingImage):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (90398 => 90399)


--- trunk/Source/WebCore/ChangeLog	2011-07-05 16:01:45 UTC (rev 90398)
+++ trunk/Source/WebCore/ChangeLog	2011-07-05 16:07:35 UTC (rev 90399)
@@ -1,3 +1,26 @@
+2011-07-05  Tamas Czene  <[email protected]>
+
+        Reviewed by Simon Fraser.
+
+        Remove virtual functions from StyleImage.
+        https://bugs.webkit.org/show_bug.cgi?id=63909
+
+        We can remove the virtual "isChachedImage, isPendingImage, isGeneratedImage" functions to speed up the StyleImage.
+        Some profile data shows this part is significant, especially in small CSS-based sites.
+        Removing the virtual functions - removing the calls - makes a small performance progression on this part.
+
+        * rendering/style/StyleCachedImage.h:
+        (WebCore::StyleCachedImage::StyleCachedImage):
+        * rendering/style/StyleGeneratedImage.h:
+        (WebCore::StyleGeneratedImage::StyleGeneratedImage):
+        * rendering/style/StyleImage.h:
+        (WebCore::StyleImage::isCachedImage):
+        (WebCore::StyleImage::isPendingImage):
+        (WebCore::StyleImage::isGeneratedImage):
+        (WebCore::StyleImage::StyleImage):
+        * rendering/style/StylePendingImage.h:
+        (WebCore::StylePendingImage::StylePendingImage):
+
 2011-07-05  Pavel Feldman  <[email protected]>
 
         Web Inspector: add "element state" setting to the styles section title.

Modified: trunk/Source/WebCore/rendering/style/StyleCachedImage.h (90398 => 90399)


--- trunk/Source/WebCore/rendering/style/StyleCachedImage.h	2011-07-05 16:01:45 UTC (rev 90398)
+++ trunk/Source/WebCore/rendering/style/StyleCachedImage.h	2011-07-05 16:07:35 UTC (rev 90399)
@@ -36,8 +36,6 @@
     static PassRefPtr<StyleCachedImage> create(CachedImage* image) { return adoptRef(new StyleCachedImage(image)); }
     virtual WrappedImagePtr data() const { return m_image.get(); }
 
-    virtual bool isCachedImage() const { return true; }
-    
     virtual PassRefPtr<CSSValue> cssValue() const;
     
     CachedImage* cachedImage() const { return m_image.get(); }
@@ -58,6 +56,7 @@
     StyleCachedImage(CachedImage* image)
         : m_image(image)
     {
+         m_isCachedImage = true;
     }
     
     CachedResourceHandle<CachedImage> m_image;

Modified: trunk/Source/WebCore/rendering/style/StyleGeneratedImage.h (90398 => 90399)


--- trunk/Source/WebCore/rendering/style/StyleGeneratedImage.h	2011-07-05 16:01:45 UTC (rev 90398)
+++ trunk/Source/WebCore/rendering/style/StyleGeneratedImage.h	2011-07-05 16:07:35 UTC (rev 90399)
@@ -40,8 +40,6 @@
 
     virtual WrappedImagePtr data() const { return m_generator; }
 
-    virtual bool isGeneratedImage() const { return true; }
-    
     virtual PassRefPtr<CSSValue> cssValue() const;
 
     virtual IntSize imageSize(const RenderObject*, float multiplier) const;
@@ -58,6 +56,7 @@
         : m_generator(val)
         , m_fixedSize(fixedSize)
     {
+         m_isGeneratedImage = true;
     }
     
     CSSImageGeneratorValue* m_generator; // The generator holds a reference to us.

Modified: trunk/Source/WebCore/rendering/style/StyleImage.h (90398 => 90399)


--- trunk/Source/WebCore/rendering/style/StyleImage.h	2011-07-05 16:01:45 UTC (rev 90398)
+++ trunk/Source/WebCore/rendering/style/StyleImage.h	2011-07-05 16:07:35 UTC (rev 90399)
@@ -62,9 +62,9 @@
     virtual PassRefPtr<Image> image(RenderObject*, const IntSize&) const = 0;
     virtual WrappedImagePtr data() const = 0;
 
-    virtual bool isCachedImage() const { return false; }
-    virtual bool isPendingImage() const { return false; }
-    virtual bool isGeneratedImage() const { return false; }
+    ALWAYS_INLINE bool isCachedImage() const { return m_isCachedImage; }
+    ALWAYS_INLINE bool isPendingImage() const { return m_isPendingImage; }
+    ALWAYS_INLINE bool isGeneratedImage() const { return m_isGeneratedImage; }
     
     static  bool imagesEquivalent(StyleImage* image1, StyleImage* image2)
     {
@@ -77,7 +77,15 @@
     }
 
 protected:
-    StyleImage() { }
+    StyleImage()
+        : m_isCachedImage(false)
+        , m_isPendingImage(false)
+        , m_isGeneratedImage(false)
+    {
+    }
+    bool m_isCachedImage:1;
+    bool m_isPendingImage:1;
+    bool m_isGeneratedImage:1;
 };
 
 }

Modified: trunk/Source/WebCore/rendering/style/StylePendingImage.h (90398 => 90399)


--- trunk/Source/WebCore/rendering/style/StylePendingImage.h	2011-07-05 16:01:45 UTC (rev 90398)
+++ trunk/Source/WebCore/rendering/style/StylePendingImage.h	2011-07-05 16:07:35 UTC (rev 90399)
@@ -41,8 +41,6 @@
 
     virtual WrappedImagePtr data() const { return m_value; }
 
-    virtual bool isPendingImage() const { return true; }
-    
     virtual PassRefPtr<CSSValue> cssValue() const { return m_value; }
     CSSImageValue* cssImageValue() const { return m_value; }
     
@@ -63,6 +61,7 @@
     StylePendingImage(CSSImageValue* value)
         : m_value(value)
     {
+        m_isPendingImage = true;
     }
 
     CSSImageValue* m_value; // Not retained; it owns us.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to