DescriptionUse StringView for String and AtomicString operator==.
This allows the compiler to compute the length of literal strings that
are compared and then we can early abort comparing if the length is
different.
This does introduce a strlen call for non-literal strings, which we
have very few of today.
This patch fixes the web idl enum checking loop to use WTF::equal to
avoid the strlen since that seemed like an easy way to remove lots of strlen
calls. We can make other callers use a similar approach in the future if
if we see strlen on profiles.
By code auditing (with code search method finding) I noticed a few other
places will now call strlen (ex. iframe sandbox and permissions attribute
parsing) but this patch opts not to convert all places we now call strlen and
instead go for the simple path of fixing those if we run into problems. This
is a similar trade off to code elsewhere in Chromium that uses
base::StringPiece which also puts a strlen call for non-literal strings.
I also took this as an opportunity to remove the operator== methods which aren't
used for things like LChar* (strangely UChar* was missing) and Vector<char>.
BUG=678266
Review-Url: https://codereview.chromium.org/2614123002
Cr-Commit-Position: refs/heads/master@{#441914}
Committed: https://chromium.googlesource.com/chromium/src/+/e827c1a786ea596461b2c76ba6dafffd40f1bec8
Patch Set 1 #
Messages
Total messages: 16 (10 generated)
|