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

Issue 9600009: Fix input and output to handle UTF16 surrogate pairs. (Closed)

Created:
8 years, 9 months ago by Erik Corry
Modified:
8 years, 9 months ago
CC:
v8-dev
Visibility:
Public.

Description

Fix input and output to handle UTF16 surrogate pairs. Committed: https://code.google.com/p/v8/source/detail?r=11007

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 32

Patch Set 4 : #

Total comments: 9
Unified diffs Side-by-side diffs Delta from patch set Stats (+812 lines, -295 lines) Patch
M src/api.cc View 1 2 3 6 chunks +32 lines, -12 lines 0 comments Download
M src/arm/regexp-macro-assembler-arm.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M src/debug-agent.cc View 1 2 3 2 chunks +24 lines, -5 lines 0 comments Download
M src/globals.h View 1 1 chunk +2 lines, -1 line 0 comments Download
M src/handles.h View 1 2 3 1 chunk +3 lines, -0 lines 2 comments Download
M src/handles.cc View 1 2 3 1 chunk +158 lines, -0 lines 3 comments Download
M src/heap.cc View 1 5 chunks +25 lines, -11 lines 0 comments Download
M src/hydrogen-instructions.h View 1 1 chunk +1 line, -1 line 0 comments Download
M src/ia32/regexp-macro-assembler-ia32.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M src/jsregexp.cc View 1 12 chunks +14 lines, -14 lines 0 comments Download
M src/log.cc View 1 2 3 2 chunks +9 lines, -7 lines 0 comments Download
M src/objects.h View 1 2 3 3 chunks +8 lines, -6 lines 0 comments Download
M src/objects.cc View 1 2 3 7 chunks +35 lines, -74 lines 0 comments Download
M src/objects-inl.h View 1 2 chunks +10 lines, -2 lines 0 comments Download
M src/parser.h View 1 4 chunks +4 lines, -4 lines 0 comments Download
M src/parser.cc View 1 8 chunks +14 lines, -14 lines 0 comments Download
M src/preparse-data.h View 1 3 chunks +3 lines, -3 lines 0 comments Download
M src/preparser.h View 1 1 chunk +1 line, -1 line 0 comments Download
M src/preparser.cc View 1 4 chunks +4 lines, -4 lines 0 comments Download
M src/preparser-api.cc View 1 5 chunks +18 lines, -12 lines 0 comments Download
M src/scanner.h View 1 8 chunks +41 lines, -38 lines 0 comments Download
M src/scanner.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M src/scanner-character-streams.h View 1 4 chunks +17 lines, -17 lines 0 comments Download
M src/scanner-character-streams.cc View 1 13 chunks +51 lines, -35 lines 0 comments Download
M src/unicode.h View 1 2 3 5 chunks +46 lines, -3 lines 4 comments Download
M src/unicode.cc View 1 2 chunks +11 lines, -0 lines 0 comments Download
M src/unicode-inl.h View 1 2 3 3 chunks +13 lines, -2 lines 0 comments Download
M src/x64/regexp-macro-assembler-x64.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M test/cctest/test-api.cc View 1 4 chunks +224 lines, -2 lines 0 comments Download
M test/cctest/test-parsing.cc View 1 2 3 17 chunks +40 lines, -23 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
Erik Corry
8 years, 9 months ago (2012-03-06 15:23:44 UTC) #1
rossberg
I feel slightly uncomfortable making this change while the ongoing discussion is still in flight, ...
8 years, 9 months ago (2012-03-07 13:32:46 UTC) #2
Lasse Reichstein Nielsen
https://chromiumcodereview.appspot.com/9600009/diff/14003/src/scanner-character-streams.h File src/scanner-character-streams.h (right): https://chromiumcodereview.appspot.com/9600009/diff/14003/src/scanner-character-streams.h#newcode52 src/scanner-character-streams.h:52: virtual void SlowPushBack(uc16 character); uc16->uc32 or utf16?
8 years, 9 months ago (2012-03-08 09:02:40 UTC) #3
Erik Corry
New version uploaded http://codereview.chromium.org/9600009/diff/14003/src/debug-agent.cc File src/debug-agent.cc (right): http://codereview.chromium.org/9600009/diff/14003/src/debug-agent.cc#newcode405 src/debug-agent.cc:405: int kEncodedSurrogateLength = 3; On 2012/03/07 ...
8 years, 9 months ago (2012-03-11 19:29:22 UTC) #4
rossberg
lgtm https://chromiumcodereview.appspot.com/9600009/diff/18001/src/handles.cc File src/handles.cc (right): https://chromiumcodereview.appspot.com/9600009/diff/18001/src/handles.cc#newcode952 src/handles.cc:952: while (failure) { Nit: this seems more natural ...
8 years, 9 months ago (2012-03-12 10:55:04 UTC) #5
Erik Corry
Committed with a somewhat beefed up test-parsing.cc https://chromiumcodereview.appspot.com/9600009/diff/18001/src/handles.cc File src/handles.cc (right): https://chromiumcodereview.appspot.com/9600009/diff/18001/src/handles.cc#newcode952 src/handles.cc:952: while (failure) ...
8 years, 9 months ago (2012-03-12 12:34:10 UTC) #6
Sven Panne
8 years, 9 months ago (2012-03-12 13:00:44 UTC) #7
https://chromiumcodereview.appspot.com/9600009/diff/18001/src/handles.cc
File src/handles.cc (right):

https://chromiumcodereview.appspot.com/9600009/diff/18001/src/handles.cc#newc...
src/handles.cc:952: while (failure) {
On 2012/03/12 12:34:10, Erik Corry wrote:
> On 2012/03/12 10:55:05, rossberg wrote:
> > Nit: this seems more natural as a do-while loop.
> 
> I made it into a do-while, but it's no better (same line count, flag must
still
> be declared outside the loop, still have to test the flag twice).

Just an unsolicited comment from my side: For stuff like that I usually prefer a
C/C++ emulation of Dahl's loop/while/repeat. Alas, compilers are sometimes a bit
too dumb, so an additional line has to be appended:

int Utf8Length(Handle<String> str) {
  const int kRecursionBudget = 100;
  while (true) {
    bool failure = false, dummy;
    int len = Utf8LengthHelper(
        *str, 0, str->length(), false, kRecursionBudget, &failure, &dummy);
    if (!failure) return len;
    FlattenString(str);
  }
  return 0;  // Keep the compiler happy.
}

Using a "Remove Double Negative" refactoring might make this even more clear
(failure => ok).

Powered by Google App Engine
This is Rietveld 408576698