Index: src/i18n.cc |
diff --git a/src/i18n.cc b/src/i18n.cc |
index 2d67cf13eb2c9993a0cac90e66042257881653aa..cae3a327a1b924b60edad2d9f326ccd01df2b6ad 100644 |
--- a/src/i18n.cc |
+++ b/src/i18n.cc |
@@ -131,22 +131,19 @@ void SetResolvedDateSettings(Isolate* isolate, |
icu::UnicodeString pattern; |
date_format->toPattern(pattern); |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("pattern"), |
+ resolved, factory->NewStringFromStaticChars("pattern"), |
factory->NewStringFromTwoByte( |
- Vector<const uint16_t>( |
- reinterpret_cast<const uint16_t*>(pattern.getBuffer()), |
- pattern.length())).ToHandleChecked(), |
+ Vector<const uint16_t>( |
+ reinterpret_cast<const uint16_t*>(pattern.getBuffer()), |
+ pattern.length())).ToHandleChecked(), |
SLOPPY).Assert(); |
// Set time zone and calendar. |
const icu::Calendar* calendar = date_format->getCalendar(); |
const char* calendar_name = calendar->getType(); |
- JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("calendar"), |
- factory->NewStringFromAsciiChecked(calendar_name), |
- SLOPPY).Assert(); |
+ JSObject::SetProperty(resolved, factory->NewStringFromStaticChars("calendar"), |
+ factory->NewStringFromAsciiChecked(calendar_name), |
+ SLOPPY).Assert(); |
const icu::TimeZone& tz = calendar->getTimeZone(); |
icu::UnicodeString time_zone; |
@@ -157,19 +154,16 @@ void SetResolvedDateSettings(Isolate* isolate, |
if (U_SUCCESS(status)) { |
if (canonical_time_zone == UNICODE_STRING_SIMPLE("Etc/GMT")) { |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("timeZone"), |
- factory->NewStringFromStaticAscii("UTC"), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("timeZone"), |
+ factory->NewStringFromStaticChars("UTC"), SLOPPY).Assert(); |
} else { |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("timeZone"), |
+ resolved, factory->NewStringFromStaticChars("timeZone"), |
factory->NewStringFromTwoByte( |
- Vector<const uint16_t>( |
- reinterpret_cast<const uint16_t*>( |
- canonical_time_zone.getBuffer()), |
- canonical_time_zone.length())).ToHandleChecked(), |
+ Vector<const uint16_t>( |
+ reinterpret_cast<const uint16_t*>( |
+ canonical_time_zone.getBuffer()), |
+ canonical_time_zone.length())).ToHandleChecked(), |
SLOPPY).Assert(); |
} |
} |
@@ -183,16 +177,12 @@ void SetResolvedDateSettings(Isolate* isolate, |
if (U_SUCCESS(status)) { |
const char* ns = numbering_system->getName(); |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("numberingSystem"), |
- factory->NewStringFromAsciiChecked(ns), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("numberingSystem"), |
+ factory->NewStringFromAsciiChecked(ns), SLOPPY).Assert(); |
} else { |
- JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("numberingSystem"), |
- factory->undefined_value(), |
- SLOPPY).Assert(); |
+ JSObject::SetProperty(resolved, |
+ factory->NewStringFromStaticChars("numberingSystem"), |
+ factory->undefined_value(), SLOPPY).Assert(); |
} |
delete numbering_system; |
@@ -202,18 +192,14 @@ void SetResolvedDateSettings(Isolate* isolate, |
uloc_toLanguageTag( |
icu_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status); |
if (U_SUCCESS(status)) { |
- JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("locale"), |
- factory->NewStringFromAsciiChecked(result), |
- SLOPPY).Assert(); |
+ JSObject::SetProperty(resolved, factory->NewStringFromStaticChars("locale"), |
+ factory->NewStringFromAsciiChecked(result), |
+ SLOPPY).Assert(); |
} else { |
// This would never happen, since we got the locale from ICU. |
- JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("locale"), |
- factory->NewStringFromStaticAscii("und"), |
- SLOPPY).Assert(); |
+ JSObject::SetProperty(resolved, factory->NewStringFromStaticChars("locale"), |
+ factory->NewStringFromStaticChars("und"), |
+ SLOPPY).Assert(); |
} |
} |
@@ -350,24 +336,22 @@ void SetResolvedNumberSettings(Isolate* isolate, |
icu::UnicodeString pattern; |
number_format->toPattern(pattern); |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("pattern"), |
+ resolved, factory->NewStringFromStaticChars("pattern"), |
factory->NewStringFromTwoByte( |
- Vector<const uint16_t>( |
- reinterpret_cast<const uint16_t*>(pattern.getBuffer()), |
- pattern.length())).ToHandleChecked(), |
+ Vector<const uint16_t>( |
+ reinterpret_cast<const uint16_t*>(pattern.getBuffer()), |
+ pattern.length())).ToHandleChecked(), |
SLOPPY).Assert(); |
// Set resolved currency code in options.currency if not empty. |
icu::UnicodeString currency(number_format->getCurrency()); |
if (!currency.isEmpty()) { |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("currency"), |
- factory->NewStringFromTwoByte( |
- Vector<const uint16_t>( |
- reinterpret_cast<const uint16_t*>(currency.getBuffer()), |
- currency.length())).ToHandleChecked(), |
+ resolved, factory->NewStringFromStaticChars("currency"), |
+ factory->NewStringFromTwoByte(Vector<const uint16_t>( |
+ reinterpret_cast<const uint16_t*>( |
+ currency.getBuffer()), |
+ currency.length())).ToHandleChecked(), |
SLOPPY).Assert(); |
} |
@@ -380,62 +364,51 @@ void SetResolvedNumberSettings(Isolate* isolate, |
if (U_SUCCESS(status)) { |
const char* ns = numbering_system->getName(); |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("numberingSystem"), |
- factory->NewStringFromAsciiChecked(ns), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("numberingSystem"), |
+ factory->NewStringFromAsciiChecked(ns), SLOPPY).Assert(); |
} else { |
- JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("numberingSystem"), |
- factory->undefined_value(), |
- SLOPPY).Assert(); |
+ JSObject::SetProperty(resolved, |
+ factory->NewStringFromStaticChars("numberingSystem"), |
+ factory->undefined_value(), SLOPPY).Assert(); |
} |
delete numbering_system; |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("useGrouping"), |
- factory->ToBoolean(number_format->isGroupingUsed()), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("useGrouping"), |
+ factory->ToBoolean(number_format->isGroupingUsed()), SLOPPY).Assert(); |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("minimumIntegerDigits"), |
+ resolved, factory->NewStringFromStaticChars("minimumIntegerDigits"), |
factory->NewNumberFromInt(number_format->getMinimumIntegerDigits()), |
SLOPPY).Assert(); |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("minimumFractionDigits"), |
+ resolved, factory->NewStringFromStaticChars("minimumFractionDigits"), |
factory->NewNumberFromInt(number_format->getMinimumFractionDigits()), |
SLOPPY).Assert(); |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("maximumFractionDigits"), |
+ resolved, factory->NewStringFromStaticChars("maximumFractionDigits"), |
factory->NewNumberFromInt(number_format->getMaximumFractionDigits()), |
SLOPPY).Assert(); |
Handle<String> key = |
- factory->NewStringFromStaticAscii("minimumSignificantDigits"); |
+ factory->NewStringFromStaticChars("minimumSignificantDigits"); |
Maybe<bool> maybe = JSReceiver::HasOwnProperty(resolved, key); |
CHECK(maybe.has_value); |
if (maybe.value) { |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("minimumSignificantDigits"), |
+ resolved, factory->NewStringFromStaticChars("minimumSignificantDigits"), |
factory->NewNumberFromInt(number_format->getMinimumSignificantDigits()), |
SLOPPY).Assert(); |
} |
- key = factory->NewStringFromStaticAscii("maximumSignificantDigits"); |
+ key = factory->NewStringFromStaticChars("maximumSignificantDigits"); |
maybe = JSReceiver::HasOwnProperty(resolved, key); |
CHECK(maybe.has_value); |
if (maybe.value) { |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("maximumSignificantDigits"), |
+ resolved, factory->NewStringFromStaticChars("maximumSignificantDigits"), |
factory->NewNumberFromInt(number_format->getMaximumSignificantDigits()), |
SLOPPY).Assert(); |
} |
@@ -446,18 +419,14 @@ void SetResolvedNumberSettings(Isolate* isolate, |
uloc_toLanguageTag( |
icu_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status); |
if (U_SUCCESS(status)) { |
- JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("locale"), |
- factory->NewStringFromAsciiChecked(result), |
- SLOPPY).Assert(); |
+ JSObject::SetProperty(resolved, factory->NewStringFromStaticChars("locale"), |
+ factory->NewStringFromAsciiChecked(result), |
+ SLOPPY).Assert(); |
} else { |
// This would never happen, since we got the locale from ICU. |
- JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("locale"), |
- factory->NewStringFromStaticAscii("und"), |
- SLOPPY).Assert(); |
+ JSObject::SetProperty(resolved, factory->NewStringFromStaticChars("locale"), |
+ factory->NewStringFromStaticChars("und"), |
+ SLOPPY).Assert(); |
} |
} |
@@ -534,8 +503,7 @@ void SetResolvedCollatorSettings(Isolate* isolate, |
UErrorCode status = U_ZERO_ERROR; |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("numeric"), |
+ resolved, factory->NewStringFromStaticChars("numeric"), |
factory->ToBoolean( |
collator->getAttribute(UCOL_NUMERIC_COLLATION, status) == UCOL_ON), |
SLOPPY).Assert(); |
@@ -543,106 +511,77 @@ void SetResolvedCollatorSettings(Isolate* isolate, |
switch (collator->getAttribute(UCOL_CASE_FIRST, status)) { |
case UCOL_LOWER_FIRST: |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("caseFirst"), |
- factory->NewStringFromStaticAscii("lower"), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("caseFirst"), |
+ factory->NewStringFromStaticChars("lower"), SLOPPY).Assert(); |
break; |
case UCOL_UPPER_FIRST: |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("caseFirst"), |
- factory->NewStringFromStaticAscii("upper"), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("caseFirst"), |
+ factory->NewStringFromStaticChars("upper"), SLOPPY).Assert(); |
break; |
default: |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("caseFirst"), |
- factory->NewStringFromStaticAscii("false"), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("caseFirst"), |
+ factory->NewStringFromStaticChars("false"), SLOPPY).Assert(); |
} |
switch (collator->getAttribute(UCOL_STRENGTH, status)) { |
case UCOL_PRIMARY: { |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("strength"), |
- factory->NewStringFromStaticAscii("primary"), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("strength"), |
+ factory->NewStringFromStaticChars("primary"), SLOPPY).Assert(); |
// case level: true + s1 -> case, s1 -> base. |
if (UCOL_ON == collator->getAttribute(UCOL_CASE_LEVEL, status)) { |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("sensitivity"), |
- factory->NewStringFromStaticAscii("case"), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("sensitivity"), |
+ factory->NewStringFromStaticChars("case"), SLOPPY).Assert(); |
} else { |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("sensitivity"), |
- factory->NewStringFromStaticAscii("base"), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("sensitivity"), |
+ factory->NewStringFromStaticChars("base"), SLOPPY).Assert(); |
} |
break; |
} |
case UCOL_SECONDARY: |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("strength"), |
- factory->NewStringFromStaticAscii("secondary"), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("strength"), |
+ factory->NewStringFromStaticChars("secondary"), SLOPPY).Assert(); |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("sensitivity"), |
- factory->NewStringFromStaticAscii("accent"), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("sensitivity"), |
+ factory->NewStringFromStaticChars("accent"), SLOPPY).Assert(); |
break; |
case UCOL_TERTIARY: |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("strength"), |
- factory->NewStringFromStaticAscii("tertiary"), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("strength"), |
+ factory->NewStringFromStaticChars("tertiary"), SLOPPY).Assert(); |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("sensitivity"), |
- factory->NewStringFromStaticAscii("variant"), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("sensitivity"), |
+ factory->NewStringFromStaticChars("variant"), SLOPPY).Assert(); |
break; |
case UCOL_QUATERNARY: |
// We shouldn't get quaternary and identical from ICU, but if we do |
// put them into variant. |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("strength"), |
- factory->NewStringFromStaticAscii("quaternary"), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("strength"), |
+ factory->NewStringFromStaticChars("quaternary"), SLOPPY).Assert(); |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("sensitivity"), |
- factory->NewStringFromStaticAscii("variant"), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("sensitivity"), |
+ factory->NewStringFromStaticChars("variant"), SLOPPY).Assert(); |
break; |
default: |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("strength"), |
- factory->NewStringFromStaticAscii("identical"), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("strength"), |
+ factory->NewStringFromStaticChars("identical"), SLOPPY).Assert(); |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("sensitivity"), |
- factory->NewStringFromStaticAscii("variant"), |
- SLOPPY).Assert(); |
+ resolved, factory->NewStringFromStaticChars("sensitivity"), |
+ factory->NewStringFromStaticChars("variant"), SLOPPY).Assert(); |
} |
JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("ignorePunctuation"), |
- factory->ToBoolean(collator->getAttribute( |
- UCOL_ALTERNATE_HANDLING, status) == UCOL_SHIFTED), |
+ resolved, factory->NewStringFromStaticChars("ignorePunctuation"), |
+ factory->ToBoolean(collator->getAttribute(UCOL_ALTERNATE_HANDLING, |
+ status) == UCOL_SHIFTED), |
SLOPPY).Assert(); |
// Set the locale |
@@ -651,18 +590,14 @@ void SetResolvedCollatorSettings(Isolate* isolate, |
uloc_toLanguageTag( |
icu_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status); |
if (U_SUCCESS(status)) { |
- JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("locale"), |
- factory->NewStringFromAsciiChecked(result), |
- SLOPPY).Assert(); |
+ JSObject::SetProperty(resolved, factory->NewStringFromStaticChars("locale"), |
+ factory->NewStringFromAsciiChecked(result), |
+ SLOPPY).Assert(); |
} else { |
// This would never happen, since we got the locale from ICU. |
- JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("locale"), |
- factory->NewStringFromStaticAscii("und"), |
- SLOPPY).Assert(); |
+ JSObject::SetProperty(resolved, factory->NewStringFromStaticChars("locale"), |
+ factory->NewStringFromStaticChars("und"), |
+ SLOPPY).Assert(); |
} |
} |
@@ -713,18 +648,14 @@ void SetResolvedBreakIteratorSettings(Isolate* isolate, |
uloc_toLanguageTag( |
icu_locale.getName(), result, ULOC_FULLNAME_CAPACITY, FALSE, &status); |
if (U_SUCCESS(status)) { |
- JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("locale"), |
- factory->NewStringFromAsciiChecked(result), |
- SLOPPY).Assert(); |
+ JSObject::SetProperty(resolved, factory->NewStringFromStaticChars("locale"), |
+ factory->NewStringFromAsciiChecked(result), |
+ SLOPPY).Assert(); |
} else { |
// This would never happen, since we got the locale from ICU. |
- JSObject::SetProperty( |
- resolved, |
- factory->NewStringFromStaticAscii("locale"), |
- factory->NewStringFromStaticAscii("und"), |
- SLOPPY).Assert(); |
+ JSObject::SetProperty(resolved, factory->NewStringFromStaticChars("locale"), |
+ factory->NewStringFromStaticChars("und"), |
+ SLOPPY).Assert(); |
} |
} |
@@ -786,7 +717,7 @@ icu::SimpleDateFormat* DateFormat::UnpackDateFormat( |
Isolate* isolate, |
Handle<JSObject> obj) { |
Handle<String> key = |
- isolate->factory()->NewStringFromStaticAscii("dateFormat"); |
+ isolate->factory()->NewStringFromStaticChars("dateFormat"); |
Maybe<bool> maybe = JSReceiver::HasOwnProperty(obj, key); |
CHECK(maybe.has_value); |
if (maybe.value) { |
@@ -862,7 +793,7 @@ icu::DecimalFormat* NumberFormat::UnpackNumberFormat( |
Isolate* isolate, |
Handle<JSObject> obj) { |
Handle<String> key = |
- isolate->factory()->NewStringFromStaticAscii("numberFormat"); |
+ isolate->factory()->NewStringFromStaticChars("numberFormat"); |
Maybe<bool> maybe = JSReceiver::HasOwnProperty(obj, key); |
CHECK(maybe.has_value); |
if (maybe.value) { |
@@ -919,7 +850,7 @@ icu::Collator* Collator::InitializeCollator( |
icu::Collator* Collator::UnpackCollator(Isolate* isolate, |
Handle<JSObject> obj) { |
- Handle<String> key = isolate->factory()->NewStringFromStaticAscii("collator"); |
+ Handle<String> key = isolate->factory()->NewStringFromStaticChars("collator"); |
Maybe<bool> maybe = JSReceiver::HasOwnProperty(obj, key); |
CHECK(maybe.has_value); |
if (maybe.value) { |
@@ -980,7 +911,7 @@ icu::BreakIterator* BreakIterator::InitializeBreakIterator( |
icu::BreakIterator* BreakIterator::UnpackBreakIterator(Isolate* isolate, |
Handle<JSObject> obj) { |
Handle<String> key = |
- isolate->factory()->NewStringFromStaticAscii("breakIterator"); |
+ isolate->factory()->NewStringFromStaticChars("breakIterator"); |
Maybe<bool> maybe = JSReceiver::HasOwnProperty(obj, key); |
CHECK(maybe.has_value); |
if (maybe.value) { |