Bug 213638

Summary: [JSC] Add Intl.Segmenter
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: JavaScriptCoreAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, benjamin, cdumez, cmarcelo, ews-watchlist, gyuyoung.kim, keith_miller, mark.lam, msaboff, ross.kirsling, ryuan.choi, saam, sergio, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 213425    
Attachments:
Description Flags
Patch
none
Patch
ross.kirsling: review+
Rebaseline, test262
none
Rebaseline + update
none
Patch none

Description Yusuke Suzuki 2020-06-25 21:18:05 PDT
...
Comment 1 Yusuke Suzuki 2020-07-21 19:51:01 PDT
Created attachment 404895 [details]
Patch
Comment 2 Yusuke Suzuki 2020-07-21 19:57:50 PDT
Created attachment 404896 [details]
Patch
Comment 3 Ross Kirsling 2020-07-22 12:00:51 PDT
Comment on attachment 404896 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=404896&action=review

r=me. I'm sad that we don't have test262 tests yet, but it's behind a flag, so we can keep tweaking things.

> Source/JavaScriptCore/runtime/IntlSegmenter.cpp:180
> +        result->putDirect(vm, vm.propertyNames->isWordLike, jsBoolean(!(ruleStatus >= UBRK_WORD_NONE && ruleStatus <= UBRK_WORD_NONE_LIMIT)));

Seems like DeMorgan's rule wouldn't make this less clear?
  jsBoolean(ruleStatus < UBRK_WORD_NONE || ruleStatus > UBRK_WORD_NONE_LIMIT)
Comment 4 Yusuke Suzuki 2020-07-22 13:14:00 PDT
Comment on attachment 404896 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=404896&action=review

Thanks!

>> Source/JavaScriptCore/runtime/IntlSegmenter.cpp:180
>> +        result->putDirect(vm, vm.propertyNames->isWordLike, jsBoolean(!(ruleStatus >= UBRK_WORD_NONE && ruleStatus <= UBRK_WORD_NONE_LIMIT)));
> 
> Seems like DeMorgan's rule wouldn't make this less clear?
>   jsBoolean(ruleStatus < UBRK_WORD_NONE || ruleStatus > UBRK_WORD_NONE_LIMIT)

I think that the current one is clear than < || > form since it is saying rulesStatus is not in this range.
Comment 5 Yusuke Suzuki 2020-07-25 22:44:34 PDT
Created attachment 405242 [details]
Rebaseline, test262
Comment 6 Yusuke Suzuki 2020-07-25 22:46:48 PDT
Update according to https://github.com/tc39/proposal-intl-segmenter/pull/128
Comment 7 Yusuke Suzuki 2020-07-25 22:47:48 PDT
Comment on attachment 405242 [details]
Rebaseline, test262

View in context: https://bugs.webkit.org/attachment.cgi?id=405242&action=review

> JSTests/test262/expectations.yaml:1688
> +test/intl402/Segmenter/prototype/segment/segment-grapheme.js:
> +  default: 'Test262Error: Expected SameValue(«0», «undefined») to be true'
> +  strict mode: 'Test262Error: Expected SameValue(«0», «undefined») to be true'
> +test/intl402/Segmenter/prototype/segment/segment-sentence.js:
> +  default: 'Test262Error: Expected SameValue(«0», «undefined») to be true'
> +  strict mode: 'Test262Error: Expected SameValue(«0», «undefined») to be true'
> +test/intl402/Segmenter/prototype/segment/segment-tostring.js:
> +  default: 'Test262Error: Expected segment "undefined", found "undefined" for arguments  Expected SameValue(«undefined», «undefined») to be true'
> +  strict mode: 'Test262Error: Expected segment "undefined", found "undefined" for arguments  Expected SameValue(«undefined», «undefined») to be true'
> +test/intl402/Segmenter/prototype/segment/segment-word.js:
> +  default: 'Test262Error: Expected SameValue(«0», «undefined») to be true'
> +  strict mode: 'Test262Error: Expected SameValue(«0», «undefined») to be true'

test262 will be fixed in https://github.com/tc39/test262/pull/2714
Comment 8 Yusuke Suzuki 2020-07-25 22:52:48 PDT
Created attachment 405243 [details]
Rebaseline + update
Comment 9 Yusuke Suzuki 2020-07-31 23:21:53 PDT
Created attachment 405769 [details]
Patch

Rebaseline
Comment 10 Yusuke Suzuki 2020-08-22 12:22:30 PDT
Committed r266032: <https://trac.webkit.org/changeset/266032>
Comment 11 Radar WebKit Bug Importer 2020-08-22 12:23:24 PDT
<rdar://problem/67621429>