Commit 30a350f2 authored by Frank Tang's avatar Frank Tang Committed by Commit Bot

[Intl] Clean up icu include and #ifdef

Requires ICU 63 or above be used when building v8
1. Remove unneeded #include of icu header files
2. Remove code inside "#if U_ICU_VERSION_MAJOR_NUM < x"
block where x is 63 or smaller.



Bug: v8:8401 v8:5751
Change-Id: I908b0d7d174df53d4296580fe7150417322b0b21
Reviewed-on: https://chromium-review.googlesource.com/c/1314112Reviewed-by: 's avatarJungshik Shin <jshin@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57341}
parent 0a7e08ef
......@@ -69,9 +69,6 @@
#include "src/wasm/wasm-engine.h"
#include "src/wasm/wasm-objects.h"
#include "src/zone/accounting-allocator.h"
#ifdef V8_INTL_SUPPORT
#include "unicode/regex.h"
#endif // V8_INTL_SUPPORT
namespace v8 {
namespace internal {
......@@ -2888,19 +2885,6 @@ Isolate::~Isolate() {
delete date_cache_;
date_cache_ = nullptr;
#ifdef V8_INTL_SUPPORT
#if USE_CHROMIUM_ICU == 0 && U_ICU_VERSION_MAJOR_NUM < 63
delete language_singleton_regexp_matcher_;
language_singleton_regexp_matcher_ = nullptr;
delete language_tag_regexp_matcher_;
language_tag_regexp_matcher_ = nullptr;
delete language_variant_regexp_matcher_;
language_variant_regexp_matcher_ = nullptr;
#endif // USE_CHROMIUM_ICU == 0 && U_ICU_VERSION_MAJOR_NUM < 63
#endif // V8_INTL_SUPPORT
delete regexp_stack_;
regexp_stack_ = nullptr;
......
......@@ -36,16 +36,6 @@
#include "src/thread-id.h"
#include "src/unicode.h"
#ifdef V8_INTL_SUPPORT
#include "unicode/uversion.h" // Define U_ICU_NAMESPACE.
// 'icu' does not work. Use U_ICU_NAMESPACE.
namespace U_ICU_NAMESPACE {
class RegexMatcher;
} // namespace U_ICU_NAMESPACE
#endif // V8_INTL_SUPPORT
namespace v8 {
namespace base {
......@@ -1190,19 +1180,6 @@ class Isolate final : private HiddenFactory {
}
#ifdef V8_INTL_SUPPORT
#if USE_CHROMIUM_ICU == 0 && U_ICU_VERSION_MAJOR_NUM < 63
icu::RegexMatcher* language_singleton_regexp_matcher() {
return language_singleton_regexp_matcher_;
}
icu::RegexMatcher* language_tag_regexp_matcher() {
return language_tag_regexp_matcher_;
}
icu::RegexMatcher* language_variant_regexp_matcher() {
return language_variant_regexp_matcher_;
}
#endif // USE_CHROMIUM_ICU == 0 && U_ICU_VERSION_MAJOR_NUM < 63
const std::string& default_locale() { return default_locale_; }
......@@ -1211,19 +1188,6 @@ class Isolate final : private HiddenFactory {
default_locale_ = locale;
}
#if USE_CHROMIUM_ICU == 0 && U_ICU_VERSION_MAJOR_NUM < 63
void set_language_tag_regexp_matchers(
icu::RegexMatcher* language_singleton_regexp_matcher,
icu::RegexMatcher* language_tag_regexp_matcher,
icu::RegexMatcher* language_variant_regexp_matcher) {
DCHECK_NULL(language_singleton_regexp_matcher_);
DCHECK_NULL(language_tag_regexp_matcher_);
DCHECK_NULL(language_variant_regexp_matcher_);
language_singleton_regexp_matcher_ = language_singleton_regexp_matcher;
language_tag_regexp_matcher_ = language_tag_regexp_matcher;
language_variant_regexp_matcher_ = language_variant_regexp_matcher;
}
#endif // USE_CHROMIUM_ICU == 0 && U_ICU_VERSION_MAJOR_NUM < 63
#endif // V8_INTL_SUPPORT
static const int kProtectorValid = 1;
......@@ -1766,11 +1730,6 @@ class Isolate final : private HiddenFactory {
double load_start_time_ms_ = 0;
#ifdef V8_INTL_SUPPORT
#if USE_CHROMIUM_ICU == 0 && U_ICU_VERSION_MAJOR_NUM < 63
icu::RegexMatcher* language_singleton_regexp_matcher_ = nullptr;
icu::RegexMatcher* language_tag_regexp_matcher_ = nullptr;
icu::RegexMatcher* language_variant_regexp_matcher_ = nullptr;
#endif // USE_CHROMIUM_ICU == 0 && U_ICU_VERSION_MAJOR_NUM < 63
std::string default_locale_;
#endif // V8_INTL_SUPPORT
......
This diff is collapsed.
......@@ -20,7 +20,6 @@
#include "unicode/calendar.h"
#include "unicode/dtptngen.h"
#include "unicode/gregocal.h"
#include "unicode/numsys.h"
#include "unicode/smpdtfmt.h"
#include "unicode/unistr.h"
......
......@@ -15,6 +15,7 @@
#include "src/isolate.h"
#include "src/objects/intl-objects.h"
#include "src/objects/managed.h"
#include "unicode/uversion.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
......
......@@ -20,15 +20,10 @@
#include "src/objects-inl.h"
#include "src/objects/intl-objects.h"
#include "src/objects/js-locale-inl.h"
#include "unicode/char16ptr.h"
#include "unicode/locid.h"
#include "unicode/uloc.h"
#include "unicode/unistr.h"
#include "unicode/uvernum.h"
#include "unicode/uversion.h"
#if U_ICU_VERSION_MAJOR_NUM >= 59
#include "unicode/char16ptr.h"
#endif
namespace v8 {
namespace internal {
......
......@@ -18,8 +18,6 @@
#include "unicode/decimfmt.h"
#include "unicode/locid.h"
#include "unicode/numfmt.h"
#include "unicode/strenum.h"
#include "unicode/ucurr.h"
#include "unicode/uloc.h"
namespace v8 {
......
......@@ -15,7 +15,6 @@
#include "unicode/locid.h"
#include "unicode/numfmt.h"
#include "unicode/plurrule.h"
#include "unicode/strenum.h"
namespace v8 {
namespace internal {
......
......@@ -21,7 +21,6 @@
#include "unicode/datefmt.h"
#include "unicode/numfmt.h"
#include "unicode/reldatefmt.h"
#include "unicode/uvernum.h" // for U_ICU_VERSION_MAJOR_NUM
namespace v8 {
namespace internal {
......@@ -368,19 +367,12 @@ MaybeHandle<Object> JSRelativeTimeFormat::Format(
UErrorCode status = U_ZERO_ERROR;
icu::UnicodeString formatted;
#if USE_CHROMIUM_ICU != 1 && U_ICU_VERSION_MAJOR_NUM < 63
if (unit_enum != UDAT_REL_UNIT_QUARTER) { // ICU did not implement
// UDAT_REL_UNIT_QUARTER < 63
#endif // USE_CHROMIUM_ICU != 1 && U_ICU_VERSION_MAJOR_NUM < 63
if (format_holder->numeric() == JSRelativeTimeFormat::Numeric::ALWAYS) {
formatter->formatNumeric(number, unit_enum, formatted, status);
} else {
DCHECK_EQ(JSRelativeTimeFormat::Numeric::AUTO, format_holder->numeric());
formatter->format(number, unit_enum, formatted, status);
}
#if USE_CHROMIUM_ICU != 1 && U_ICU_VERSION_MAJOR_NUM < 63
if (format_holder->numeric() == JSRelativeTimeFormat::Numeric::ALWAYS) {
formatter->formatNumeric(number, unit_enum, formatted, status);
} else {
DCHECK_EQ(JSRelativeTimeFormat::Numeric::AUTO, format_holder->numeric());
formatter->format(number, unit_enum, formatted, status);
}
#endif // USE_CHROMIUM_ICU != 1 && U_ICU_VERSION_MAJOR_NUM < 63
if (U_FAILURE(status)) {
THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kIcuError), Object);
......
......@@ -17,9 +17,6 @@
#ifdef V8_INTL_SUPPORT
#include "unicode/uniset.h"
// TODO(mathias): Remove this when we no longer need to check
// `U_ICU_VERSION_MAJOR_NUM`.
#include "unicode/uvernum.h"
#endif // V8_INTL_SUPPORT
namespace v8 {
......@@ -1296,15 +1293,11 @@ bool IsSupportedBinaryProperty(UProperty property) {
case UCHAR_DEPRECATED:
case UCHAR_DIACRITIC:
case UCHAR_EMOJI:
#if U_ICU_VERSION_MAJOR_NUM >= 60
case UCHAR_EMOJI_COMPONENT:
#endif
case UCHAR_EMOJI_MODIFIER_BASE:
case UCHAR_EMOJI_MODIFIER:
case UCHAR_EMOJI_PRESENTATION:
#if U_ICU_VERSION_MAJOR_NUM >= 62
case UCHAR_EXTENDED_PICTOGRAPHIC:
#endif
case UCHAR_EXTENDER:
case UCHAR_GRAPHEME_BASE:
case UCHAR_GRAPHEME_EXTEND:
......@@ -1323,9 +1316,7 @@ bool IsSupportedBinaryProperty(UProperty property) {
case UCHAR_PATTERN_WHITE_SPACE:
case UCHAR_QUOTATION_MARK:
case UCHAR_RADICAL:
#if U_ICU_VERSION_MAJOR_NUM >= 60
case UCHAR_REGIONAL_INDICATOR:
#endif
case UCHAR_S_TERM:
case UCHAR_SOFT_DOTTED:
case UCHAR_TERMINAL_PUNCTUATION:
......
......@@ -28,30 +28,6 @@
#include "src/runtime/runtime-utils.h"
#include "src/utils.h"
#include "unicode/brkiter.h"
#include "unicode/calendar.h"
#include "unicode/coll.h"
#include "unicode/curramt.h"
#include "unicode/datefmt.h"
#include "unicode/dcfmtsym.h"
#include "unicode/decimfmt.h"
#include "unicode/dtfmtsym.h"
#include "unicode/dtptngen.h"
#include "unicode/locid.h"
#include "unicode/numfmt.h"
#include "unicode/numsys.h"
#include "unicode/plurrule.h"
#include "unicode/smpdtfmt.h"
#include "unicode/timezone.h"
#include "unicode/uchar.h"
#include "unicode/ucol.h"
#include "unicode/ucurr.h"
#include "unicode/uloc.h"
#include "unicode/unistr.h"
#include "unicode/unum.h"
#include "unicode/uversion.h"
namespace v8 {
namespace internal {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment