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

Issue 1875263006: Experimental CL on top of https://codereview.chromium.org/1812673005/ (Closed)

Created:
4 years, 8 months ago by jungshik at Google
Modified:
4 years, 7 months ago
Reviewers:
Dan Ehrenberg, adamk
CC:
v8-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/v8/v8.git@caseconv
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Revert to C API for perf el-Upper is not yet supported. BUG=

Patch Set 1 #

Patch Set 2 : Streamline the way ICU API is called. Use do-while with set_length #

Patch Set 3 : copy buffer with ToWideCString: 50~60% slower #

Patch Set 4 : another tweak: greek support added #

Total comments: 2

Patch Set 5 : extend DisallowAloc block #

Total comments: 1

Patch Set 6 : Use toWideCString over flattended string; do not use GetFlatContent #

Patch Set 7 : do not use set_length; call conversion apis twice; add Greek test cases #

Patch Set 8 : back to do-while loop with DisallowHeapAlloc inside the loop per adamk@ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+102 lines, -42 lines) Patch
M src/runtime/runtime-i18n.cc View 1 2 3 4 5 6 7 2 chunks +68 lines, -39 lines 0 comments Download
M test/intl/general/case-mapping.js View 1 2 3 4 5 6 3 chunks +34 lines, -3 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 17 (1 generated)
jungshik at Google
This is not a CL for review, but I'm expeirmenting with this CL on top ...
4 years, 8 months ago (2016-04-14 00:25:14 UTC) #2
jungshik at Google
https://codereview.chromium.org/1875263006/diff/60001/src/runtime/runtime-i18n.cc File src/runtime/runtime-i18n.cc (right): https://codereview.chromium.org/1875263006/diff/60001/src/runtime/runtime-i18n.cc#newcode799 src/runtime/runtime-i18n.cc:799: src = reinterpret_cast<const UChar*>(flat.ToUC16Vector().start()); adamk@ and littledan@: Can you ...
4 years, 8 months ago (2016-04-14 00:32:35 UTC) #3
adamk
https://codereview.chromium.org/1875263006/diff/60001/src/runtime/runtime-i18n.cc File src/runtime/runtime-i18n.cc (right): https://codereview.chromium.org/1875263006/diff/60001/src/runtime/runtime-i18n.cc#newcode799 src/runtime/runtime-i18n.cc:799: src = reinterpret_cast<const UChar*>(flat.ToUC16Vector().start()); What you're doing here is ...
4 years, 8 months ago (2016-04-14 01:56:35 UTC) #4
jungshik at Google
Thanks a lot for the answer. On 2016/04/14 01:56:35, adamk wrote: > https://codereview.chromium.org/1875263006/diff/60001/src/runtime/runtime-i18n.cc > File ...
4 years, 8 months ago (2016-04-14 06:21:21 UTC) #5
jungshik at Google
On 2016/04/14 06:21:21, jshin (jungshik at google) wrote: > Thanks a lot for the answer. ...
4 years, 8 months ago (2016-04-14 07:35:36 UTC) #6
jungshik at Google
|set_length| appears to be the cause of crash with '--verify-heap' command line flag. 1. out/Debug/d8 ...
4 years, 8 months ago (2016-04-14 07:46:32 UTC) #7
jungshik at Google
On 2016/04/14 07:46:32, jshin (jungshik at google) wrote: > |set_length| appears to be the cause ...
4 years, 8 months ago (2016-04-14 08:13:40 UTC) #8
jungshik at Google
Because I don't know how to avoid a crash with '--verify-heap' when |set_length| is used, ...
4 years, 8 months ago (2016-04-14 09:10:28 UTC) #9
jungshik at Google
On 2016/04/14 09:10:28, jshin (jungshik at google) wrote: > Because I don't know how to ...
4 years, 8 months ago (2016-04-14 09:12:59 UTC) #10
adamk
Can't respond to each of the last messages in detail, but I missed what sort ...
4 years, 8 months ago (2016-04-14 16:09:56 UTC) #11
jungshik at Google
On 2016/04/14 16:09:56, adamk wrote: > Can't respond to each of the last messages in ...
4 years, 8 months ago (2016-04-14 17:39:08 UTC) #12
adamk
On 2016/04/14 17:39:08, jshin (jungshik at google) wrote: > On 2016/04/14 16:09:56, adamk wrote: > ...
4 years, 8 months ago (2016-04-14 21:22:29 UTC) #13
jungshik at Google
On 2016/04/14 21:22:29, adamk wrote: > On 2016/04/14 17:39:08, jshin (jungshik at google) wrote: > ...
4 years, 8 months ago (2016-04-14 23:50:04 UTC) #14
jungshik at Google
On 2016/04/14 23:50:04, jshin (jungshik at google) wrote: > 1. I cannot use set_length to ...
4 years, 8 months ago (2016-04-15 00:16:59 UTC) #15
adamk
On 2016/04/14 23:50:04, jshin (jungshik at google) wrote: > On 2016/04/14 21:22:29, adamk wrote: > ...
4 years, 8 months ago (2016-04-15 00:20:29 UTC) #16
jungshik at Google
4 years, 8 months ago (2016-04-15 08:46:22 UTC) #17
On 2016/04/15 00:20:29, adamk wrote:

> There's no way to do this. If you create a second string, that invalidates the
> FlatContent. I'm still trying to swap this whole thing into my head (was
> previously just answering your specific questions), but one way to structure
> this code would be, in pseudo-code:
> 
> '''
> do {
>   length = expected_length
>   result = allocate_string(length)
>   {
>     DisallowHeapAllocation no_gc;
>     FlatContent flat = src_string->GetFlatContent();
>     src = flat.ToWhatever()
>     attempt_conversion(src, result, length, &required_length) 
>   }
>   expected_length = required_length
> } while (required_length > length)
> 
> if (required_length < length) {
>   result = SeqString::Truncate(result, required_length)
> }

Thanks a lot for the suggestion. It works well. 

I was too fixated on getting the pointer to the input string (|src|) before
starting any real work to see this 
approach. It works well except that I have to live with a little bit of the code
duplication ( GetFlatContent, UC16Vector, etc) for Greek uppercasing
and all other cases el-Upper has to be handled separately for now for the reason
given in the comment in the CL. I also got |src| to point to
a buffer obtained with |ToWideCString| in rare case of OneByteString coming to
this function at the beginning so that it can be shared by both 
el-Upper and the rest and it does not have to be reinitialized in the second
time 'do-while' loop is run (buffer overflow case). 

I'll move this back to the original CL
(https://codereview.chromium.org/1812673005/) and ask for review there. (I'll be
ooo Friday so that it may be early next week).

Powered by Google App Engine
This is Rietveld 408576698