Issue #2678 - Make QIing to a few often-used CCed classes faster.

QIing to CC interfaces is a hot path for a few widely-used classes.
Presumably there are many of these objects being created and destroyed.
By making these classes check first for the CC interfaces directly, rather
than going up the inheritance chain, the resulting overhead is reduced.
This commit is contained in:
Moonchild 2025-01-17 15:52:11 +01:00 committed by roytam1
commit 85f8f23a23
2 changed files with 12 additions and 5 deletions

View file

@ -97,8 +97,13 @@ nsTextNode::~nsTextNode()
{
}
NS_IMPL_ISUPPORTS_INHERITED(nsTextNode, nsGenericDOMDataNode, nsIDOMNode,
nsIDOMText, nsIDOMCharacterData)
// Using the CC variant of this, even though this class does not define
// a new CC participant, to make QIing to the CC interfaces faster.
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(nsTextNode,
nsGenericDOMDataNode,
nsIDOMNode,
nsIDOMText,
nsIDOMCharacterData)
JSObject*
nsTextNode::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)