Title: [133671] trunk/Source/WebCore
- Revision
- 133671
- Author
- [email protected]
- Date
- 2012-11-06 14:12:14 -0800 (Tue, 06 Nov 2012)
Log Message
Remove branch from inside RenderObject::view now that renderer() is more expensive
https://bugs.webkit.org/show_bug.cgi?id=101277
Patch by Elliott Sprehn <[email protected]> on 2012-11-06
Reviewed by Eric Seidel.
It was observed in Bug 100057 that calling renderer() repeatedly now that it has a branch
can be a performance regression. Now that we no longer keep a separate pointer for rare data
in Document, we can use that space for a pointer to the RenderView making RenderObject::view()
faster and removing the branch.
This is a 1% improvement on Parser/html5-full-render.html
This also cleans up the code because it turns out we don't need to have RenderObject::view() in
RenderView.h because we can just call Document::renderView() and not do toRenderView. This makes
it easier to find this method as it exists in the right header file now.
No new tests, this is just a refactor.
* WebCore.exp.in: Remove export of Document::renderView since it's inline now.
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::setRenderer):
(WebCore):
* dom/Document.h:
(WebCore::Document::renderView):
(Document):
* rendering/RenderObject.h:
(WebCore::RenderObject::view):
* rendering/RenderView.h:
(WebCore):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (133670 => 133671)
--- trunk/Source/WebCore/ChangeLog 2012-11-06 22:06:50 UTC (rev 133670)
+++ trunk/Source/WebCore/ChangeLog 2012-11-06 22:12:14 UTC (rev 133671)
@@ -1,3 +1,36 @@
+2012-11-06 Elliott Sprehn <[email protected]>
+
+ Remove branch from inside RenderObject::view now that renderer() is more expensive
+ https://bugs.webkit.org/show_bug.cgi?id=101277
+
+ Reviewed by Eric Seidel.
+
+ It was observed in Bug 100057 that calling renderer() repeatedly now that it has a branch
+ can be a performance regression. Now that we no longer keep a separate pointer for rare data
+ in Document, we can use that space for a pointer to the RenderView making RenderObject::view()
+ faster and removing the branch.
+
+ This is a 1% improvement on Parser/html5-full-render.html
+
+ This also cleans up the code because it turns out we don't need to have RenderObject::view() in
+ RenderView.h because we can just call Document::renderView() and not do toRenderView. This makes
+ it easier to find this method as it exists in the right header file now.
+
+ No new tests, this is just a refactor.
+
+ * WebCore.exp.in: Remove export of Document::renderView since it's inline now.
+ * dom/Document.cpp:
+ (WebCore::Document::Document):
+ (WebCore::Document::setRenderer):
+ (WebCore):
+ * dom/Document.h:
+ (WebCore::Document::renderView):
+ (Document):
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject::view):
+ * rendering/RenderView.h:
+ (WebCore):
+
2012-11-06 Sheriff Bot <[email protected]>
Unreviewed, rolling out r133526.
Modified: trunk/Source/WebCore/WebCore.exp.in (133670 => 133671)
--- trunk/Source/WebCore/WebCore.exp.in 2012-11-06 22:06:50 UTC (rev 133670)
+++ trunk/Source/WebCore/WebCore.exp.in 2012-11-06 22:12:14 UTC (rev 133671)
@@ -1447,7 +1447,6 @@
__ZNK7WebCore7IntRect8containsERKS0_
__ZNK7WebCore7IntRectcv6CGRectEv
__ZNK7WebCore7RunLoop9TimerBase8isActiveEv
-__ZNK7WebCore8Document10renderViewEv
__ZNK7WebCore8Document11completeURLERKN3WTF6StringE
__ZNK7WebCore8Document13axObjectCacheEv
__ZNK7WebCore8Document13nodesFromRectEiijjjjbb
Modified: trunk/Source/WebCore/dom/Document.cpp (133670 => 133671)
--- trunk/Source/WebCore/dom/Document.cpp 2012-11-06 22:06:50 UTC (rev 133670)
+++ trunk/Source/WebCore/dom/Document.cpp 2012-11-06 22:12:14 UTC (rev 133671)
@@ -478,6 +478,7 @@
, m_isViewSource(false)
, m_sawElementsInKnownNamespaces(false)
, m_isSrcdocDocument(false)
+ , m_renderView(0)
, m_eventQueue(DocumentEventQueue::create(this))
, m_weakReference(DocumentWeakReference::create(this))
, m_idAttributeName(idAttr)
@@ -2054,6 +2055,12 @@
m_styleResolver.clear();
}
+void Document::setRenderer(RenderObject* renderer)
+{
+ m_renderView = toRenderView(renderer);
+ Node::setRenderer(renderer);
+}
+
void Document::attach()
{
ASSERT(!attached());
@@ -2198,11 +2205,6 @@
#endif
}
-RenderView* Document::renderView() const
-{
- return toRenderView(renderer());
-}
-
void Document::clearAXObjectCache()
{
// clear cache in top document
Modified: trunk/Source/WebCore/dom/Document.h (133670 => 133671)
--- trunk/Source/WebCore/dom/Document.h 2012-11-06 22:06:50 UTC (rev 133670)
+++ trunk/Source/WebCore/dom/Document.h 2012-11-06 22:12:14 UTC (rev 133671)
@@ -556,7 +556,8 @@
RenderArena* renderArena() { return m_renderArena.get(); }
- RenderView* renderView() const;
+ RenderView* renderView() const { return m_renderView; }
+ void setRenderer(RenderObject*);
void clearAXObjectCache();
AXObjectCache* axObjectCache() const;
@@ -1435,6 +1436,7 @@
bool m_sawElementsInKnownNamespaces;
bool m_isSrcdocDocument;
+ RenderView* m_renderView;
RefPtr<DocumentEventQueue> m_eventQueue;
RefPtr<DocumentWeakReference> m_weakReference;
Modified: trunk/Source/WebCore/rendering/RenderObject.h (133670 => 133671)
--- trunk/Source/WebCore/rendering/RenderObject.h 2012-11-06 22:06:50 UTC (rev 133670)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2012-11-06 22:12:14 UTC (rev 133671)
@@ -615,8 +615,7 @@
virtual void updateDragState(bool dragOn);
- // Inlined into RenderView.h for performance and to avoid a cyclic dependency.
- RenderView* view() const;
+ RenderView* view() const { return document()->renderView(); };
// Returns true if this renderer is rooted, and optionally returns the hosting view (the root of the hierarchy).
bool isRooted(RenderView** = 0) const;
Modified: trunk/Source/WebCore/rendering/RenderView.h (133670 => 133671)
--- trunk/Source/WebCore/rendering/RenderView.h 2012-11-06 22:06:50 UTC (rev 133670)
+++ trunk/Source/WebCore/rendering/RenderView.h 2012-11-06 22:12:14 UTC (rev 133671)
@@ -349,12 +349,6 @@
// This will catch anyone doing an unnecessary cast.
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);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes