Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Issue 12390057: Added back some utf8 optimizations (Closed)

Created:
7 years, 9 months ago by dcarney
Modified:
7 years, 9 months ago
Reviewers:
drcarney, Erik Corry, Yang
CC:
v8-dev
Visibility:
Public.

Description

Added back some utf8 optimizations R=yangguo@chromium.org BUG=https://code.google.com/p/v8/issues/detail?id=2551 Committed: https://code.google.com/p/v8/source/detail?r=13842

Patch Set 1 #

Total comments: 4

Patch Set 2 : addressed comments, rebased #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+306 lines, -79 lines) Patch
M src/api.cc View 1 7 chunks +262 lines, -79 lines 1 comment Download
M src/objects.h View 1 3 chunks +18 lines, -0 lines 0 comments Download
M src/objects-inl.h View 1 1 chunk +26 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Yang
LGTM with comments. https://codereview.chromium.org/12390057/diff/1/src/api.cc File src/api.cc (right): https://codereview.chromium.org/12390057/diff/1/src/api.cc#newcode3919 src/api.cc:3919: if (EndsWithSurrogate(leaf_state)) { something to consider ...
7 years, 9 months ago (2013-03-05 15:32:51 UTC) #1
drcarney
https://codereview.chromium.org/12390057/diff/1/src/api.cc File src/api.cc (right): https://codereview.chromium.org/12390057/diff/1/src/api.cc#newcode3919 src/api.cc:3919: if (EndsWithSurrogate(leaf_state)) { On 2013/03/05 15:32:51, Yang wrote: > ...
7 years, 9 months ago (2013-03-06 15:39:21 UTC) #2
dcarney
Committed manually as r13842 (presubmit successful).
7 years, 9 months ago (2013-03-06 15:40:03 UTC) #3
Erik Corry
7 years, 9 months ago (2013-03-07 09:38:37 UTC) #4
Message was sent while issue was closed.
https://codereview.chromium.org/12390057/diff/4001/src/api.cc
File src/api.cc (right):

https://codereview.chromium.org/12390057/diff/4001/src/api.cc#newcode3864
src/api.cc:3864: int last_character = unibrow::Utf16::kNoPreviousCharacter;
I wonder if it's worth modifying this to take advantage of the fact that Latin1
never has surrogate pairs and the high bit of the character distinguishes 1-byte
from 2-byte UTF-8 encodings.

if (sizeof(Char) == 2) {
  // Current implementation
} else {
  for (int i = 0; i < length; i++) {
    utf8_length += (chars[i] >> 7);  // Assume unsigned.
  }
  utf8_length += length;
}

This has the advantage that there is no branch in the inner loop, which is
normally great for deeply pipelined CPUs.

In general it seems that this could be made vastly simpler for Latin1 strings,
perhaps by having a completely different visitor.  It's really a rather trivial
operation for Latin1 (not as simple as ASCII, but still...)

Powered by Google App Engine
This is Rietveld 408576698