Title: [102185] trunk/Source/WebCore
Revision
102185
Author
jchaffr...@webkit.org
Date
2011-12-06 15:38:37 -0800 (Tue, 06 Dec 2011)

Log Message

Inline RenderObject::view()
https://bugs.webkit.org/show_bug.cgi?id=73733

Reviewed by Darin Adler.

Micro-performance optimization, no change in behavior.

RenderObject::view() is super hot and is taking ~4-5% of the time in some
benchmarks as it is called several hundred thousands times. For some reason,
the compiler did not inline it even though it is very simple in release builds.

* WebCore.exp.in: Removed RenderObject::view() as it is inlined now.

* rendering/RenderObject.cpp: Moved the implementation from here ...
* rendering/RenderView.h:
(WebCore::RenderObject::view): ... to here to avoid a cyclic
dependency between RenderObject and RenderView. Also marked the
function as ALWAYS_INLINE.

* rendering/RenderObject.h:
* rendering/svg/RenderSVGResourceContainer.cpp:
Added #include "RenderView.h" as the code checks for view() during repaint.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102184 => 102185)


--- trunk/Source/WebCore/ChangeLog	2011-12-06 23:29:48 UTC (rev 102184)
+++ trunk/Source/WebCore/ChangeLog	2011-12-06 23:38:37 UTC (rev 102185)
@@ -1,5 +1,30 @@
 2011-12-06  Julien Chaffraix  <jchaffr...@webkit.org>
 
+        Inline RenderObject::view()
+        https://bugs.webkit.org/show_bug.cgi?id=73733
+
+        Reviewed by Darin Adler.
+
+        Micro-performance optimization, no change in behavior.
+
+        RenderObject::view() is super hot and is taking ~4-5% of the time in some
+        benchmarks as it is called several hundred thousands times. For some reason,
+        the compiler did not inline it even though it is very simple in release builds.
+
+        * WebCore.exp.in: Removed RenderObject::view() as it is inlined now.
+
+        * rendering/RenderObject.cpp: Moved the implementation from here ...
+        * rendering/RenderView.h:
+        (WebCore::RenderObject::view): ... to here to avoid a cyclic
+        dependency between RenderObject and RenderView. Also marked the
+        function as ALWAYS_INLINE.
+
+        * rendering/RenderObject.h:
+        * rendering/svg/RenderSVGResourceContainer.cpp:
+        Added #include "RenderView.h" as the code checks for view() during repaint.
+
+2011-12-06  Julien Chaffraix  <jchaffr...@webkit.org>
+
         CSS Grid Layout: Add support for parsing multiple grid-columns or grid-rows
         https://bugs.webkit.org/show_bug.cgi?id=73272
 

Modified: trunk/Source/WebCore/WebCore.exp.in (102184 => 102185)


--- trunk/Source/WebCore/WebCore.exp.in	2011-12-06 23:29:48 UTC (rev 102184)
+++ trunk/Source/WebCore/WebCore.exp.in	2011-12-06 23:38:37 UTC (rev 102185)
@@ -1179,7 +1179,6 @@
 __ZNK7WebCore12RenderObject23absoluteBoundingBoxRectEb
 __ZNK7WebCore12RenderObject14enclosingLayerEv
 __ZNK7WebCore12RenderObject15localToAbsoluteERKNS_10FloatPointEbb
-__ZNK7WebCore12RenderObject4viewEv
 __ZNK7WebCore12RenderObject7childAtEj
 __ZNK7WebCore12RenderWidget14windowClipRectEv
 __ZNK7WebCore12SharedBuffer11getSomeDataERPKcj

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (102184 => 102185)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2011-12-06 23:29:48 UTC (rev 102184)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2011-12-06 23:38:37 UTC (rev 102185)
@@ -2122,11 +2122,6 @@
     return LayoutRect();
 }
 
-RenderView* RenderObject::view() const
-{
-    return toRenderView(document()->renderer());
-}
-
 bool RenderObject::isRooted(RenderView** view)
 {
     RenderObject* o = this;

Modified: trunk/Source/WebCore/rendering/RenderObject.h (102184 => 102185)


--- trunk/Source/WebCore/rendering/RenderObject.h	2011-12-06 23:29:48 UTC (rev 102184)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2011-12-06 23:38:37 UTC (rev 102185)
@@ -516,6 +516,7 @@
     
     virtual void updateDragState(bool dragOn);
 
+    // Inlined into RenderView.h for performance and to avoid a cyclic dependency.
     RenderView* view() const;
 
     // Returns true if this renderer is rooted, and optionally returns the hosting view (the root of the hierarchy).

Modified: trunk/Source/WebCore/rendering/RenderView.h (102184 => 102185)


--- trunk/Source/WebCore/rendering/RenderView.h	2011-12-06 23:29:48 UTC (rev 102184)
+++ trunk/Source/WebCore/rendering/RenderView.h	2011-12-06 23:38:37 UTC (rev 102185)
@@ -291,6 +291,11 @@
 void toRenderView(const RenderView*);
 
 
+ALWAYS_INLINE RenderView* RenderObject::view() const
+{
+    return toRenderView(document()->renderer());
+}
+
 // Stack-based class to assist with LayoutState push/pop
 class LayoutStateMaintainer {
     WTF_MAKE_NONCOPYABLE(LayoutStateMaintainer);

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp (102184 => 102185)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp	2011-12-06 23:29:48 UTC (rev 102184)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp	2011-12-06 23:38:37 UTC (rev 102185)
@@ -23,6 +23,7 @@
 #include "RenderSVGResourceContainer.h"
 
 #include "RenderSVGShadowTreeRootContainer.h"
+#include "RenderView.h"
 #include "SVGResourcesCache.h"
 #include "SVGStyledTransformableElement.h"
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to