If a script resource consists of nothing but ASCII characters, we could have CachedScript::script() return a String that just wraps the internal SharedBuffer's contents instead of dragging the data through TextDecoder.
Created attachment 267242 [details] Patch for EWS
Created attachment 267254 [details] Patch
Created attachment 267256 [details] Patch
Comment on attachment 267256 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=267256&action=review Nice, r=me > Source/WebCore/loader/cache/CachedScript.h:65 > + enum ASCIIResourceOptimizationState { Unknown, Optimized, NotOptimized }; > + ASCIIResourceOptimizationState m_ASCIIOptimizationState { Unknown }; Maybe this could be more explicit about what "Optimized" means? Something along the lines of DataAndDecodedStringHaveSameBytes.
Created attachment 267265 [details] Patch for landing
Comment on attachment 267265 [details] Patch for landing Clearing flags on attachment: 267265 Committed r194017: <http://trac.webkit.org/changeset/194017>
All reviewed patches have been landed. Closing bug.
Comment on attachment 267256 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=267256&action=review > Source/WebCore/loader/cache/CachedScript.cpp:74 > + return encoding == "UTF-8" || encoding == "ISO-8859-1" || encoding == "ASCII"; This seems to be way too conservative. Almost all encodings would answer yes for this. Pretty much everything except for UTF-16 and UTF-32, and I think TextEncoding can answer this question. It's strange to be asking this given just a string rather than TextEncoding.