Title: [136481] trunk/Source/WebCore
- Revision
- 136481
- Author
- [email protected]
- Date
- 2012-12-04 00:04:26 -0800 (Tue, 04 Dec 2012)
Log Message
Change ChildNodeInsertionNotifier::m_postInsertionsNotificationTargets from a Vector to an OwnPtr
https://bugs.webkit.org/show_bug.cgi?id=103868
Reviewed by Darin Adler.
ChildNodeInsertionNotifier::m_postInsertionsNotificationTargets is
used for HTMLFrameElement and HTMLBodyElement only, which would be
a cold path. We can change it from a Vector to an OwnPtr<Vector>
so that ChildNodeInsertionNotifier can be allocated faster. This patch
optimizes Dromaeo/dom-modify by 1.4%.
[Dromaeo/dom-modify in Chromium/Linux]
Before: 4532 runs/sec, 4545 runs/sec, 4530 runs/sec, 4536 runs/sec
After: 4595 runs/sec, 4606 runs/sec, 4597 runs/sec, 4602 runs/sec
No tests. No change in behavior.
* dom/ContainerNodeAlgorithms.h:
(ChildNodeInsertionNotifier):
(WebCore::ChildNodeInsertionNotifier::notifyNodeInsertedIntoDocument):
(WebCore::ChildNodeInsertionNotifier::notifyNodeInsertedIntoTree):
(WebCore::ChildNodeInsertionNotifier::notify):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (136480 => 136481)
--- trunk/Source/WebCore/ChangeLog 2012-12-04 07:48:41 UTC (rev 136480)
+++ trunk/Source/WebCore/ChangeLog 2012-12-04 08:04:26 UTC (rev 136481)
@@ -1,3 +1,28 @@
+2012-12-04 Kentaro Hara <[email protected]>
+
+ Change ChildNodeInsertionNotifier::m_postInsertionsNotificationTargets from a Vector to an OwnPtr
+ https://bugs.webkit.org/show_bug.cgi?id=103868
+
+ Reviewed by Darin Adler.
+
+ ChildNodeInsertionNotifier::m_postInsertionsNotificationTargets is
+ used for HTMLFrameElement and HTMLBodyElement only, which would be
+ a cold path. We can change it from a Vector to an OwnPtr<Vector>
+ so that ChildNodeInsertionNotifier can be allocated faster. This patch
+ optimizes Dromaeo/dom-modify by 1.4%.
+
+ [Dromaeo/dom-modify in Chromium/Linux]
+ Before: 4532 runs/sec, 4545 runs/sec, 4530 runs/sec, 4536 runs/sec
+ After: 4595 runs/sec, 4606 runs/sec, 4597 runs/sec, 4602 runs/sec
+
+ No tests. No change in behavior.
+
+ * dom/ContainerNodeAlgorithms.h:
+ (ChildNodeInsertionNotifier):
+ (WebCore::ChildNodeInsertionNotifier::notifyNodeInsertedIntoDocument):
+ (WebCore::ChildNodeInsertionNotifier::notifyNodeInsertedIntoTree):
+ (WebCore::ChildNodeInsertionNotifier::notify):
+
2012-12-03 Rafael Weinstein <[email protected]>
Unreviewed build fix after r136467
Modified: trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h (136480 => 136481)
--- trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h 2012-12-04 07:48:41 UTC (rev 136480)
+++ trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h 2012-12-04 08:04:26 UTC (rev 136481)
@@ -47,7 +47,7 @@
void notifyNodeInsertedIntoTree(ContainerNode*);
ContainerNode* m_insertionPoint;
- Vector< RefPtr<Node> > m_postInsertionNotificationTargets;
+ OwnPtr<Vector<RefPtr<Node> > > m_postInsertionNotificationTargets;
};
class ChildNodeRemovalNotifier {
@@ -194,8 +194,11 @@
{
ASSERT(m_insertionPoint->inDocument());
RefPtr<Node> protect(node);
- if (Node::InsertionShouldCallDidNotifySubtreeInsertions == node->insertedInto(m_insertionPoint))
- m_postInsertionNotificationTargets.append(node);
+ if (Node::InsertionShouldCallDidNotifySubtreeInsertions == node->insertedInto(m_insertionPoint)) {
+ if (!m_postInsertionNotificationTargets)
+ m_postInsertionNotificationTargets = adoptPtr(new Vector<RefPtr<Node> >);
+ m_postInsertionNotificationTargets->append(node);
+ }
if (node->isContainerNode())
notifyDescendantInsertedIntoDocument(toContainerNode(node));
}
@@ -205,8 +208,11 @@
NoEventDispatchAssertion assertNoEventDispatch;
ASSERT(!m_insertionPoint->inDocument());
- if (Node::InsertionShouldCallDidNotifySubtreeInsertions == node->insertedInto(m_insertionPoint))
- m_postInsertionNotificationTargets.append(node);
+ if (Node::InsertionShouldCallDidNotifySubtreeInsertions == node->insertedInto(m_insertionPoint)) {
+ if (!m_postInsertionNotificationTargets)
+ m_postInsertionNotificationTargets = adoptPtr(new Vector<RefPtr<Node> >);
+ m_postInsertionNotificationTargets->append(node);
+ }
notifyDescendantInsertedIntoTree(node);
}
@@ -231,8 +237,10 @@
else if (node->isContainerNode())
notifyNodeInsertedIntoTree(toContainerNode(node));
- for (size_t i = 0; i < m_postInsertionNotificationTargets.size(); ++i)
- m_postInsertionNotificationTargets[i]->didNotifySubtreeInsertions(m_insertionPoint);
+ if (m_postInsertionNotificationTargets) {
+ for (size_t i = 0; i < m_postInsertionNotificationTargets->size(); ++i)
+ m_postInsertionNotificationTargets->at(i)->didNotifySubtreeInsertions(m_insertionPoint);
+ }
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes