Make RenderObject::containingBlock virtual for better speed and clarity
authorjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Jul 2011 03:30:36 +0000 (03:30 +0000)
committerjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Jul 2011 03:30:36 +0000 (03:30 +0000)
commit199094c5b8978e873fb71663761afc1529e3759f
treeb9212fa38edda8dc3d40ac02ca7e7d339b3da4d4
parentaded70c2dff5d87e128fefdf1c809c6306dca227
Make RenderObject::containingBlock virtual for better speed and clarity
https://bugs.webkit.org/show_bug.cgi?id=64318

Reviewed by Darin Adler.

No new tests, performance refactoring.

On some of my test cases, this method takes between 3 and 5% of the time spend.
The method makes 2 calls to virtual methods which could be moved to their overriden
version of containingBlock if we made it virtual.

That's what this patch does. It saves between 1 and 2% on some synthetic test cases
as well as made the current method shorter.

* rendering/RenderObject.cpp:
(WebCore::RenderObject::containingBlock): Removed code for RenderView and RenderTableCell,
replaced by ASSERTs.

* rendering/RenderObject.h: Made containingBlock virtual.

* rendering/RenderTableCell.h:
(WebCore::RenderTableCell::containingBlock):
* rendering/RenderView.h:
(WebCore::RenderView::containingBlock):
The code moved from RenderObject is inlined in those 2 methods.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@90882 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderObject.h
Source/WebCore/rendering/RenderTableCell.cpp
Source/WebCore/rendering/RenderTableCell.h
Source/WebCore/rendering/RenderView.cpp
Source/WebCore/rendering/RenderView.h