Event dispatch: Avoid heap allocations in ensureEventAncestors() typical case.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2012 00:20:23 +0000 (00:20 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2012 00:20:23 +0000 (00:20 +0000)
commit8aa19933cb8c5ce432d836b6e2146d9650a5f0ec
tree4098851688a7ea12c788428b8fa43a0919a84f96
parentebf840dce02d48b0ef65ce2ea3da6d62df26d30e
Event dispatch: Avoid heap allocations in ensureEventAncestors() typical case.
<http://webkit.org/b/104938>

Reviewed by Anders Carlsson.

Give the EventTarget and EventContext vectors an inline capacity of 32 (no science here, just a
non-zero number.) As these vectors are created on the stack already, this is merely using a bit
more stack space to avoid malloc()ing all the gosh-darn time.

Looks like ~6% improvement on Dromaeo/jslib-event-prototype.

* dom/EventDispatcher.cpp:
(WebCore::EventRelatedTargetAdjuster::adjust):
(WebCore::EventRelatedTargetAdjuster::findRelatedTarget):
(WebCore::EventDispatcher::ensureEventAncestors):
* dom/EventDispatcher.h:
(EventRelatedTargetAdjuster):
(EventDispatcher):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137680 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/dom/EventDispatcher.cpp
Source/WebCore/dom/EventDispatcher.h