[Webkit-unassigned] [Bug 112336] New: HTMLIdentifier uses 8-12 bytes when it only needs 4-8

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Mar 14 02:43:33 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=112336

           Summary: HTMLIdentifier uses 8-12 bytes when it only needs 4-8
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: New Bugs
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: eric at webkit.org
                CC: abarth at webkit.org, benjamin at webkit.org,
                    tonyg at chromium.org
            Blocks: 111645


HTMLIdentifier uses 8-12 bytes when it only needs 4-8

http://trac.webkit.org/browser/trunk/Source/WebCore/html/parser/HTMLIdentifier.h#L80

    // FIXME: This could be a union.
    unsigned m_index;
    String m_string;

(I no longer believe that it needs to be a Union, but rather just a StringImpl* with one bit stolen -- perhaps even there is a PointerWithMask template class to help us with this?)

The one masked bit would tell you which mode it was in.  Either we could treat the "known identifier" mode as a StringImpl* to a const (non-reffed) AtomicStringImpl*, or we could use an index (like the current implementation does).

Using a StringImpl* for both the owned and non-owned case is nice because then the nameForIndex function completely disappears!

Basically we'd just be implementing a static version of the AtomicString hash table, which held a known set of AtomicStrings and only exposed StringImpl* access to them.  (And magically acted like a String in the case where the character buffer in question did not match one of our known strings.)

We've sorta implemented a "ThreadPortableAtomicString" of sorts. :)

Making this smaller will also make the maximum memory consumed during speculation smaller, which may affect bug 112335.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list