12012-11-01 Elliott Sprehn <esprehn@chromium.org>
2
3 Replace NodeRareData hash map with a union on m_renderer
4 https://bugs.webkit.org/show_bug.cgi?id=100057
5
6 Reviewed by Eric Seidel.
7
8 Use a union on Node::m_renderer between NodeRareData* and RenderObject*. This removes
9 the overhead of accessing rare data and the memory from the map. We now get the 5%
10 performance increase observed in Bug 90059 but when accessing node lists on any node.
11
12 By removing the overhead of rareData() this patch addresses the performance issues
13 raised in Bugs 73853, 87034 and 89635.
14
15 This is also a 15% improvement on Parser/textarea-parsing.html
16
17 I ran Parser/html5-full-render.html and there was no performance regression after
18 tuning Text::recalcTextStyle and the refactor that was done in r132684.
19
20 No new tests, this is just a refactor.
21
22 * dom/Document.cpp:
23 (WebCore::Document::Document):
24 * dom/Document.h:
25 (WebCore::Node::Node):
26 * dom/Element.cpp:
27 (WebCore::Element::elementRareData):
28 * dom/Node.cpp:
29 (WebCore::Node::rareData):
30 (WebCore::Node::ensureRareData):
31 (WebCore::Node::clearRareData):
32 (WebCore::Node::renderBox):
33 (WebCore::Node::renderBoxModelObject):
34 (WebCore::Node::reportMemoryUsage):
35 * dom/Node.h:
36 (NodeRareDataBase):
37 Base class for NodeRareData that knows about the renderer so we can
38 inline the accesses in Node.h
39 (WebCore::NodeRareDataBase::renderer):
40 (WebCore::NodeRareDataBase::setRenderer):
41 (WebCore::NodeRareDataBase::~NodeRareDataBase):
42 (WebCore::NodeRareDataBase::NodeRareDataBase):
43 (WebCore):
44 (WebCore::Node::renderer):
45 (WebCore::Node::setRenderer):
46 (Node):
47 * dom/NodeRareData.h:
48 * dom/NodeRenderStyle.h:
49 (WebCore::Node::renderStyle):
50 * dom/Text.cpp:
51 (WebCore::Text::recalcTextStyle):
52 This method appears very hot in html5-full-render.html and accessing the
53 renderer 4 times caused a 2% performance regression with this patch. I
54 reduced it to 1 access and there's no longer any performance regression.
55