v8/test/test262
jshin b348d47bb9 Use ICU case conversion/transliterator for case conversion
When I18N is enabled, use ICU's case conversion API and transliteration
API [1] to implement String.prototype.to{Upper,Lower}Case and
String.prototype.toLocale{Upper,Lower}Case.

* ICU-based case conversion was implemented in runtime-i18n.cc/i18n.js
* The above 4 functions are overridden with those in i18n.js when
  --icu_case_mapping flag is turned on. To control the override by the flag,
  they're overriden in icu-case-mapping.js

Previously, toLocale{U,L}Case just called to{U,L}Case so that they didn't
support locale-sensitive case conversion for Turkic languages (az, tr),
Greek (el) and Lithuanian (lt).

Before ICU APIs for the most general case are called, a fast-path for Latin-1
is tried. It's taken from Blink and adopted as necessary. This fast path
is always tried for to{U,L}Case. For toLocale{U,L}Case, it's only taken
when a locale (explicitly specified or default) is not in {az, el, lt, tr}.

With these changes, a build with --icu_case_mapping=true passes a bunch
of tests in test262/intl402/Strings/* and intl/* that failed before.

Handling of pure ASCII strings (aligned at word boundary) are not as fast
as Unibrow's implementation that uses word-by-word case conversion. OTOH,
Latin-1 input handling is faster than Unibrow. General Unicode input
handling is slower but more accurate.

See https://docs.google.com/spreadsheets/d/1KJCJxKc1FxFXjwmYqABS0_2cNdPetvnd8gY8_HGSbrg/edit?usp=sharing for the benchmark.

This CL started with http://crrev.com/1544023002#ps200001 by littledan@,
but has changed significantly since.

[1] See why transliteration API is needed for uppercasing in Greek.
    http://bugs.icu-project.org/trac/ticket/10582

R=yangguo
BUG=v8:4476,v8:4477
LOG=Y
TEST=test262/{built-ins,intl402}/Strings/*, webkit/fast/js/*, mjsunit/string-case,
     intl/general/case*

Review-Url: https://codereview.chromium.org/1812673005
Cr-Commit-Position: refs/heads/master@{#36187}
2016-05-11 19:03:04 +00:00
..
archive.py [Swarming] work around slow calls in archive.py 2016-02-24 11:04:22 +00:00
detachArrayBuffer.js Detach ArrayBuffer in test262 2016-04-20 19:44:05 +00:00
harness-adapt.js [test] Copy test262-es6 into test262. 2015-09-25 13:03:36 +00:00
list.py [Swarming] Speed up test262 upload/download. 2016-02-19 14:41:29 +00:00
README Make test262 README file revision independent. 2015-11-04 10:52:44 +00:00
test262.gyp [gn] Move build to gypfiles 2016-04-29 10:11:11 +00:00
test262.isolate test262 roll 2016-05-02 23:02:38 +00:00
test262.status Use ICU case conversion/transliterator for case conversion 2016-05-11 19:03:04 +00:00
testcfg.py Detach ArrayBuffer in test262 2016-04-20 19:44:05 +00:00

This directory contains code for binding the test262 test suite
into the v8 test harness. The tests are checked out as a dependency from

  https://chromium.googlesource.com/external/github.com/tc39/test262

at a revision specified in the DEPS file as 'data' in this directory. They are
fetched with 'gclient sync'. To update to a newer version, please change the
DEPS file.

Using a newer version, e.g. 'deadbeef' may be possible but the tests are only
known to pass (and indeed run) with the DEPS revision. Example:

  cd data
  git fetch
  git checkout deadbeef

If you do update to a newer revision you may have to change the test
harness adapter code since it uses internal functionality from the
harness that comes bundled with the tests.  You will most likely also
have to update the test expectation file.