Changeset 133671 in webkit


Ignore:
Timestamp:
Nov 6, 2012 2:12:14 PM (11 years ago)
Author:
commit-queue@webkit.org
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 <esprehn@chromium.org> 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):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r133665 r133671  
     12012-11-06  Elliott Sprehn  <esprehn@chromium.org>
     2
     3        Remove branch from inside RenderObject::view now that renderer() is more expensive
     4        https://bugs.webkit.org/show_bug.cgi?id=101277
     5
     6        Reviewed by Eric Seidel.
     7
     8        It was observed in Bug 100057 that calling renderer() repeatedly now that it has a branch
     9        can be a performance regression. Now that we no longer keep a separate pointer for rare data
     10        in Document, we can use that space for a pointer to the RenderView making RenderObject::view()
     11        faster and removing the branch.
     12
     13        This is a 1% improvement on Parser/html5-full-render.html
     14
     15        This also cleans up the code because it turns out we don't need to have RenderObject::view() in
     16        RenderView.h because we can just call Document::renderView() and not do toRenderView. This makes
     17        it easier to find this method as it exists in the right header file now.
     18
     19        No new tests, this is just a refactor.
     20
     21        * WebCore.exp.in: Remove export of Document::renderView since it's inline now.
     22        * dom/Document.cpp:
     23        (WebCore::Document::Document):
     24        (WebCore::Document::setRenderer):
     25        (WebCore):
     26        * dom/Document.h:
     27        (WebCore::Document::renderView):
     28        (Document):
     29        * rendering/RenderObject.h:
     30        (WebCore::RenderObject::view):
     31        * rendering/RenderView.h:
     32        (WebCore):
     33
    1342012-11-06  Sheriff Bot  <webkit.review.bot@gmail.com>
    235
  • trunk/Source/WebCore/WebCore.exp.in

    r133524 r133671  
    14481448__ZNK7WebCore7IntRectcv6CGRectEv
    14491449__ZNK7WebCore7RunLoop9TimerBase8isActiveEv
    1450 __ZNK7WebCore8Document10renderViewEv
    14511450__ZNK7WebCore8Document11completeURLERKN3WTF6StringE
    14521451__ZNK7WebCore8Document13axObjectCacheEv
  • trunk/Source/WebCore/dom/Document.cpp

    r133631 r133671  
    479479    , m_sawElementsInKnownNamespaces(false)
    480480    , m_isSrcdocDocument(false)
     481    , m_renderView(0)
    481482    , m_eventQueue(DocumentEventQueue::create(this))
    482483    , m_weakReference(DocumentWeakReference::create(this))
     
    20552056}
    20562057
     2058void Document::setRenderer(RenderObject* renderer)
     2059{
     2060    m_renderView = toRenderView(renderer);
     2061    Node::setRenderer(renderer);
     2062}
     2063
    20572064void Document::attach()
    20582065{
     
    21972204        controller->resumeEventsForAllListeners(domWindow());
    21982205#endif
    2199 }
    2200 
    2201 RenderView* Document::renderView() const
    2202 {
    2203     return toRenderView(renderer());
    22042206}
    22052207
  • trunk/Source/WebCore/dom/Document.h

    r133631 r133671  
    557557    RenderArena* renderArena() { return m_renderArena.get(); }
    558558
    559     RenderView* renderView() const;
     559    RenderView* renderView() const { return m_renderView; }
     560    void setRenderer(RenderObject*);
    560561
    561562    void clearAXObjectCache();
     
    14361437    bool m_isSrcdocDocument;
    14371438
     1439    RenderView* m_renderView;
    14381440    RefPtr<DocumentEventQueue> m_eventQueue;
    14391441
  • trunk/Source/WebCore/rendering/RenderObject.h

    r132995 r133671  
    616616    virtual void updateDragState(bool dragOn);
    617617
    618     // Inlined into RenderView.h for performance and to avoid a cyclic dependency.
    619     RenderView* view() const;
     618    RenderView* view() const { return document()->renderView(); };
    620619
    621620    // Returns true if this renderer is rooted, and optionally returns the hosting view (the root of the hierarchy).
  • trunk/Source/WebCore/rendering/RenderView.h

    r133520 r133671  
    350350void toRenderView(const RenderView*);
    351351
    352 
    353 ALWAYS_INLINE RenderView* RenderObject::view() const
    354 {
    355     return toRenderView(document()->renderer());
    356 }
    357 
    358352// Stack-based class to assist with LayoutState push/pop
    359353class LayoutStateMaintainer {
Note: See TracChangeset for help on using the changeset viewer.