Commit 31013c06 authored by Matthew Denton's avatar Matthew Denton Committed by Chromium LUCI CQ

Add blink::ContainerNode::hasChildren()

Add blink::ContainerNode::hasChildren() to shadow
blink::Node::hasChildren() to avoid the virtual dispatch that leads to
at least 7-12% regressions in some blink query-selector benchmarks, when
we know the type statically to be ContainerNode. This is especially
bad on Android, where the blink::Node::hasChildren() function is big
enough not be inlined, so we miss out on extra optimizations.

See the linked bug for a more in-depth analysis of the regression.

Bug: 1149340
Change-Id: Ida1d8b609b23ada25ae5ed67826439c74633721c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2633194Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845376}
parent de3c1f1c
......@@ -93,6 +93,7 @@ class CORE_EXPORT ContainerNode : public Node {
Node* firstChild() const { return first_child_; }
Node* lastChild() const { return last_child_; }
bool hasChildren() const { return first_child_; }
bool HasChildren() const { return first_child_; }
bool HasOneChild() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment