Bug 101515 - HashAndUTF8CharactersTranslator should create an 8 bit string if possible
Summary: HashAndUTF8CharactersTranslator should create an 8 bit string if possible
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Michael Saboff
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-07 15:12 PST by Michael Saboff
Modified: 2012-11-08 10:48 PST (History)
2 users (show)

See Also:


Attachments
Patch (1.98 KB, patch)
2012-11-07 15:22 PST, Michael Saboff
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Saboff 2012-11-07 15:12:18 PST
HashAndUTF8CharactersTranslator::translate() calls convertUTF8ToUTF16() to turn the UTF8 source into character data.  It should use the optional "is all ASCII" flag parameter to convertUTF8ToUTF16() and create an 8 bit string if the source is all ASCII.
Comment 1 Michael Saboff 2012-11-07 15:22:18 PST
Created attachment 172880 [details]
Patch
Comment 2 Darin Adler 2012-11-08 10:21:57 PST
Comment on attachment 172880 [details]
Patch

Changes like this are better if the change log or comments state why we are doing this. I know why, but I don’t think it’s obvious why this is the right thing to do. You can imagine a different approach where we actually allocated a UTF-16 buffer and scanned it and determined the whole thing was Latin-1 even for non-ASCII cases. Presumably that’s not important, but this optimization is important. Some brief remark about how you decided to do this is needed. The change log you have here is entirely mechanical, and it says what the code does, but what people are interested in more often is why.
Comment 3 WebKit Review Bot 2012-11-08 10:48:02 PST
Comment on attachment 172880 [details]
Patch

Clearing flags on attachment: 172880

Committed r133918: <http://trac.webkit.org/changeset/133918>
Comment 4 WebKit Review Bot 2012-11-08 10:48:05 PST
All reviewed patches have been landed.  Closing bug.