Bug 75068 - Make elements with attributes smaller by eliminating the reference count in NamedNodeMap
Summary: Make elements with attributes smaller by eliminating the reference count in N...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-21 23:34 PST by Darin Adler
Modified: 2019-02-06 09:02 PST (History)
6 users (show)

See Also:


Attachments
Proposed patch (11.84 KB, patch)
2012-01-05 01:49 PST, Andreas Kling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2011-12-21 23:34:48 PST
We should remove the separate reference count stored in each NamedNodeMap. An easy immediate way to do that would be by using OwnPtr instead of RefPtr to hold the map on each Element, and changing the ref and deref functions to simply ref and deref the owning element instead of the map itself.
Comment 1 Ryosuke Niwa 2011-12-21 23:38:15 PST
(In reply to comment #0)
> We should remove the separate reference count stored in each NamedNodeMap. An easy immediate way to do that would be by using OwnPtr instead of RefPtr to hold the map on each Element, and changing the ref and deref functions to simply ref and deref the owning element instead of the map itself.

I'm not sure which ref/deref functions you're talking about. Could you elaborate a little?
Comment 2 Darin Adler 2011-12-21 23:45:33 PST
NamedNodeMap would no longer derive from RefCounted. Instead it would implement ref and deref like this:

    void ref() { m_element->ref(); }
    void deref() { m_element->deref(); }

The JavaScript bindings, and any other code for that matter, can still use a RefPtr on the NamedNodeMap, but the actual reference counting is done on the element, which is fine since the lifetimes of the two objects are tied together.
Comment 3 Andreas Kling 2012-01-05 01:49:28 PST
Created attachment 121242 [details]
Proposed patch
Comment 4 Antti Koivisto 2012-01-05 02:01:10 PST
Comment on attachment 121242 [details]
Proposed patch

r=me
Comment 5 Andreas Kling 2012-01-05 02:18:26 PST
Comment on attachment 121242 [details]
Proposed patch

Clearing flags on attachment: 121242

Committed r104130: <http://trac.webkit.org/changeset/104130>
Comment 6 Andreas Kling 2012-01-05 02:18:37 PST
All reviewed patches have been landed.  Closing bug.
Comment 7 Ojan Vafai 2012-01-05 11:00:05 PST
Comment on attachment 121242 [details]
Proposed patch

In the future, when improving the size of an class, consider adding a COMPILE_ASSERT of the size so that we can keep it from regressing in the future.
Comment 8 Lucas Forschler 2019-02-06 09:02:53 PST
Mass moving XML DOM bugs to the "DOM" Component.