Commit 5fc196ac authored by Frank Tang's avatar Frank Tang Committed by Commit Bot

Change CHECK to DCHECK

Bug: v8:10753
Change-Id: Icbdc6d7ee0634d32b262860dd64c4bfccebdcc00
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2317064Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69053}
parent 3cbe36a7
...@@ -438,7 +438,7 @@ Maybe<icu::Locale> CreateICULocale(const std::string& bcp47_locale) { ...@@ -438,7 +438,7 @@ Maybe<icu::Locale> CreateICULocale(const std::string& bcp47_locale) {
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
icu::Locale icu_locale = icu::Locale::forLanguageTag(bcp47_locale, status); icu::Locale icu_locale = icu::Locale::forLanguageTag(bcp47_locale, status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
if (icu_locale.isBogus()) { if (icu_locale.isBogus()) {
return Nothing<icu::Locale>(); return Nothing<icu::Locale>();
} }
...@@ -586,7 +586,7 @@ Maybe<std::string> Intl::ToLanguageTag(const icu::Locale& locale) { ...@@ -586,7 +586,7 @@ Maybe<std::string> Intl::ToLanguageTag(const icu::Locale& locale) {
if (U_FAILURE(status)) { if (U_FAILURE(status)) {
return Nothing<std::string>(); return Nothing<std::string>();
} }
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
// Hack to remove -true and -yes from unicode extensions // Hack to remove -true and -yes from unicode extensions
// Address https://crbug.com/v8/8565 // Address https://crbug.com/v8/8565
...@@ -1371,7 +1371,7 @@ ParsedLocale ParseBCP47Locale(const std::string& locale) { ...@@ -1371,7 +1371,7 @@ ParsedLocale ParseBCP47Locale(const std::string& locale) {
// Check to make sure that this really is a grandfathered or // Check to make sure that this really is a grandfathered or
// privateuse extension. ICU can sometimes mess up the // privateuse extension. ICU can sometimes mess up the
// canonicalization. // canonicalization.
CHECK(locale[0] == 'x' || locale[0] == 'i'); DCHECK(locale[0] == 'x' || locale[0] == 'i');
parsed_locale.no_extensions_locale = locale; parsed_locale.no_extensions_locale = locale;
return parsed_locale; return parsed_locale;
} }
...@@ -1452,7 +1452,7 @@ icu::LocaleMatcher BuildLocaleMatcher( ...@@ -1452,7 +1452,7 @@ icu::LocaleMatcher BuildLocaleMatcher(
UErrorCode* status) { UErrorCode* status) {
icu::Locale default_locale = icu::Locale default_locale =
icu::Locale::forLanguageTag(DefaultLocale(isolate), *status); icu::Locale::forLanguageTag(DefaultLocale(isolate), *status);
CHECK(U_SUCCESS(*status)); DCHECK(U_SUCCESS(*status));
icu::LocaleMatcher::Builder builder; icu::LocaleMatcher::Builder builder;
builder.setDefaultLocale(&default_locale); builder.setDefaultLocale(&default_locale);
for (auto it = available_locales.begin(); it != available_locales.end(); for (auto it = available_locales.begin(); it != available_locales.end();
...@@ -1476,7 +1476,7 @@ class Iterator : public icu::Locale::Iterator { ...@@ -1476,7 +1476,7 @@ class Iterator : public icu::Locale::Iterator {
const icu::Locale& next() override { const icu::Locale& next() override {
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
locale_ = icu::Locale::forLanguageTag(iter_->c_str(), status); locale_ = icu::Locale::forLanguageTag(iter_->c_str(), status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
++iter_; ++iter_;
return locale_; return locale_;
} }
...@@ -1509,7 +1509,7 @@ std::string BestFitMatcher(Isolate* isolate, ...@@ -1509,7 +1509,7 @@ std::string BestFitMatcher(Isolate* isolate,
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
icu::LocaleMatcher matcher = icu::LocaleMatcher matcher =
BuildLocaleMatcher(isolate, available_locales, &status); BuildLocaleMatcher(isolate, available_locales, &status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
Iterator iter(requested_locales.cbegin(), requested_locales.cend()); Iterator iter(requested_locales.cbegin(), requested_locales.cend());
std::string bestfit = std::string bestfit =
...@@ -1535,7 +1535,7 @@ std::vector<std::string> BestFitSupportedLocales( ...@@ -1535,7 +1535,7 @@ std::vector<std::string> BestFitSupportedLocales(
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
icu::LocaleMatcher matcher = icu::LocaleMatcher matcher =
BuildLocaleMatcher(isolate, available_locales, &status); BuildLocaleMatcher(isolate, available_locales, &status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
std::string default_locale = DefaultLocale(isolate); std::string default_locale = DefaultLocale(isolate);
std::vector<std::string> result; std::vector<std::string> result;
...@@ -1951,7 +1951,7 @@ MaybeHandle<String> Intl::Normalize(Isolate* isolate, Handle<String> string, ...@@ -1951,7 +1951,7 @@ MaybeHandle<String> Intl::Normalize(Isolate* isolate, Handle<String> string,
const icu::Normalizer2* normalizer = const icu::Normalizer2* normalizer =
icu::Normalizer2::getInstance(nullptr, form_name, form_mode, status); icu::Normalizer2::getInstance(nullptr, form_name, form_mode, status);
DCHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
CHECK_NOT_NULL(normalizer); DCHECK_NOT_NULL(normalizer);
int32_t normalized_prefix_length = int32_t normalized_prefix_length =
normalizer->spanQuickCheckYes(input, status); normalizer->spanQuickCheckYes(input, status);
// Quick return if the input is already normalized. // Quick return if the input is already normalized.
......
...@@ -192,7 +192,7 @@ void JSV8BreakIterator::AdoptText( ...@@ -192,7 +192,7 @@ void JSV8BreakIterator::AdoptText(
Handle<String> text) { Handle<String> text) {
icu::BreakIterator* break_iterator = icu::BreakIterator* break_iterator =
break_iterator_holder->break_iterator().raw(); break_iterator_holder->break_iterator().raw();
CHECK_NOT_NULL(break_iterator); DCHECK_NOT_NULL(break_iterator);
Handle<Managed<icu::UnicodeString>> unicode_string = Handle<Managed<icu::UnicodeString>> unicode_string =
Intl::SetTextToBreakIterator(isolate, text, break_iterator); Intl::SetTextToBreakIterator(isolate, text, break_iterator);
break_iterator_holder->set_unicode_string(*unicode_string); break_iterator_holder->set_unicode_string(*unicode_string);
......
...@@ -52,15 +52,16 @@ Maybe<CaseFirst> GetCaseFirst(Isolate* isolate, Handle<JSReceiver> options, ...@@ -52,15 +52,16 @@ Maybe<CaseFirst> GetCaseFirst(Isolate* isolate, Handle<JSReceiver> options,
// TODO(gsathya): Consider internalizing the value strings. // TODO(gsathya): Consider internalizing the value strings.
void CreateDataPropertyForOptions(Isolate* isolate, Handle<JSObject> options, void CreateDataPropertyForOptions(Isolate* isolate, Handle<JSObject> options,
Handle<String> key, const char* value) { Handle<String> key, const char* value) {
CHECK_NOT_NULL(value); DCHECK_NOT_NULL(value);
Handle<String> value_str = Handle<String> value_str =
isolate->factory()->NewStringFromAsciiChecked(value); isolate->factory()->NewStringFromAsciiChecked(value);
// This is a brand new JSObject that shouldn't already have the same // This is a brand new JSObject that shouldn't already have the same
// key so this shouldn't fail. // key so this shouldn't fail.
CHECK(JSReceiver::CreateDataProperty(isolate, options, key, value_str, Maybe<bool> maybe = JSReceiver::CreateDataProperty(
Just(kDontThrow)) isolate, options, key, value_str, Just(kDontThrow));
.FromJust()); DCHECK(maybe.FromJust());
USE(maybe);
} }
void CreateDataPropertyForOptions(Isolate* isolate, Handle<JSObject> options, void CreateDataPropertyForOptions(Isolate* isolate, Handle<JSObject> options,
...@@ -69,9 +70,10 @@ void CreateDataPropertyForOptions(Isolate* isolate, Handle<JSObject> options, ...@@ -69,9 +70,10 @@ void CreateDataPropertyForOptions(Isolate* isolate, Handle<JSObject> options,
// This is a brand new JSObject that shouldn't already have the same // This is a brand new JSObject that shouldn't already have the same
// key so this shouldn't fail. // key so this shouldn't fail.
CHECK(JSReceiver::CreateDataProperty(isolate, options, key, value_obj, Maybe<bool> maybe = JSReceiver::CreateDataProperty(
Just(kDontThrow)) isolate, options, key, value_obj, Just(kDontThrow));
.FromJust()); DCHECK(maybe.FromJust());
USE(maybe);
} }
} // anonymous namespace } // anonymous namespace
...@@ -83,12 +85,12 @@ Handle<JSObject> JSCollator::ResolvedOptions(Isolate* isolate, ...@@ -83,12 +85,12 @@ Handle<JSObject> JSCollator::ResolvedOptions(Isolate* isolate,
isolate->factory()->NewJSObject(isolate->object_function()); isolate->factory()->NewJSObject(isolate->object_function());
icu::Collator* icu_collator = collator->icu_collator().raw(); icu::Collator* icu_collator = collator->icu_collator().raw();
CHECK_NOT_NULL(icu_collator); DCHECK_NOT_NULL(icu_collator);
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
bool numeric = bool numeric =
icu_collator->getAttribute(UCOL_NUMERIC_COLLATION, status) == UCOL_ON; icu_collator->getAttribute(UCOL_NUMERIC_COLLATION, status) == UCOL_ON;
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
const char* case_first = nullptr; const char* case_first = nullptr;
status = U_ZERO_ERROR; status = U_ZERO_ERROR;
...@@ -102,13 +104,13 @@ Handle<JSObject> JSCollator::ResolvedOptions(Isolate* isolate, ...@@ -102,13 +104,13 @@ Handle<JSObject> JSCollator::ResolvedOptions(Isolate* isolate,
default: default:
case_first = "false"; case_first = "false";
} }
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
const char* sensitivity = nullptr; const char* sensitivity = nullptr;
status = U_ZERO_ERROR; status = U_ZERO_ERROR;
switch (icu_collator->getAttribute(UCOL_STRENGTH, status)) { switch (icu_collator->getAttribute(UCOL_STRENGTH, status)) {
case UCOL_PRIMARY: { case UCOL_PRIMARY: {
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
status = U_ZERO_ERROR; status = U_ZERO_ERROR;
// case level: true + s1 -> case, s1 -> base. // case level: true + s1 -> case, s1 -> base.
if (UCOL_ON == icu_collator->getAttribute(UCOL_CASE_LEVEL, status)) { if (UCOL_ON == icu_collator->getAttribute(UCOL_CASE_LEVEL, status)) {
...@@ -116,7 +118,7 @@ Handle<JSObject> JSCollator::ResolvedOptions(Isolate* isolate, ...@@ -116,7 +118,7 @@ Handle<JSObject> JSCollator::ResolvedOptions(Isolate* isolate,
} else { } else {
sensitivity = "base"; sensitivity = "base";
} }
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
break; break;
} }
case UCOL_SECONDARY: case UCOL_SECONDARY:
...@@ -133,17 +135,17 @@ Handle<JSObject> JSCollator::ResolvedOptions(Isolate* isolate, ...@@ -133,17 +135,17 @@ Handle<JSObject> JSCollator::ResolvedOptions(Isolate* isolate,
default: default:
sensitivity = "variant"; sensitivity = "variant";
} }
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
status = U_ZERO_ERROR; status = U_ZERO_ERROR;
bool ignore_punctuation = icu_collator->getAttribute(UCOL_ALTERNATE_HANDLING, bool ignore_punctuation = icu_collator->getAttribute(UCOL_ALTERNATE_HANDLING,
status) == UCOL_SHIFTED; status) == UCOL_SHIFTED;
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
status = U_ZERO_ERROR; status = U_ZERO_ERROR;
icu::Locale icu_locale(icu_collator->getLocale(ULOC_VALID_LOCALE, status)); icu::Locale icu_locale(icu_collator->getLocale(ULOC_VALID_LOCALE, status));
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
const char* collation = "default"; const char* collation = "default";
const char* usage = "sort"; const char* usage = "sort";
...@@ -172,7 +174,7 @@ Handle<JSObject> JSCollator::ResolvedOptions(Isolate* isolate, ...@@ -172,7 +174,7 @@ Handle<JSObject> JSCollator::ResolvedOptions(Isolate* isolate,
// locale tag, so let's filter it out. // locale tag, so let's filter it out.
status = U_ZERO_ERROR; status = U_ZERO_ERROR;
new_icu_locale.setUnicodeKeywordValue(collation_key, nullptr, status); new_icu_locale.setUnicodeKeywordValue(collation_key, nullptr, status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
locale = Intl::ToLanguageTag(new_icu_locale).FromJust(); locale = Intl::ToLanguageTag(new_icu_locale).FromJust();
} else { } else {
...@@ -234,19 +236,19 @@ UColAttributeValue ToUColAttributeValue(CaseFirst case_first) { ...@@ -234,19 +236,19 @@ UColAttributeValue ToUColAttributeValue(CaseFirst case_first) {
} }
void SetNumericOption(icu::Collator* icu_collator, bool numeric) { void SetNumericOption(icu::Collator* icu_collator, bool numeric) {
CHECK_NOT_NULL(icu_collator); DCHECK_NOT_NULL(icu_collator);
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
icu_collator->setAttribute(UCOL_NUMERIC_COLLATION, icu_collator->setAttribute(UCOL_NUMERIC_COLLATION,
numeric ? UCOL_ON : UCOL_OFF, status); numeric ? UCOL_ON : UCOL_OFF, status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
} }
void SetCaseFirstOption(icu::Collator* icu_collator, CaseFirst case_first) { void SetCaseFirstOption(icu::Collator* icu_collator, CaseFirst case_first) {
CHECK_NOT_NULL(icu_collator); DCHECK_NOT_NULL(icu_collator);
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
icu_collator->setAttribute(UCOL_CASE_FIRST, ToUColAttributeValue(case_first), icu_collator->setAttribute(UCOL_CASE_FIRST, ToUColAttributeValue(case_first),
status); status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
} }
} // anonymous namespace } // anonymous namespace
...@@ -367,7 +369,7 @@ MaybeHandle<JSCollator> JSCollator::New(Isolate* isolate, Handle<Map> map, ...@@ -367,7 +369,7 @@ MaybeHandle<JSCollator> JSCollator::New(Isolate* isolate, Handle<Map> map,
if (co_extension_it != r.extensions.end() && if (co_extension_it != r.extensions.end() &&
co_extension_it->second != collation_str.get()) { co_extension_it->second != collation_str.get()) {
icu_locale.setUnicodeKeywordValue("co", nullptr, status); icu_locale.setUnicodeKeywordValue("co", nullptr, status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
} }
} }
...@@ -390,12 +392,12 @@ MaybeHandle<JSCollator> JSCollator::New(Isolate* isolate, Handle<Map> map, ...@@ -390,12 +392,12 @@ MaybeHandle<JSCollator> JSCollator::New(Isolate* isolate, Handle<Map> map,
if (usage == Usage::SEARCH) { if (usage == Usage::SEARCH) {
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
icu_locale.setUnicodeKeywordValue("co", "search", status); icu_locale.setUnicodeKeywordValue("co", "search", status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
} else { } else {
if (collation_str != nullptr && if (collation_str != nullptr &&
Intl::IsValidCollation(icu_locale, collation_str.get())) { Intl::IsValidCollation(icu_locale, collation_str.get())) {
icu_locale.setUnicodeKeywordValue("co", collation_str.get(), status); icu_locale.setUnicodeKeywordValue("co", collation_str.get(), status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
} }
} }
...@@ -459,7 +461,7 @@ MaybeHandle<JSCollator> JSCollator::New(Isolate* isolate, Handle<Map> map, ...@@ -459,7 +461,7 @@ MaybeHandle<JSCollator> JSCollator::New(Isolate* isolate, Handle<Map> map,
// that right now). // that right now).
status = U_ZERO_ERROR; status = U_ZERO_ERROR;
icu_collator->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status); icu_collator->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
// 24. Let sensitivity be ? GetOption(options, "sensitivity", // 24. Let sensitivity be ? GetOption(options, "sensitivity",
// "string", « "base", "accent", "case", "variant" », undefined). // "string", « "base", "accent", "case", "variant" », undefined).
...@@ -492,7 +494,7 @@ MaybeHandle<JSCollator> JSCollator::New(Isolate* isolate, Handle<Map> map, ...@@ -492,7 +494,7 @@ MaybeHandle<JSCollator> JSCollator::New(Isolate* isolate, Handle<Map> map,
icu_collator->setStrength(icu::Collator::PRIMARY); icu_collator->setStrength(icu::Collator::PRIMARY);
status = U_ZERO_ERROR; status = U_ZERO_ERROR;
icu_collator->setAttribute(UCOL_CASE_LEVEL, UCOL_ON, status); icu_collator->setAttribute(UCOL_CASE_LEVEL, UCOL_ON, status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
break; break;
case Sensitivity::kVariant: case Sensitivity::kVariant:
icu_collator->setStrength(icu::Collator::TERTIARY); icu_collator->setStrength(icu::Collator::TERTIARY);
...@@ -512,7 +514,7 @@ MaybeHandle<JSCollator> JSCollator::New(Isolate* isolate, Handle<Map> map, ...@@ -512,7 +514,7 @@ MaybeHandle<JSCollator> JSCollator::New(Isolate* isolate, Handle<Map> map,
if (found_ignore_punctuation.FromJust() && ignore_punctuation) { if (found_ignore_punctuation.FromJust() && ignore_punctuation) {
status = U_ZERO_ERROR; status = U_ZERO_ERROR;
icu_collator->setAttribute(UCOL_ALTERNATE_HANDLING, UCOL_SHIFTED, status); icu_collator->setAttribute(UCOL_ALTERNATE_HANDLING, UCOL_SHIFTED, status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
} }
Handle<Managed<icu::Collator>> managed_collator = Handle<Managed<icu::Collator>> managed_collator =
......
This diff is collapsed.
...@@ -266,7 +266,7 @@ class DateTimeFieldNames : public DisplayNamesInternal { ...@@ -266,7 +266,7 @@ class DateTimeFieldNames : public DisplayNamesInternal {
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
generator_.reset( generator_.reset(
icu::DateTimePatternGenerator::createInstance(locale_, status)); icu::DateTimePatternGenerator::createInstance(locale_, status));
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
} }
~DateTimeFieldNames() override = default; ~DateTimeFieldNames() override = default;
const char* type() const override { return "dateTimeField"; } const char* type() const override { return "dateTimeField"; }
...@@ -566,7 +566,7 @@ MaybeHandle<JSDisplayNames> JSDisplayNames::New(Isolate* isolate, ...@@ -566,7 +566,7 @@ MaybeHandle<JSDisplayNames> JSDisplayNames::New(Isolate* isolate,
if (calendar_str != nullptr && if (calendar_str != nullptr &&
Intl::IsValidCalendar(icu_locale, calendar_str.get())) { Intl::IsValidCalendar(icu_locale, calendar_str.get())) {
icu_locale.setUnicodeKeywordValue("ca", calendar_str.get(), status); icu_locale.setUnicodeKeywordValue("ca", calendar_str.get(), status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
} }
// 10. Let s be ? GetOption(options, "style", "string", // 10. Let s be ? GetOption(options, "style", "string",
...@@ -689,35 +689,39 @@ Handle<JSObject> JSDisplayNames::ResolvedOptions( ...@@ -689,35 +689,39 @@ Handle<JSObject> JSDisplayNames::ResolvedOptions(
DisplayNamesInternal* internal = display_names->internal().raw(); DisplayNamesInternal* internal = display_names->internal().raw();
Maybe<std::string> maybe_locale = Intl::ToLanguageTag(internal->locale()); Maybe<std::string> maybe_locale = Intl::ToLanguageTag(internal->locale());
CHECK(maybe_locale.IsJust()); DCHECK(maybe_locale.IsJust());
Handle<String> locale = isolate->factory()->NewStringFromAsciiChecked( Handle<String> locale = isolate->factory()->NewStringFromAsciiChecked(
maybe_locale.FromJust().c_str()); maybe_locale.FromJust().c_str());
Handle<String> style = display_names->StyleAsString(); Handle<String> style = display_names->StyleAsString();
Handle<String> type = factory->NewStringFromAsciiChecked(internal->type()); Handle<String> type = factory->NewStringFromAsciiChecked(internal->type());
Handle<String> fallback = display_names->FallbackAsString(); Handle<String> fallback = display_names->FallbackAsString();
CHECK(JSReceiver::CreateDataProperty(isolate, options, Maybe<bool> maybe_create_locale = JSReceiver::CreateDataProperty(
factory->locale_string(), locale, isolate, options, factory->locale_string(), locale, Just(kDontThrow));
Just(kDontThrow)) DCHECK(maybe_create_locale.FromJust());
.FromJust()); USE(maybe_create_locale);
if (internal->calendar() != nullptr) { if (internal->calendar() != nullptr) {
CHECK(JSReceiver::CreateDataProperty( Maybe<bool> maybe_create_calendar = JSReceiver::CreateDataProperty(
isolate, options, factory->calendar_string(), isolate, options, factory->calendar_string(),
factory->NewStringFromAsciiChecked(internal->calendar()), factory->NewStringFromAsciiChecked(internal->calendar()),
Just(kDontThrow)) Just(kDontThrow));
.FromJust()); DCHECK(maybe_create_calendar.FromJust());
} USE(maybe_create_calendar);
CHECK(JSReceiver::CreateDataProperty( }
isolate, options, factory->style_string(), style, Just(kDontThrow)) Maybe<bool> maybe_create_style = JSReceiver::CreateDataProperty(
.FromJust()); isolate, options, factory->style_string(), style, Just(kDontThrow));
DCHECK(maybe_create_style.FromJust());
CHECK(JSReceiver::CreateDataProperty(isolate, options, factory->type_string(), USE(maybe_create_style);
type, Just(kDontThrow))
.FromJust()); Maybe<bool> maybe_create_type = JSReceiver::CreateDataProperty(
CHECK(JSReceiver::CreateDataProperty(isolate, options, isolate, options, factory->type_string(), type, Just(kDontThrow));
factory->fallback_string(), fallback, DCHECK(maybe_create_type.FromJust());
Just(kDontThrow)) USE(maybe_create_type);
.FromJust());
Maybe<bool> maybe_create_fallback = JSReceiver::CreateDataProperty(
isolate, options, factory->fallback_string(), fallback, Just(kDontThrow));
DCHECK(maybe_create_fallback.FromJust());
USE(maybe_create_fallback);
return options; return options;
} }
......
...@@ -254,7 +254,7 @@ MaybeHandle<T> FormatListCommon( ...@@ -254,7 +254,7 @@ MaybeHandle<T> FormatListCommon(
std::vector<icu::UnicodeString> array = maybe_array.FromJust(); std::vector<icu::UnicodeString> array = maybe_array.FromJust();
icu::ListFormatter* formatter = format->icu_formatter().raw(); icu::ListFormatter* formatter = format->icu_formatter().raw();
CHECK_NOT_NULL(formatter); DCHECK_NOT_NULL(formatter);
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
icu::FormattedList formatted = formatter->formatStringsToValue( icu::FormattedList formatted = formatter->formatStringsToValue(
......
...@@ -42,7 +42,7 @@ struct OptionData { ...@@ -42,7 +42,7 @@ struct OptionData {
Maybe<bool> InsertOptionsIntoLocale(Isolate* isolate, Maybe<bool> InsertOptionsIntoLocale(Isolate* isolate,
Handle<JSReceiver> options, Handle<JSReceiver> options,
icu::LocaleBuilder* builder) { icu::LocaleBuilder* builder) {
CHECK(isolate); DCHECK(isolate);
const std::vector<const char*> hour_cycle_values = {"h11", "h12", "h23", const std::vector<const char*> hour_cycle_values = {"h11", "h12", "h23",
"h24"}; "h24"};
...@@ -234,8 +234,8 @@ Maybe<bool> ApplyOptionsToTag(Isolate* isolate, Handle<String> tag, ...@@ -234,8 +234,8 @@ Maybe<bool> ApplyOptionsToTag(Isolate* isolate, Handle<String> tag,
v8::String::Utf8Value bcp47_tag(v8_isolate, v8::Utils::ToLocal(tag)); v8::String::Utf8Value bcp47_tag(v8_isolate, v8::Utils::ToLocal(tag));
builder->setLanguageTag({*bcp47_tag, bcp47_tag.length()}); builder->setLanguageTag({*bcp47_tag, bcp47_tag.length()});
CHECK_LT(0, bcp47_tag.length()); DCHECK_LT(0, bcp47_tag.length());
CHECK_NOT_NULL(*bcp47_tag); DCHECK_NOT_NULL(*bcp47_tag);
// 2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError // 2. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError
// exception. // exception.
if (!JSLocale::StartsWithUnicodeLanguageId(*bcp47_tag)) { if (!JSLocale::StartsWithUnicodeLanguageId(*bcp47_tag)) {
......
...@@ -33,7 +33,7 @@ bool CreateICUPluralRules(Isolate* isolate, const icu::Locale& icu_locale, ...@@ -33,7 +33,7 @@ bool CreateICUPluralRules(Isolate* isolate, const icu::Locale& icu_locale,
if (type == JSPluralRules::Type::ORDINAL) { if (type == JSPluralRules::Type::ORDINAL) {
icu_type = UPLURAL_TYPE_ORDINAL; icu_type = UPLURAL_TYPE_ORDINAL;
} else { } else {
CHECK_EQ(JSPluralRules::Type::CARDINAL, type); DCHECK_EQ(JSPluralRules::Type::CARDINAL, type);
} }
std::unique_ptr<icu::PluralRules> plural_rules( std::unique_ptr<icu::PluralRules> plural_rules(
...@@ -41,7 +41,7 @@ bool CreateICUPluralRules(Isolate* isolate, const icu::Locale& icu_locale, ...@@ -41,7 +41,7 @@ bool CreateICUPluralRules(Isolate* isolate, const icu::Locale& icu_locale,
if (U_FAILURE(status)) { if (U_FAILURE(status)) {
return false; return false;
} }
CHECK_NOT_NULL(plural_rules.get()); DCHECK_NOT_NULL(plural_rules.get());
*pl = std::move(plural_rules); *pl = std::move(plural_rules);
return true; return true;
...@@ -184,20 +184,20 @@ MaybeHandle<JSPluralRules> JSPluralRules::New(Isolate* isolate, Handle<Map> map, ...@@ -184,20 +184,20 @@ MaybeHandle<JSPluralRules> JSPluralRules::New(Isolate* isolate, Handle<Map> map,
MaybeHandle<String> JSPluralRules::ResolvePlural( MaybeHandle<String> JSPluralRules::ResolvePlural(
Isolate* isolate, Handle<JSPluralRules> plural_rules, double number) { Isolate* isolate, Handle<JSPluralRules> plural_rules, double number) {
icu::PluralRules* icu_plural_rules = plural_rules->icu_plural_rules().raw(); icu::PluralRules* icu_plural_rules = plural_rules->icu_plural_rules().raw();
CHECK_NOT_NULL(icu_plural_rules); DCHECK_NOT_NULL(icu_plural_rules);
icu::number::LocalizedNumberFormatter* fmt = icu::number::LocalizedNumberFormatter* fmt =
plural_rules->icu_number_formatter().raw(); plural_rules->icu_number_formatter().raw();
CHECK_NOT_NULL(fmt); DCHECK_NOT_NULL(fmt);
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
icu::number::FormattedNumber formatted_number = icu::number::FormattedNumber formatted_number =
fmt->formatDouble(number, status); fmt->formatDouble(number, status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
icu::UnicodeString result = icu::UnicodeString result =
icu_plural_rules->select(formatted_number, status); icu_plural_rules->select(formatted_number, status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
return Intl::ToString(isolate, result); return Intl::ToString(isolate, result);
} }
...@@ -210,9 +210,10 @@ void CreateDataPropertyForOptions(Isolate* isolate, Handle<JSObject> options, ...@@ -210,9 +210,10 @@ void CreateDataPropertyForOptions(Isolate* isolate, Handle<JSObject> options,
// This is a brand new JSObject that shouldn't already have the same // This is a brand new JSObject that shouldn't already have the same
// key so this shouldn't fail. // key so this shouldn't fail.
CHECK(JSReceiver::CreateDataProperty(isolate, options, key_str, value, Maybe<bool> maybe = JSReceiver::CreateDataProperty(isolate, options, key_str,
Just(kDontThrow)) value, Just(kDontThrow));
.FromJust()); DCHECK(maybe.FromJust());
USE(maybe);
} }
void CreateDataPropertyForOptions(Isolate* isolate, Handle<JSObject> options, void CreateDataPropertyForOptions(Isolate* isolate, Handle<JSObject> options,
...@@ -238,7 +239,7 @@ Handle<JSObject> JSPluralRules::ResolvedOptions( ...@@ -238,7 +239,7 @@ Handle<JSObject> JSPluralRules::ResolvedOptions(
icu::number::LocalizedNumberFormatter* icu_number_formatter = icu::number::LocalizedNumberFormatter* icu_number_formatter =
plural_rules->icu_number_formatter().raw(); plural_rules->icu_number_formatter().raw();
icu::UnicodeString skeleton = icu_number_formatter->toSkeleton(status); icu::UnicodeString skeleton = icu_number_formatter->toSkeleton(status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
CreateDataPropertyForOptions( CreateDataPropertyForOptions(
isolate, options, isolate, options,
...@@ -262,19 +263,19 @@ Handle<JSObject> JSPluralRules::ResolvedOptions( ...@@ -262,19 +263,19 @@ Handle<JSObject> JSPluralRules::ResolvedOptions(
// 6. Let pluralCategories be a List of Strings representing the // 6. Let pluralCategories be a List of Strings representing the
// possible results of PluralRuleSelect for the selected locale pr. // possible results of PluralRuleSelect for the selected locale pr.
icu::PluralRules* icu_plural_rules = plural_rules->icu_plural_rules().raw(); icu::PluralRules* icu_plural_rules = plural_rules->icu_plural_rules().raw();
CHECK_NOT_NULL(icu_plural_rules); DCHECK_NOT_NULL(icu_plural_rules);
std::unique_ptr<icu::StringEnumeration> categories( std::unique_ptr<icu::StringEnumeration> categories(
icu_plural_rules->getKeywords(status)); icu_plural_rules->getKeywords(status));
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
int32_t count = categories->count(status); int32_t count = categories->count(status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
Handle<FixedArray> plural_categories = Handle<FixedArray> plural_categories =
isolate->factory()->NewFixedArray(count); isolate->factory()->NewFixedArray(count);
for (int32_t i = 0; i < count; i++) { for (int32_t i = 0; i < count; i++) {
const icu::UnicodeString* category = categories->snext(status); const icu::UnicodeString* category = categories->snext(status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
if (category == nullptr) break; if (category == nullptr) break;
std::string keyword; std::string keyword;
...@@ -301,7 +302,7 @@ class PluralRulesAvailableLocales { ...@@ -301,7 +302,7 @@ class PluralRulesAvailableLocales {
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
std::unique_ptr<icu::StringEnumeration> locales( std::unique_ptr<icu::StringEnumeration> locales(
icu::PluralRules::getAvailableLocales(status)); icu::PluralRules::getAvailableLocales(status));
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
int32_t len = 0; int32_t len = 0;
const char* locale = nullptr; const char* locale = nullptr;
while ((locale = locales->next(&len, status)) != nullptr && while ((locale = locales->next(&len, status)) != nullptr &&
......
...@@ -131,7 +131,7 @@ MaybeHandle<JSRelativeTimeFormat> JSRelativeTimeFormat::New( ...@@ -131,7 +131,7 @@ MaybeHandle<JSRelativeTimeFormat> JSRelativeTimeFormat::New(
if (nu_extension_it != r.extensions.end() && if (nu_extension_it != r.extensions.end() &&
nu_extension_it->second != numbering_system_str.get()) { nu_extension_it->second != numbering_system_str.get()) {
icu_locale.setUnicodeKeywordValue("nu", nullptr, status); icu_locale.setUnicodeKeywordValue("nu", nullptr, status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
} }
} }
// 12. Let locale be r.[[Locale]]. // 12. Let locale be r.[[Locale]].
...@@ -146,7 +146,7 @@ MaybeHandle<JSRelativeTimeFormat> JSRelativeTimeFormat::New( ...@@ -146,7 +146,7 @@ MaybeHandle<JSRelativeTimeFormat> JSRelativeTimeFormat::New(
if (numbering_system_str != nullptr && if (numbering_system_str != nullptr &&
Intl::IsValidNumberingSystem(numbering_system_str.get())) { Intl::IsValidNumberingSystem(numbering_system_str.get())) {
icu_locale.setUnicodeKeywordValue("nu", numbering_system_str.get(), status); icu_locale.setUnicodeKeywordValue("nu", numbering_system_str.get(), status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
} }
// 15. Let dataLocale be r.[[DataLocale]]. // 15. Let dataLocale be r.[[DataLocale]].
...@@ -184,7 +184,7 @@ MaybeHandle<JSRelativeTimeFormat> JSRelativeTimeFormat::New( ...@@ -184,7 +184,7 @@ MaybeHandle<JSRelativeTimeFormat> JSRelativeTimeFormat::New(
delete number_format; delete number_format;
status = U_ZERO_ERROR; status = U_ZERO_ERROR;
icu_locale.setUnicodeKeywordValue("nu", nullptr, status); icu_locale.setUnicodeKeywordValue("nu", nullptr, status);
CHECK(U_SUCCESS(status)); DCHECK(U_SUCCESS(status));
number_format = number_format =
icu::NumberFormat::createInstance(icu_locale, UNUM_DECIMAL, status); icu::NumberFormat::createInstance(icu_locale, UNUM_DECIMAL, status);
} }
...@@ -256,7 +256,7 @@ Handle<JSObject> JSRelativeTimeFormat::ResolvedOptions( ...@@ -256,7 +256,7 @@ Handle<JSObject> JSRelativeTimeFormat::ResolvedOptions(
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
icu::RelativeDateTimeFormatter* formatter = icu::RelativeDateTimeFormatter* formatter =
format_holder->icu_formatter().raw(); format_holder->icu_formatter().raw();
CHECK_NOT_NULL(formatter); DCHECK_NOT_NULL(formatter);
Handle<JSObject> result = factory->NewJSObject(isolate->object_function()); Handle<JSObject> result = factory->NewJSObject(isolate->object_function());
Handle<String> locale(format_holder->locale(), isolate); Handle<String> locale(format_holder->locale(), isolate);
Handle<String> numberingSystem(format_holder->numberingSystem(), isolate); Handle<String> numberingSystem(format_holder->numberingSystem(), isolate);
...@@ -366,7 +366,7 @@ MaybeHandle<T> FormatCommon( ...@@ -366,7 +366,7 @@ MaybeHandle<T> FormatCommon(
T); T);
} }
icu::RelativeDateTimeFormatter* formatter = format->icu_formatter().raw(); icu::RelativeDateTimeFormatter* formatter = format->icu_formatter().raw();
CHECK_NOT_NULL(formatter); DCHECK_NOT_NULL(formatter);
URelativeDateTimeUnit unit_enum; URelativeDateTimeUnit unit_enum;
if (!GetURelativeDateTimeUnit(unit, &unit_enum)) { if (!GetURelativeDateTimeUnit(unit, &unit_enum)) {
THROW_NEW_ERROR( THROW_NEW_ERROR(
......
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